add warning and info tag to bad packet message

This commit is contained in:
Mystikfluu 2023-05-27 21:54:40 +02:00
parent 2fce45d847
commit fa228bda5a

View File

@ -79,13 +79,13 @@ while packets > 0 or serverhash == None:
serverhash = struct.unpack("64sx", datareceived)[0]
continue
if len(datareceived) != max_frame_payload:
print("\nerror bad packet: wrong size",len(datareceived))
print("\n[WARNING] bad packet: wrong size",len(datareceived))
continue
seq,checksum,data = struct.unpack(f"{header}{max_payload}s", datareceived)
if data_packets[seq] != None:
print("\nerror bad packet: received multiple times",seq)
print("\n[INFO] bad packet: received multiple times",seq)
continue
@ -97,7 +97,7 @@ while packets > 0 or serverhash == None:
#check if packet is corrupted
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(data.hex())
continue