I want to send specific hex sequences e.g FF FF FF FF FF FF on wire using scapy without using the Raw option. Will finding the string equivalent of these hex sequences and using them as packet payload have the same effect since scapy will convert them to hex and send ?
In python 2.x you can create the binary data from a hex string using the binascii
module. I've used this to correctly set the duid in DHCPv6 request, just passing it to the option of the packet type.
For example
>>> import binascii
>>> binascii.unhexlify('FFFFFFFFFFFF')
'\xff\xff\xff\xff\xff\xff'
Passing that string to the payload should be all you need. Of course you can just type the string with \x
escapes as above, but it's easier to represent it as a nice hex string and call unhexlify
when you need the correct binary data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With