Reputation: 41
What is this encoding below that you get when you string a packet in scapy? This is certainly not hex.
str(IP()) ’E\x00\x00\x14\x00\x01\x00\x00@\x00|\xe7\x7f\x00\x00\x01\x7f\x00\x00\x01’
Upvotes: 4
Views: 4139
Reputation: 658
the \x is the hex notation. In this case when you use str(IP()) you are trying to convert the packet data into string which is not completely valid because not every raw hex data could be found in ASCII table to substitute it with a letter so any hex that couldn't be converted will seen in this format \x14.
I think the following example will help:
encoding the packet data into hex format to view using python methods
Welcome to Scapy (2.1.1-dev)
>>> pkt=IP()
>>> pkt.summary()
'127.0.0.1 > 127.0.0.1 ip'
>>> data=str(pkt)
>>> data.encode('hex')
'450000140001000040007ce77f0000017f000001'
>>>
consider these points:
Upvotes: 4