-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWiFi Password Extractor (Windows)
More file actions
90 lines (75 loc) · 2.68 KB
/
WiFi Password Extractor (Windows)
File metadata and controls
90 lines (75 loc) · 2.68 KB
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
import subprocess
import re
import json
import os
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
import binascii
def get_wifi_profiles():
"""Get list of saved WiFi profiles"""
try:
# Get all WiFi profiles
profiles_data = subprocess.check_output(
['netsh', 'wlan', 'show', 'profiles'],
encoding='utf-8',
errors='ignore'
)
# Extract profile names
profiles = re.findall(r"All User Profile\s*:\s*(.*)", profiles_data)
return [profile.strip() for profile in profiles]
except Exception as e:
print(f"Error getting profiles: {e}")
return []
def get_wifi_password(profile_name):
"""Get password for a specific WiFi profile"""
try:
# Get profile details
profile_info = subprocess.check_output(
['netsh', 'wlan', 'show', 'profile', profile_name, 'key=clear'],
encoding='utf-8',
errors='ignore'
)
# Extract password using regex
password_match = re.search(r"Key Content\s*:\s*(.*)", profile_info)
if password_match:
password = password_match.group(1).strip()
return password if password else "No password"
else:
return "Password not found"
except Exception as e:
return f"Error: {e}"
def save_to_json(wifi_data, filename="wifi_passwords.json"):
"""Save WiFi data to JSON file"""
with open(filename, 'w') as f:
json.dump(wifi_data, f, indent=4)
print(f"\nData saved to {filename}")
def main():
print("=" * 50)
print("WiFi Password Extractor")
print("=" * 50)
wifi_profiles = get_wifi_profiles()
if not wifi_profiles:
print("No WiFi profiles found!")
return
print(f"\nFound {len(wifi_profiles)} WiFi profile(s):")
print("-" * 50)
wifi_data = []
for idx, profile in enumerate(wifi_profiles, 1):
password = get_wifi_password(profile)
print(f"{idx}. {profile}")
print(f" Password: {password}")
print("-" * 30)
wifi_data.append({
"profile": profile,
"password": password
})
# Save to file
save_to_json(wifi_data)
if __name__ == "__main__":
# Disclaimer
print("⚠️ DISCLAIMER: Use only on networks you own or have permission to test!")
consent = input("\nDo you understand and agree? (yes/no): ")
if consent.lower() == 'yes':
main()
else:
print("Operation cancelled.")