Python_2_Examples_and_Notes/spse_excercises/exc_mod3_p6_wifi_ssid_sniff.py

18 lines
409 B
Python

#!/usr/bin/python
# -*- coding: utf-8 -*-
# Note: general solution posted multiple times.
from scapy.all import sniff, Dot11
aps = []
def PacketHandler(pkt):
if pkt.haslayer(Dot11):
if pkt.type == 0 and pkt.subtype == 8:
if pkt.addr2 not in aps :
aps.append(pkt.addr2)
print "SSID found: %s " %(pkt.info)
sniff(iface="wlan0mon", prn=PacketHandler)