mirror of
https://github.com/mgeeky/Penetration-Testing-Tools.git
synced 2024-11-24 19:41:36 +01:00
generateRogueDotNet.py
This commit is contained in:
parent
7c9c30d501
commit
b79ac0e73b
@ -34,7 +34,7 @@
|
|||||||
# cmd> %WINDIR%\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe /logfile= /logtoconsole=false /U rogue.dll
|
# cmd> %WINDIR%\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe /logfile= /logtoconsole=false /U rogue.dll
|
||||||
# cmd> %WINDIR%\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /logfile= /logtoconsole=false /U rogue.dll
|
# cmd> %WINDIR%\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /logfile= /logtoconsole=false /U rogue.dll
|
||||||
#
|
#
|
||||||
# Mariusz Banach / mgeeky, <mb@binary-offensive.com>
|
# Mariusz B. / mgeeky, <mb@binary-offensive.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
import re
|
import re
|
||||||
@ -519,7 +519,7 @@ def getSourceFileContents(
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Author: Casey Smith, Twitter: @subTee
|
Author: Casey Smith, Twitter: @subTee
|
||||||
Customized by: Mariusz Banach / mgeeky, <mb@binary-offensive.com>
|
Customized by: Mariusz B. / mgeeky, <mb@binary-offensive.com>
|
||||||
License: BSD 3-Clause
|
License: BSD 3-Clause
|
||||||
|
|
||||||
Step 1: Create Your Strong Name Key -> key.snk
|
Step 1: Create Your Strong Name Key -> key.snk
|
||||||
@ -806,7 +806,7 @@ def main(argv):
|
|||||||
sys.stderr.write('''
|
sys.stderr.write('''
|
||||||
:: Rogue .NET Source Code Generation Utility
|
:: Rogue .NET Source Code Generation Utility
|
||||||
Comes with a few hardcoded C# code templates and an easy wrapper around csc.exe compiler
|
Comes with a few hardcoded C# code templates and an easy wrapper around csc.exe compiler
|
||||||
Mariusz Banach / mgeeky, <mb@binary-offensive.com>
|
Mariusz B. / mgeeky, <mb@binary-offensive.com>
|
||||||
|
|
||||||
''')
|
''')
|
||||||
if len(argv) < 2:
|
if len(argv) < 2:
|
||||||
@ -860,14 +860,21 @@ def main(argv):
|
|||||||
_type = args.type
|
_type = args.type
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print(f'''Generated .NET assembly will expose:
|
||||||
|
|
||||||
|
Namespace : {args.namespace}
|
||||||
|
Classname : {args.module}
|
||||||
|
Method name : {args.method}
|
||||||
|
''')
|
||||||
|
|
||||||
management = ' /r:System.Management.Automation.dll /r:Microsoft.Build.Framework.dll'
|
management = ' /r:System.Management.Automation.dll /r:Microsoft.Build.Framework.dll'
|
||||||
|
srcfile = ''
|
||||||
|
|
||||||
if args.compile != 'nocompile':
|
if args.compile != 'nocompile':
|
||||||
if not args.output:
|
if not args.output:
|
||||||
print('[!] --output must be specified to compile file.')
|
print('[!] --output must be specified to compile file.')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
srcfile = ''
|
|
||||||
with tempfile.NamedTemporaryFile() as f:
|
with tempfile.NamedTemporaryFile() as f:
|
||||||
srcfile = f.name + '.cs'
|
srcfile = f.name + '.cs'
|
||||||
|
|
||||||
@ -907,6 +914,7 @@ def main(argv):
|
|||||||
if os.path.isfile(args.output):
|
if os.path.isfile(args.output):
|
||||||
print('[+] Success')
|
print('[+] Success')
|
||||||
else:
|
else:
|
||||||
|
if os.path.isfile(srcfile): os.remove(srcfile)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -953,5 +961,7 @@ Step 3: Execute your payload!
|
|||||||
|
|
||||||
sys.stderr.write('[?] Generated command line executing assembly\'s source code/executable.\n')
|
sys.stderr.write('[?] Generated command line executing assembly\'s source code/executable.\n')
|
||||||
|
|
||||||
|
if os.path.isfile(srcfile): os.remove(srcfile)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user