Skip to content

Instantly share code, notes, and snippets.

@waterrmalann
Last active August 8, 2023 04:03
Show Gist options
  • Save waterrmalann/08d1c4fe7b27c427a58ce54f5e1c5017 to your computer and use it in GitHub Desktop.
Save waterrmalann/08d1c4fe7b27c427a58ce54f5e1c5017 to your computer and use it in GitHub Desktop.
Find saved passwords of known WiFi Networks on Windows
import subprocess
def find_passwords():
profiles_out = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8',).split('\n')
profiles = [i.split(":")[1][1:-1] for i in profiles_out if "All User Profile" in i]
print(f"Known Networks: {len(profiles)}")
print()
for profile in profiles:
wifi_out = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', profile, 'key=clear']).decode('utf-8').split('\n')
password = [b.split(":")[1][1:-1] for b in wifi_out if "Key Content" in b]
cipher = '/'.join([b.split(":")[1][1:-1] for b in wifi_out if "Cipher" in b])
print(f"[{profile}]")
print(f"Cipher: {cipher}")
print(f"Password: {password[0] if password else 'N/A'}")
print()
find_passwords()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment