Files
metasploit-gs/modules/exploits/multi/handler.rb
T

69 lines
2.0 KiB
Ruby
Raw Normal View History

##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Exploit::Remote
2013-08-30 16:28:54 -05:00
Rank = ManualRanking
2006-09-14 06:09:46 +00:00
2013-08-30 16:28:54 -05: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 16:28:54 -05:00
def initialize(info = {})
2017-07-24 15:47:06 -07:00
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', 'bcook-r7' ],
'References' => [ ],
'Payload' =>
{
'Space' => 10000000,
'BadChars' => '',
'DisableNops' => true
},
2017-12-12 16:05:23 +08:00
'Platform' => %w[android apple_ios bsd java js linux osx nodejs php python ruby solaris unix win mainframe multi],
2017-07-24 15:47:06 -07:00
'Arch' => ARCH_ALL,
'Targets' => [ [ 'Wildcard Target', {} ] ],
'DefaultTarget' => 0,
2017-07-24 15:47:06 -07:00
)
)
2013-08-30 16:28:54 -05:00
register_advanced_options(
[
2017-07-24 15:47:06 -07:00
OptBool.new(
"ExitOnSession",
2017-11-06 01:19:00 -06:00
[ true, "Return from the exploit after a session has been created", true ]
2017-07-24 15:47:06 -07:00
),
OptInt.new(
"ListenerTimeout",
[ false, "The maximum number of seconds to wait for new sessions", 0 ]
)
]
)
2013-08-30 16:28:54 -05:00
end
2006-09-14 06:09:46 +00:00
2013-08-30 16:28:54 -05:00
def exploit
if datastore['DisablePayloadHandler']
print_error "DisablePayloadHandler is enabled, so there is nothing to do. Exiting!"
return
end
2013-08-30 16:28:54 -05:00
stime = Time.now.to_f
2017-07-24 15:47:06 -07:00
timeout = datastore['ListenerTimeout'].to_i
loop do
break if session_created? && datastore['ExitOnSession']
break if timeout > 0 && (stime + timeout < Time.now.to_f)
2017-11-06 01:21:06 -06:00
Rex::ThreadSafe.sleep(1)
2013-08-30 16:28:54 -05:00
end
end
2008-11-03 21:08:46 +00:00
end