Quick one today. I needed the Wi-Fi password for an AP I set up months ago. The Windows GUI path is: Settings → Network → Status → Properties → scroll → Security → Show characters. Five clicks, per network.
This script does it in one run:
import subprocess, re
out = subprocess.run(["netsh", "wlan", "show", "profiles"],
capture_output=True, text=True).stdout
profiles = re.findall(r"All User Profile\s+:\s(.+)", out)
for name in profiles:
name = name.strip()
detail = subprocess.run(["netsh", "wlan", "show", "profile", name, "key=clear"],
capture_output=True, text=True).stdout
pw = re.search(r"Key Content\s+:\s(.+)", detail)
print(f"{name:30} {pw.group(1) if pw else '(open network)'}")
Example output:
HomeNet-5G CorrectHorseBatteryStaple
CoffeeShop-Guest (open network)
Airport-Lounge flyfree2026
Two gotchas:
- Run it as the same user who saved the profiles —
netshonly shows what your account can see. - On Linux/macOS this doesn't apply — Linux keeps them in
/etc/NetworkManager/system-connections/(needs root), macOS wantssecurity find-generic-password -ga "SSID".
I keep this in a bin/ folder alongside other tiny scripts. Half of them were drafted with MonkeyCode, which is free for this kind of quick utility writing: https://ly.cyberserval.tech/iIETXiF
What's the smallest script you actually use weekly? Mine's probably a 3-liner that renames screenshot files by date.
Top comments (0)