I am working on a project to detect wireless encryption in Beacon and ProbeResponse packets with Scapy.
I used a solution of another question on stackoverflow How to use Scapy to determine Wireless Encryption Type?
This is my current script:
p = pkt[Dot11Elt]
essid, channel = None, None
cryptoSet = set()
while isinstance(p, Dot11Elt):
if p.ID == 0:
essid = p.info.decode("utf-8", "replace")
elif p.ID == 3:
channel = ord(p.info)
elif p.ID == 48:
cryptoSet.add("WPA2")
elif p.ID == 221 and p.info.startswith(b"\x00\x50\xf2\x01\x01\x00"):
cryptoSet.add("WPA")
p = p.payload
if not cryptoSet:
cap = pkt.sprintf("{Dot11Beacon:%Dot11Beacon.cap%}"
"{Dot11ProbeResp:%Dot11ProbeResp.cap%}").split('+')
if "privacy" in cap:
cryptoSet.add("WEP")
else:
cryptoSet.add("OPN")
crypto = "/".join(cryptoSet)
The script detect SSID, channel, WPA2, WEP and OPN. But when I get a packet with WPA and ID 221 I get an error.
AttributeError: 'p' object has no attribute 'info'
So I need a different way to solve this.
I am using Python 3.5.3 and Scapy 2.4.0.dev581. Dev because I need the RSSI too. This is solved in the current dev version.
Any ideas how to fix this?