-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathejemplo7.py
More file actions
executable file
·36 lines (31 loc) · 870 Bytes
/
Copy pathejemplo7.py
File metadata and controls
executable file
·36 lines (31 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
import scapy_ex
intfmon='mon0'
ap_list = [ ]
def PacketHandler(pkt) :
if pkt.haslayer(Dot11) :
if pkt.type == 0 and pkt.subtype == 8: ## beacon frame
if pkt.addr2 not in ap_list :
ap_list.append(pkt.addr2)
essid = pkt.info
hidden_essid = (not essid)
if pkt.hasflag('cap', 'privacy'):
elt_rsn = pkt[Dot11].rsn()
if elt_rsn:
enc = elt_rsn.enc
cipher = elt_rsn.cipher
auth = elt_rsn.auth
else:
enc = 'WEP'
cipher = 'WEP'
auth = ''
else:
enc = 'OPN'
cipher = ''
auth = ''
print "AP MAC: %s with SSID: %s and security: %s %s %s" %(pkt.addr2, essid, enc, cipher, auth)
sniff(iface=intfmon, prn = PacketHandler)