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

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

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