In Scapy, I want to manually map packets to corresponding messages that exceed ICMP.
I need to map:
As for the first 8 bytes of the data packet, I just need to do:
str(myPacket[IP].payload)[:8]
I do not know how to get only the IP header myPacket. Everything I do now replaces the payload of the entire packet with the first 8 bytes. I'm afraid that finding and replacing, if applied to thousands of packages, might take too long.
strOfMyPacket = str(myPacket[IP])
strOfMyPacket.replace(str(myPacket[IP].payload),str(myPacket[IP].payload)[:8],1)
Any faster way that will allow me to do the following:
partOfPayload = str(myPacket[IP].payload)[:8]
fullHeader = _______
stringToCompare = fullHeader + partOfPayload
source