Files
metasploit-gs/test/modules/exploits/test/java_tester.rb
T
James Lee 4cd329a943 Spawn the payload as a seperate process
Running the payload using system() in a thread was causing some weird
interactions with ctrl-c. Fix those issues by using Process.spawn and
Process.detach. I suspect this was the original cause of #3631, java
meterpreter sessions dying unaccountably.

See #3631
2011-12-31 12:11:34 -07:00

59 lines
1.2 KiB
Ruby

##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
require 'rex'
class Metasploit3 < Msf::Exploit::Remote
Rank = ManualRanking
def initialize( info = {} )
super( update_info( info,
'Name' => 'Exec',
'Description' => %q{ },
'License' => MSF_LICENSE,
'Author' => [ 'egypt' ],
'Version' => '$Revision$',
'References' => [ ],
'Platform' => [ 'java', 'linux' ],
'Arch' => ARCH_JAVA,
'Payload' => { 'Space' => 20480, 'BadChars' => '', 'DisableNops' => true },
'Targets' =>
[
[ 'Generic (Java Payload)', {
'Arch' => ARCH_JAVA,
'Platform' => 'java'
} ],
[ 'Linux', {
'Arch' => ARCH_X86,
'Platform' => 'linux'
} ],
],
'DefaultTarget' => 0
))
end
def exploit
# Equivalent to payload.encoded
@jar_data = payload.encoded_jar.pack
File.open("payload.jar", "wb") do |fd|
fd.write(@jar_data)
end
pid = Process.spawn("java -jar payload.jar &")
Process.detach pid
end
end