Scapy graphical dump of custom protocols

668 views Asked by At

I defined the following packet:

p = IP()/TCP()/Unique()

where Unique is a new layer:

class Unique(Packet):
name = "Unique"
fields_desc=[ IntField("a", 0),
         IntField("b", 0),
         IntField("c", 0)]

I want to make a graphical PDF dump of p but If I use the command

p.pdfdump(test.pdf)

in the resulting .pdf file the Unique layer is not decoded and therefore it is represented just as Raw. How can I draw a custom layer?

1

There are 1 answers

0
Farzad Forughi On

You should use rebuild input parameter of pdfdump method. I don't know why (because lack of documentation on source code) but if you set rebuild=0, your custom protocol details will appear in output. For example:

p.pdfdump('test.pdf', rebuild=0)