TGViewer
Python Learning Python Learning @python_bds · 5.74K subscribers
Post #1274 510
Python Script to Retrieve Saved Wi-Fi Passwords (Windows)

Someone requested this… We thought it might help.

import subprocess

def get_wifi_passwords():
# To get list of all saved Wi-Fi profiles
profiles_data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8', errors="ignore").split('\n')

profiles = [line.split(":")[1].strip() for line in profiles_data if "All User Profile" in line]

print("\nSaved Wi-Fi Networks & Passwords:\n" + "-"*40)

for profile in profiles:
try:
# To get password for each profile
profile_info = subprocess.check_output(
['netsh', 'wlan', 'show', 'profile', profile, 'key=clear']
).decode('utf-8', errors="ignore").split('\n')

password = [line.split(":")[1].strip() for line in profile_info if "Key Content" in line]

print(f"Network : {profile}")
print(f"Password: {password[0] if password else 'None / Open Network'}\n")

except:
print(f"Network : {profile}")
print("Password: Unable to retrieve\n")

if __name__ == "__main__":
get_wifi_passwords()



💻 How to use the above code:

1. Open any text editor (Notepad, VS Code, etc.)
2. Copy and paste the code above
3. Save the file as wifi_passwords.py
4. Open Command Prompt or PowerShell as Administrator
5. Navigate to the folder where you saved the file
6. Run the command:
python wifi_passwords.py 


✅ The script will list all the Wi-Fi networks that are saved on your computer along with their passwords.

⚠️ This only works for networks that are already saved on your Windows PC. It cannot crack or find passwords of networks you have never connected to.
  • ❤ 3
  • 🔥 2
More from @python_bds
  1. Oct 8, 2026🐛 This Python Bug Looks Random, But It Isn't Look at this: functions = [] for i in range(…
  2. Oct 6, 2026🐍 Python Performance Optimization Python Performance Optimization: Make Your Code Faster…
  3. Oct 4, 2026Python Set Methods ✍️
  4. Oct 3, 2026Post #1310
  5. Oct 1, 2026🐍 Python Beginner Notes
  6. Sep 30, 2026🧠 return vs print() in Python These are not interchangeable. def add(a, b): print(a + b)…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →