Hello! Thank you for the excellent library :)
Scapy has specialised subclasses of Dot11EltVendorSpecific that interpret and parse the generic info field of the parent class:
|
class Dot11EltVendorSpecific(Dot11Elt): |
|
name = "802.11 Vendor Specific" |
|
match_subclass = True |
|
fields_desc = [ |
|
ByteEnumField("ID", 221, _dot11_id_enum), |
|
ByteField("len", None), |
|
OUIField("oui", 0x000000), |
|
StrLenField("info", "", length_from=lambda x: x.len - 3) |
|
] |
|
|
|
@classmethod |
|
def dispatch_hook(cls, _pkt=None, *args, **kargs): |
|
if _pkt: |
|
oui = struct.unpack("!I", b"\x00" + _pkt[2:5])[0] |
|
if oui == 0x0050f2: # Microsoft |
|
type_ = orb(_pkt[5]) |
|
if type_ == 0x01: |
|
# MS WPA IE |
|
return Dot11EltMicrosoftWPA |
|
elif type_ == 0x02: |
|
# MS WME IE TODO |
|
# return Dot11EltMicrosoftWME |
|
pass |
|
elif type_ == 0x04: |
|
# MS WPS IE TODO |
|
# return Dot11EltWPS |
|
pass |
|
return Dot11EltVendorSpecific |
|
return cls |
For a project using Scapy as a library, how easiest can this be extended to cover an additional custom subclass? Is this possible with the current implementation and, if not, is another workaround accessible?
Hello! Thank you for the excellent library :)
Scapy has specialised subclasses of
Dot11EltVendorSpecificthat interpret and parse the genericinfofield of the parent class:scapy/scapy/layers/dot11.py
Lines 1428 to 1456 in c15a670
For a project using Scapy as a library, how easiest can this be extended to cover an additional custom subclass? Is this possible with the current implementation and, if not, is another workaround accessible?