Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scapy
#1
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?
Reply
#2
You need to provide runnable code that reproduces your issue. That means include any necessary imports, and code tags.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  exception scapy kolikol 1 2,481 Jun-11-2025, 09:35 AM
Last Post: bobprogrammer
  Scapy Basics Shivi 0 2,428 Sep-25-2023, 07:37 AM
Last Post: Shivi
  How to get every IP found by a Scapy traceroute? jao 0 3,654 Feb-06-2022, 01:00 AM
Last Post: jao
  can I set scan interval for scapy? korenron 0 3,327 Dec-31-2020, 01:43 PM
Last Post: korenron
  network and scapy trazom 0 3,037 Aug-16-2020, 03:54 PM
Last Post: trazom
  Scapy, creating response for GET request. SyRex1013 4 7,260 Dec-11-2018, 07:39 AM
Last Post: SyRex1013
  Failed to recieve scapy udp packet SkyAmryBoi 1 5,304 Sep-29-2017, 01:26 PM
Last Post: camp0
  Scapy route6 configuration peterkl 0 4,944 Mar-06-2017, 03:58 PM
Last Post: peterkl
  Scapy Beacon Frames peterkl 1 7,712 Feb-28-2017, 09:00 PM
Last Post: peterkl
  FIN scan with scapy peterkl 0 6,579 Feb-13-2017, 09:10 PM
Last Post: peterkl

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020