scapy
scapy copied to clipboard
PadField missing from rfc() output
While playing with rfc(), I noticed that the PadField is not displayed. I believe that it is a bug.
Code
class Test(Packet):
fields_desc = [IntField("f1", 0),
ByteField("f2", 1)]
class TestPad(Packet):
fields_desc = [IntField("f1", 0),
PadField(ByteField("f2", 1), 4)]
print(raw(Test()))
rfc(Test)
print(raw(TestPad()))
rfc(TestPad)
Output
b'\x00\x00\x00\x00\x01'
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| F1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| F2 |
+-+-+-+-+-+-+-+-+
Fig. Test
b'\x00\x00\x00\x00\x01\x00\x00\x00'
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| F1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| F2 |
+-+-+-+-+-+-+-+-+
Fig. TestPad
Good point. There might be some other complex fields that currently aren't handled.