Add option to save java code to file.
git-svn-id: file:///home/svn/framework3/trunk@8557 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
ab3b173040
commit
5b3c87c9c5
|
@ -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)
|
||||
|
||||
# I used to dump #{data} directly into the applet source, but there's a max size of 65k characters for constant Strings.
|
||||
def get_code
|
||||
|
||||
appletsource = %Q^
|
||||
/*
|
||||
*/
|
||||
|
@ -334,7 +343,7 @@ public class #{datastore['APPLETNAME']} extends Applet
|
|||
}
|
||||
}^
|
||||
appletcode = { 'classnames' => [ datastore['APPLETNAME'] ] ,
|
||||
'codefiles' => [ appletsource ] }
|
||||
'codefiles' => [ appletsource ] }
|
||||
|
||||
return appletcode
|
||||
end
|
||||
|
@ -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'] )
|
||||
|
|
Loading…
Reference in New Issue