This repository was 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 pathdeauthentication_detector.py
executable file
·112 lines (83 loc) · 2.34 KB
/
deauthentication_detector.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/python
"""
===============================================================
++++++++++++++++++++++++ READ ME ++++++++++++++++++++++++++++++
===============================================================
This Script Is Part Of
+++++++++++++++++++++++++++++++++++++
Simple Wireless Framework
+++++++++++++++++++++++++++++++++++++
Author :
Suraj Singh
Admin
S.S.B Group
surajsinghbisht054@gmail.com
www.bitforestinfo.com
Note: We Feel Proud To Be Indian
This Script Created Only For Practise And Educational Purpose Only
The Author Will Not Take Any Responsibility Of Any illegal Activity.
"""
# Required Data Feild
Feild = {
# Key Value Required
'count' : (5, False) ,
'iface' : (None, True),
'timeout' : (None, False),
}
# Import Module
import sys
import scapy.all as scapy
# Main Class For Finding Deauthentication Packets
class DeauthenticationDetector:
def __init__(self, *args, **kwargs):
"""
All Arguments And Keywords Will Directly Passed To
Python Scapy Sniff Function.
"""
self.args = args
self.kwargs = kwargs
self.data={}
self.Sniffing_Start()
def extract_packets(self, pkt):
"""
Function For Extracting Packets.
This Function Is Specially Created For Filtering
Deauthentication Packets.
"""
if pkt.haslayer(scapy.Dot11Deauth):
victim1 = pkt.addr2
victim2 = pkt.addr1
if str([victim1, victim2]) in self.data.keys():
self.data[str([victim1, victim2])]=self.data[str([victim1, victim2])]+1
else:
self.data[str([victim1, victim2])]=1
self.print_values()
return
def print_values(self):
"""
Function For Printing Values
"""
line = 0
for a,b in self.data.iteritems():
v1, v2 = eval(a)
print "\t[#] Deauthentication Packet : {} <---> {} | Packets : {}".format(v1,v2,b)
line+=1
# Backspace Trick
sys.stdout.write("\033[{}A".format(line))
return
def Sniffing_Start(self):
'''
Function For Creating Python Scapy.sniff Function
'''
scapy.sniff(prn=self.extract_packets, *self.args, **self.kwargs)
return
# Main Function
def main(*args, **kwargs):
DeauthenticationDetector(*args, **kwargs)
return
# Main Trigger
if __name__=='__main__':
if len(sys.argv)==2:
main(iface=sys.argv[1])
else:
print " [ Error ] Please Provide Monitor Mode Interface Name ALso \n\n\t:~# sudo {} mon0 ".format(sys.argv[0])