Add option to save java code to file.

git-svn-id: file:///home/svn/framework3/trunk@8557 4d416f70-5f16-0410-b530-b9f4589650da
unstable
natron 2010-02-19 05:11:56 +00:00
parent ab3b173040
commit 5b3c87c9c5
1 changed files with 14 additions and 5 deletions

View File

@ -105,6 +105,10 @@ class Metasploit3 < Msf::Exploit::Remote
#OptString.new('PACKAGENAME', [ true, "The package name for gen'd classes.","x" ]),
#OptString.new('CUSTOMJAR', [ false, "A custom .jar applet to use.", nil]),
], self.class)
register_advanced_options(
[
OptString.new('SAVETOFILE', [ false, "When set, source is saved to this directory under external/source/", nil ]),
], self.class)
end
@ -123,12 +127,17 @@ class Metasploit3 < Msf::Exploit::Remote
print_error
@use_static = true
end
if datastore['SAVETOFILE']
appletsource = get_code
save_to_file( appletsource['classnames'], appletsource['codefiles'], datastore['SAVETOFILE'] )
end
super
end
def get_code(cli)
def get_code
# I used to dump #{data} directly into the applet source, but there's a max size of 65k characters for constant Strings.
appletsource = %Q^
/*
*/
@ -385,7 +394,7 @@ public class #{datastore['APPLETNAME']} extends Applet
end
if not @use_static
appletcode = get_code(cli)
appletcode = get_code
print_status "Compiling applet classes..."
compile( appletcode['classnames'], appletcode['codefiles'] )