python - Creating variable length fields with scapy -


i'm trying create new layer scapy build kind of specific packets. in layer, i'm adding different fields don't know how add variable length ones.

can please show me example of creating variable length field scapy?

thank you.

see scapy build dissect

class foo(packet):     name = "foo"     fields_desc = [ varlenqfield("len", none, "data"),                     strlenfield("data", "", "len") ]      >>> f = foo(data="a"*129)     >>> f.show()     ###[ foo ]###       len= 0       data=    'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' 

Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

collision detection - C++ library for mesh to mesh intersection: what is available? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -