add warning and info tag to bad packet message
This commit is contained in:
parent
2fce45d847
commit
fa228bda5a
@ -79,13 +79,13 @@ while packets > 0 or serverhash == None:
|
|||||||
serverhash = struct.unpack("64sx", datareceived)[0]
|
serverhash = struct.unpack("64sx", datareceived)[0]
|
||||||
continue
|
continue
|
||||||
if len(datareceived) != max_frame_payload:
|
if len(datareceived) != max_frame_payload:
|
||||||
print("\nerror bad packet: wrong size",len(datareceived))
|
print("\n[WARNING] bad packet: wrong size",len(datareceived))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
seq,checksum,data = struct.unpack(f"{header}{max_payload}s", datareceived)
|
seq,checksum,data = struct.unpack(f"{header}{max_payload}s", datareceived)
|
||||||
if data_packets[seq] != None:
|
if data_packets[seq] != None:
|
||||||
print("\nerror bad packet: received multiple times",seq)
|
print("\n[INFO] bad packet: received multiple times",seq)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ while packets > 0 or serverhash == None:
|
|||||||
|
|
||||||
#check if packet is corrupted
|
#check if packet is corrupted
|
||||||
if checksum.hex() != hashlib.sha3_512(data).digest()[:16].hex():
|
if checksum.hex() != hashlib.sha3_512(data).digest()[:16].hex():
|
||||||
print("\nerror bad packet: checksum mismatch",seq)
|
print("\n[WARNING] bad packet: checksum mismatch",seq)
|
||||||
print(checksum.hex(),hashlib.sha3_512(data).digest()[:16].hex())
|
print(checksum.hex(),hashlib.sha3_512(data).digest()[:16].hex())
|
||||||
print(data.hex())
|
print(data.hex())
|
||||||
continue
|
continue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user