Show found addresses in targets-ipv6-multicast-*.

This is similar to a patch submitted by Daniel Miller.
This commit is contained in:
david 2011-10-07 09:51:05 +00:00
parent bc6468b246
commit 9e7db09d40
3 changed files with 16 additions and 9 deletions

View file

@ -87,7 +87,7 @@ action = function()
local start_time = nmap:clock()
local cur_time = nmap:clock()
local found_targets = 0
local addrs = {}
repeat
local status, length, layer2, layer3 = pcap:pcap_receive()
@ -102,7 +102,7 @@ action = function()
id_set[identifier] = true
local target_str = packet.toipv6(reply.ip6_src)
target.add(target_str)
found_targets = found_targets + 1
addrs[#addrs + 1] = target_str
end
end
end
@ -111,5 +111,7 @@ action = function()
dnet:ethernet_close()
pcap:pcap_close()
return true
if #addrs > 0 then
return stdnse.format_output(true, addrs)
end
end

View file

@ -116,7 +116,7 @@ action = function()
local start_time = nmap:clock()
local cur_time = nmap:clock()
local found_targets = 0
local addrs = {}
repeat
local status, length, layer2, layer3 = pcap:pcap_receive()
@ -128,12 +128,12 @@ action = function()
if reply.mac_dst == src_mac then
reply = packet.Packet:new(layer3)
local target_addr = reply.ip6_src
found_targets = found_targets + 1
local identifier = get_identifier(reply.ip6_src)
if not id_set[identifier] then
id_set[identifier] = true
local target_str = packet.toipv6(target_addr)
target.add(target_str)
addrs[#addrs + 1] = target_str
end
end
end
@ -142,5 +142,7 @@ action = function()
dnet:ethernet_close()
pcap:pcap_close()
return true
if #addrs > 0 then
return stdnse.format_output(true, addrs)
end
end

View file

@ -153,7 +153,7 @@ action = function()
local start_time = nmap:clock()
local cur_time = nmap:clock()
local found_targets = 0
local addrs = {}
repeat
local status, length, layer2, layer3 = pcap:pcap_receive()
@ -168,13 +168,13 @@ action = function()
string.sub(expected_ip6_dst_prefix,1,12) == string.sub(reply.ip6_dst,1,12) then
local ula_target_addr_str = packet.toipv6(reply.ns_target)
local identifier = get_identifier(reply.ns_target)
found_targets = found_targets + 1
--Filter out the reduplicative identifiers.
--A host will send several NS packets with the same interface identifier if it receives several RA packets with different prefix during the discovery phase.
if not id_set[identifier] then
id_set[identifier] = true
local actual_addr_str = packet.toipv6(actual_prefix .. identifier)
target.add(actual_addr_str)
addrs[#addrs + 1] = actual_addr_str
end
end
end
@ -183,5 +183,8 @@ action = function()
dnet:ethernet_close()
pcap:pcap_close()
return true
if #addrs > 0 then
return stdnse.format_output(true, addrs)
end
end