1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 06:01:28 +00:00

Fix ARP decoder in packetdecoders.lua

Was throwing an exception when parsing a packet with a source IP that
had a fourth octet greater than 127, since the %d format specifier used
in the dups check is for signed integers, and the IP is little-endian.
Switched to %u (unsigned int) and it works great.
This commit is contained in:
dmiller
2012-08-15 19:25:44 +00:00
parent d25a2420e4
commit 86d1f0db47

View File

@@ -95,10 +95,10 @@ Decoders = {
tab.addrow(self.results, 'sender ip', 'sender mac', 'target ip')
end
if ( not(self.dups[("%d:%s"):format(sender.ip,sender.mac)]) ) then
if ( not(self.dups[("%u:%s"):format(sender.ip,sender.mac)]) ) then
if ( target.ALLOW_NEW_TARGETS ) then target.add(sender.ip) end
local mac = sender.mac:gsub("(..)(..)(..)(..)(..)(..)","%1:%2:%3:%4:%5:%6")
self.dups[("%d:%s"):format(sender.ip,sender.mac)] = true
self.dups[("%u:%s"):format(sender.ip,sender.mac)] = true
tab.addrow(self.results, ipOps.fromdword(sender.ip), mac, ipOps.fromdword(target.ip))
end