pingfs icon indicating copy to clipboard operation
pingfs copied to clipboard

struct error: unpack requires a string argument of length 16

Open darkgeem opened this issue 6 years ago • 1 comments

Hi, I'm running on ArchLinux and I get this error with the ping.py script: image It seems to be an outdated library or something like that, has anyone the same error as me?

darkgeem avatar Sep 13 '19 13:09 darkgeem

It is outdated library.There are a few hard code in the file ping.py in this project. it is about change digit 8 to digit 16.In my local site, sound like I have fixed this. Now it works in my side. Change Line 111 if len(packet) < 8: return None (type, code, csum, block_id) = struct.unpack('bbHL', packet[:8]) to if len(packet) < 16: return None (type, code, csum, block_id) = struct.unpack('bbHL', packet[:16])

Same to Line 121,128,133,142,179 t_csum = checksum(t_header+packet[8:]) if len(packet) < 20+8+1: return None # require 1 block of data if ip['length']+8+1 > len(packet): return None # invalid ICMP header payload = packet[8:] icmpHeader = recPacket[20:28] to t_csum = checksum(t_header+packet[16:]) if len(packet) < 20+16+1: return None # require 1 block of data if ip['length']+16+1 > len(packet): return None # invalid ICMP header payload = packet[8:] icmpHeader = recPacket[20:36]

I guest that it used to work on the 32 bit platform. But now we are in 64 bit platform.

APIPLM avatar May 19 '21 13:05 APIPLM