Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 35 additions & 14 deletions scapy/layers/dot11.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,22 +1439,25 @@ class Dot11EltVendorSpecific(Dot11Elt):
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
ouicls = cls.registered_ouis.get(oui, cls)
if ouicls.dispatch_hook != cls.dispatch_hook:
# Sub-classes can have their own dispatch_hook
return ouicls.dispatch_hook(_pkt=_pkt, *args, **kargs)
cls = ouicls
return cls

registered_ouis = {}

@classmethod
def register_variant(cls): # XXX: We do not accept id, but our super-class does
Comment thread
gpotter2 marked this conversation as resolved.
Outdated
oui = cls.oui.default
if not oui:
# This is Dot11EltVendorSpecific, register it in the super-class.
super().register_variant()
elif oui not in cls.registered_ouis:
# Sub-Vendor (e.g. Dot11EltMicrosoftWPA)
cls.registered_ouis[oui] = cls
Comment thread
gpotter2 marked this conversation as resolved.


class Dot11EltMicrosoftWPA(Dot11EltVendorSpecific):
name = "802.11 Microsoft WPA"
Expand All @@ -1467,6 +1470,24 @@ class Dot11EltMicrosoftWPA(Dot11EltVendorSpecific):
XByteField("type", 0x01)
] + Dot11EltRSN.fields_desc[2:8]

@classmethod
def dispatch_hook(cls, _pkt=None, *args, **kargs):
if _pkt:
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


# 802.11-2016 9.4.2.19

Expand Down
Loading