Python Forum
scapy - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: scapy (/thread-29365.html)



scapy - trazom - Aug-30-2020

hi,
i begin in scapy and i don't understand :

Quote:# Dictionnaire des types de sous paquet
_tlv_cls = { 0x0001: "STUN_Attribut1",
0x0002: "STUN_Attribut2",
...
0x8022: "STUN_Attribut7"
}
def _STUNGuessPayloadClass(p, **kargs):
cls = Raw
if len(p) >= 2:
t = struct.unpack("!H", p[:2])[0]
clsname = _tlv_cls.get(t, "Raw")
cls = globals()[clsname]

return cls(p, **kargs)

specially the line in bold characters

and why _tlv_cls is beginning with an underscore(_)?
can you help me please?


RE: scapy - micseydel - Aug-30-2020

You need to provide runnable code that reproduces your issue. That means include any necessary imports, and code tags.