This repository has been archived by the owner on Dec 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgetwifiinfo.py
executable file
·77 lines (69 loc) · 1.64 KB
/
getwifiinfo.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# +++++++++++++++++++++++++++++++++++++++++
#
# WLAN SSID Sniffer
# +++++++++++++++++++++++++++++++++++++++++
#
#
# Author : SSB
# http://bitforestinfo.blogspot.com
# github.com/surajsinghbisht054
#
#
# This Script Is Created For Educational And Practise Purpose Only
#
#
# import scapy module
import scapy.all as scapy
# Extracted Packet Format
Pkt_Info = """
---------------[ Packet Captured ]-----------------------
Subtype : {}
Address 1 : {}
Address 2 : {} [BSSID]
Address 3 : {}
Address 4 : {}
AP : {} [SSID]
"""
# Founded Access Point List
ap_list = []
# For Extracting Available Access Points
def PacketHandler(pkt) :
#
# pkt.haslayer(scapy.Dot11Elt)
#
# This Situation Help Us To Filter Dot11Elt Traffic From
# Various Types Of Packets
#
# pkt.type == 0
#
# This Filter Help Us To Filter Management Frame From Packet
#
# pkt.subtype == 8
#
# This Filter Help Us To Filter Becon From From Captured Packets
#
# p.haslayer(Dot11Beacon) or p.haslayer(Dot11ProbeResp)
if pkt.haslayer(scapy.Dot11Beacon) or pkt.haslayer(scapy.Dot11ProbeResp):
#
# This Function Will Verify Not To Print Same Access Point Again And Again
#
if pkt.addr2 not in ap_list:
#
# Append Access Point
#
ap_list.append(pkt.addr2)
#
# Print Packet Informations
#
print Pkt_Info.format(pkt.subtype,pkt.addr1, pkt.addr2, pkt.addr3, pkt.addr4, pkt.info)
# Main Trigger
if __name__=="__main__":
# Previous Function Trigger
#
# here, iface="mon0" for Interface with monitor mode enable
#
scapy.sniff(iface="mon0", prn = PacketHandler, timeout=60)