2007-02-18 00:10:39 +00:00
|
|
|
##
|
2010-03-24 00:11:21 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-02-18 00:10:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2007-02-18 00:10:39 +00:00
|
|
|
##
|
|
|
|
|
2006-09-14 06:09:46 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Exploit::Remote
|
2013-08-30 21:28:54 +00:00
|
|
|
Rank = ManualRanking
|
2006-09-14 06:09:46 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
#
|
|
|
|
# This module does basically nothing
|
|
|
|
# NOTE: Because of this it's missing a disclosure date that makes msftidy angry.
|
|
|
|
#
|
2006-09-14 06:09:46 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'Generic Payload Handler',
|
|
|
|
'Description' => %q{
|
|
|
|
This module is a stub that provides all of the
|
|
|
|
features of the Metasploit payload system to exploits
|
|
|
|
that have been launched outside of the framework.
|
|
|
|
},
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Author' => ['hdm'],
|
|
|
|
'References' => [ ],
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Space' => 10000000,
|
|
|
|
'BadChars' => '',
|
|
|
|
'DisableNops' => true,
|
|
|
|
},
|
2013-09-25 05:32:56 +00:00
|
|
|
'Platform' => %w{ android bsd java js linux osx nodejs php python ruby solaris unix win },
|
2013-08-30 21:28:54 +00:00
|
|
|
'Arch' => ARCH_ALL,
|
|
|
|
'Targets' => [ [ 'Wildcard Target', { } ] ],
|
|
|
|
'DefaultTarget' => 0
|
|
|
|
))
|
2007-02-27 18:57:47 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_advanced_options(
|
|
|
|
[
|
|
|
|
OptBool.new("ExitOnSession", [ false, "Return from the exploit after a session has been created", true ]),
|
|
|
|
OptInt.new("ListenerTimeout", [ false, "The maximum number of seconds to wait for new sessions", 0])
|
|
|
|
], self.class)
|
|
|
|
end
|
2006-09-14 06:09:46 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def exploit
|
|
|
|
if not datastore['ExitOnSession'] and not job_id
|
|
|
|
fail_with(Failure::Unknown, "Setting ExitOnSession to false requires running as a job (exploit -j)")
|
|
|
|
end
|
2010-06-15 17:25:14 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
stime = Time.now.to_f
|
|
|
|
print_status "Starting the payload handler..."
|
|
|
|
while(true)
|
|
|
|
break if session_created? and datastore['ExitOnSession']
|
|
|
|
break if ( datastore['ListenerTimeout'].to_i > 0 and (stime + datastore['ListenerTimeout'].to_i < Time.now.to_f) )
|
2007-02-27 18:57:47 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
select(nil,nil,nil,1)
|
|
|
|
end
|
|
|
|
end
|
2006-09-14 06:09:46 +00:00
|
|
|
|
|
|
|
|
2008-11-03 21:08:46 +00:00
|
|
|
end
|