I'm trying to check the location of a captured packet file. It works perfectly fine if I run it in ubuntu, but if I switch and run it in windows every time it hits a IPv6 packet it stops. I'm wanting it to just skip it and go on to the next packet like it does in ubuntu but it doesn't. It just stops the for loop whenever it hits the v6 IP addy.
Any ideas how to fix this?
def printPcap(pcap):
for (ts, buf) in pcap:
try:
eth = dpkt.ethernet.Ethernet(buf)
ip = eth.data
src = socket.inet_ntoa(ip.src)
dst = socket.inet_ntoa(ip.dst)
print '[+] Src: ' + src + ' --> Dst: ' + dst
print '[+] Src: ' + retGeoStr(src) + ' --> Dst: ' + retGeoStr(dst) + '\n'
except:
pass
If I print out the error the except catches it prints:
Packet IP wrong length for inet_ntoa
I'm pretty sure this is because its the IPv6 which then I would expect it to go on to the next packet, but it also prints out this error:
'str' object has no attribute 'src'
I think this is what is causing my problem.
Like I said it will work fine up until the point it hits that v6 address and it works fine on ubuntu. I'm puzzled.