#!/usr/bin/env python
from scapy.all import *
ap_list = []
def myPacketHandler(pkt) :
if pkt.haslayer(Dot11) :
#type 0 = Management subtype 4 = Beacon
if pkt.type == 0 and pkt.subtype == 8 :
if pkt.addr2 not in ap_list :
ap_list.append(pkt.addr2)
print "AP MAX: %s with SSID: %s" % (pkt.addr2, pkt.info)
sniff(iface="mon0", prn = myPacketHandler, store=0)
Editar (sair após 500 balizas - podem ser as mesmas balizas):
#!/usr/bin/env python
from scapy.all import *
import sys
ap_list = []
d = {'counter' : 0}
def myPacketHandler(pkt) :
if pkt.haslayer(Dot11) :
#type 0 = Management subtype 4 = Beacon
if pkt.type == 0 and pkt.subtype == 8 :
d['counter'] += 1
if d['counter']>500:
sys.exit()
if pkt.addr2 not in ap_list :
ap_list.append(pkt.addr2)
print "AP MAX: %s with SSID: %s" % (pkt.addr2, pkt.info)
sniff(iface="mon0", prn = myPacketHandler, store=0)