diff --git a/wifi password extractor/README.md b/wifi password extractor/README.md new file mode 100644 index 0000000..2398b31 --- /dev/null +++ b/wifi password extractor/README.md @@ -0,0 +1,33 @@ +# Wi-Fi Password Extractor + QR Code Generator + +A small Windows-only Python utility that extracts saved Wi-Fi profiles (SSIDs) and their passwords from the current machine and optionally generates QR codes for each network so other devices can scan and join easily. + +> ⚠️ **Important — Use ethically** +> Only run this script on machines you own or have permission to inspect. Do NOT use it to access networks that you are not authorized to access. + +--- + +## Features + +- Lists saved Wi-Fi SSIDs on the current Windows machine. +- Prints stored passwords (if present). +- Generates QR code PNG files for networks with passwords. +- Saves QR images to a local folder named `wifi_qr_codes`. + +--- + +## Requirements + +- Python 3.8+ (recommended) +- Windows (uses `netsh wlan` commands) +- See `requirements.txt` for Python package dependencies. + +Install dependencies: + +```bash +# Using pip +python -m pip install -r requirements.txt + +# or directly +python -m pip install qrcode[pil] +``` diff --git a/wifi password extractor/requirements.txt b/wifi password extractor/requirements.txt new file mode 100644 index 0000000..77ce01a --- /dev/null +++ b/wifi password extractor/requirements.txt @@ -0,0 +1,6 @@ +# Core dependency for generating QR codes (includes Pillow for image support) +qrcode[pil] + +# (Optional) If you use virtualenv or want to pin versions, replace above with: +# qrcode[pil]==7.3 +# Pillow==9.5.0 diff --git a/wifi password extractor/wifi_passwd_extractor.py b/wifi password extractor/wifi_passwd_extractor.py new file mode 100644 index 0000000..b9dca49 --- /dev/null +++ b/wifi password extractor/wifi_passwd_extractor.py @@ -0,0 +1,56 @@ +import subprocess +import re +import qrcode +import os + +def get_wifi_profiles(): + """Get all saved Wi-Fi profile names""" + try: + profiles_data = subprocess.check_output(["netsh", "wlan", "show", "profiles"], text=True) + profiles = re.findall(r"All User Profile\s*:\s*(.*)", profiles_data) + return profiles + except subprocess.CalledProcessError: + print("[ERROR] Unable to fetch Wi-Fi profiles. Make sure you are running on Windows.") + return [] + +def get_wifi_password(profile_name): + """Get Wi-Fi password for a given profile""" + try: + profile_info = subprocess.check_output( + ["netsh", "wlan", "show", "profile", profile_name, "key=clear"], + text=True + ) + password_match = re.search(r"Key Content\s*:\s*(.*)", profile_info) + return password_match.group(1) if password_match else None + except subprocess.CalledProcessError: + return None + +def generate_qr_code(ssid, password): + """Generate QR code for Wi-Fi credentials""" + qr_folder = "wifi_qr_codes" + os.makedirs(qr_folder, exist_ok=True) + + qr_data = f"WIFI:T:WPA;S:{ssid};P:{password};;" + qr_img = qrcode.make(qr_data) + qr_img.save(os.path.join(qr_folder, f"{ssid}.png")) + +def main(): + print("\n=== Wi-Fi Password Extractor ===\n") + + wifi_profiles = get_wifi_profiles() + if not wifi_profiles: + print("No Wi-Fi profiles found.") + return + + for profile in wifi_profiles: + password = get_wifi_password(profile) + if password: + print(f"SSID: {profile}\nPassword: {password}\n") + generate_qr_code(profile, password) + else: + print(f"SSID: {profile}\nPassword: Not Found or Open Network\n") + + print("\nQR codes saved in 'wifi_qr_codes' folder.\n") + +if __name__ == "__main__": + main()