I am having an strange problem trying to generate a raw packet with Scappy.
I am doing the following:
eee=Ether(dst='08:00:11:11:11', src='08:00:11:11:22:22', type=0x888)/Raw(load='112233445566778888776655443322110901')
But when I do a hexdump of the newly created packet:
hexdump(eee)
0000 08 00 11 11 11 00 08 00 11 11 22 22 08 88 **31 31** ..........""..11
0010 **32 32** 33 33 34 34 35 35 36 36 37 37 38 38 38 38 2233445566778888
0020 37 37 36 36 35 35 34 34 33 33 32 32 31 31 30 39 7766554433221109
0030 30 31
It look like it is appending a 3 to the hexdump version of the payload. I really do not know from where that 3 is appearing.
Thanks in advance for any hint.
The
Raw
layer takes the binary representation of theload
argument. Since the ascii value of the character1
is0x31
and the ascii value of the character2
is0x32
, the binary representation of the string1122
is0x31313232
. That's what you see as the output ofhexdump
.What you need to do is decode the string before transferring it as the
load
argument to theRaw
layer: