From 86d1f0db479a4635523366ec58ed5d252b13dcf5 Mon Sep 17 00:00:00 2001 From: dmiller Date: Wed, 15 Aug 2012 19:25:44 +0000 Subject: [PATCH] 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. --- nselib/data/packetdecoders.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nselib/data/packetdecoders.lua b/nselib/data/packetdecoders.lua index 919cd3d71..9f875e845 100644 --- a/nselib/data/packetdecoders.lua +++ b/nselib/data/packetdecoders.lua @@ -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