@@ -20,7 +20,7 @@ def initialize
20
20
the host portion of the IPv6 address. Use NDP host solicitation to
21
21
determine if the IP address is valid'
22
22
} ,
23
- 'Author' => 'wuntee' ,
23
+ 'Author' => [ 'wuntee' , 'd0lph1n98' ] ,
24
24
'License' => MSF_LICENSE ,
25
25
'References' =>
26
26
[
@@ -33,20 +33,22 @@ def initialize
33
33
OptInt . new ( 'TIMEOUT_NEIGHBOR' , [ true , "Time (seconds) to listen for a solicitation response." , 1 ] )
34
34
] , self . class )
35
35
36
- register_advanced_options (
37
- [
38
- OptString . new ( 'PREFIX' , [ true , "Prefix that each host should get an IPv6 address from" ,
39
- "2001:1234:DEAD:BEEF::" ]
40
- )
41
- ] , self . class )
42
-
43
36
deregister_options ( 'SNAPLEN' , 'FILTER' , 'RHOST' , 'PCAPFILE' )
44
37
end
45
38
39
+ def generate_prefix ( )
40
+ max = 16 ** 4
41
+ prefix = "2001:"
42
+ ( 0 ..2 ) . each do
43
+ prefix << "%x:" % Random . rand ( 0 ..max )
44
+ end
45
+ return prefix << ':'
46
+ end
47
+
46
48
def listen_for_neighbor_solicitation ( opts = { } )
47
49
hosts = [ ]
48
50
timeout = opts [ 'TIMEOUT' ] || datastore [ 'TIMEOUT' ]
49
- prefix = opts [ 'PREFIX' ] || datastore [ 'PREFIX' ]
51
+ prefix = @prefix
50
52
51
53
max_epoch = ::Time . now . to_i + timeout
52
54
autoconf_prefix = IPAddr . new ( prefix ) . to_string ( ) . slice ( 0 ..19 )
@@ -94,7 +96,7 @@ def create_router_advertisment(opts={})
94
96
smac = @smac
95
97
shost = opts [ 'SHOST' ] || datastore [ 'SHOST' ] || ipv6_link_address
96
98
lifetime = opts [ 'LIFETIME' ] || datastore [ 'TIMEOUT' ]
97
- prefix = opts [ 'PREFIX' ] || datastore [ 'PREFIX' ]
99
+ prefix = @prefix
98
100
plen = 64
99
101
dmac = "33:33:00:00:00:01"
100
102
@@ -141,7 +143,7 @@ def router_advertisement_payload
141
143
checksum = 0
142
144
hop_limit = 0
143
145
flags = 0x08
144
- lifetime = 1800
146
+ lifetime = 0
145
147
reachable = 0
146
148
retrans = 0
147
149
[ type , code , checksum , hop_limit , flags ,
@@ -152,6 +154,7 @@ def run
152
154
# Start capture
153
155
open_pcap ( { 'FILTER' => "icmp6" } )
154
156
157
+ @prefix = generate_prefix ( )
155
158
@netifaces = true
156
159
if not netifaces_implemented?
157
160
print_error ( "WARNING : Pcaprub is not uptodate, some functionality will not be available" )
0 commit comments