Finding SSIDs
To get the SSID, we need to update the previous recipe and parse the SSID from the packets.
How to do it...
Following are the steps to write a SSID sniffer script with scapy
module:
- Create a
sniff-ssid.py
file and open it in your editor. - Import the module required:
from scapy.all import *
- Now create a function to parse the SSID from the packet:
def parseSSID(pkt): if pkt.haslayer(Dot11): print(pkt.show()) if pkt.type == 0 and pkt.subtype == 8: ap_list.append(pkt.addr2) print("SSID:" + pkt.info)
- Now run the
sniff
and call the parse function on the callback.
sniff(iface='en0', prn=ssid, count=10, timeout=3, store=0)
- Now run this script with the
sudo
permission:
$ sudo python3 sniff-ssid.py