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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user