-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwifipassword.py
More file actions
18 lines (13 loc) · 797 Bytes
/
wifipassword.py
File metadata and controls
18 lines (13 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import subprocess
data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8').split('\n')
# Now we will store the profiles by converting them to a list
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
# Using a for loop in Python, we are checking and printing Wi-Fi passwords
for i in profiles:
try:
result = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'keyMaterial=clear']).decode('utf-8').split('\n')
# Storing password after converting them to a list
result = [b.split(":")[1][1:-1] for b in result if "Key Content" in b]
print("{:<30} | {:<}".format(i, result[0]))
except subprocess.CalledProcessError as e:
print(f"Error retrieving password for profile '{i}': {e}")