Python Forum

Full Version: scapy
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
You need to provide runnable code that reproduces your issue. That means include any necessary imports, and code tags.