WiFi Password Cracker is a Python script that retrieves saved WiFi profiles and their passwords on a Windows machine. It uses the netsh
command to access and display this information. The script uses the 'netsh' command-line tool to retrieve and display saved WiFi profiles and their passwords on a Windows machine. It includes user interaction to ensure consent before proceeding with the password retrieval. The process_wifi function handles the main logic of extracting and displaying the WiFi names and passwords.
- Developer: Shabir Mahfudz Prahono - @shabir-mp
- Application creation date: 18 June 2024
- Retrieves all saved WiFi profiles on a Windows machine.
- Displays the WiFi name and its corresponding password.
- Windows Operating System
- Python 3.x
- Clone this repository or download the script directly.
git clone https://github.com/yourusername/wifi-password-cracker.git cd wifi-password-cracker
- Ensure you have Python installed on your machine. You can download it from python.org.
- Open a command prompt or terminal.
- Navigate to the directory where the script is located.
- Run the script using Python:
python main.py
- The script will prompt you to agree to the terms and conditions. Type Y to proceed.
- The script will display the WiFi names and their corresponding passwords.
import subprocess
- subprocess: This module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. It is used here to execute system commands.
The process_wifi
function retrieves and displays the names and passwords of all saved WiFi profiles on a Windows machine.
def process_wifi():
data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8').split('\n')
- Fetching WiFi Profiles:
subprocess.check_output(['netsh', 'wlan', 'show', 'profiles'])
: Executes thenetsh wlan show profiles
command, which lists all the WiFi profiles saved on the system..decode('utf-8')
: Converts the command output from bytes to a string..split('\n')
: Splits the output string into a list of lines.
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
- Extracting Profile Names:
- The list comprehension iterates through each line in
data
. if "All User Profile" in i
: Checks if the line contains "All User Profile", which indicates a WiFi profile.i.split(":")[1][1:-1]
: Splits the line at the colon, takes the second part (the profile name), and removes leading/trailing spaces and quotes.
- The list comprehension iterates through each line in
for i in profiles:
results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear']).decode('utf-8').split('\n')
- Fetching WiFi Passwords:
- The loop iterates over each profile name in
profiles
. subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear'])
: Executes thenetsh wlan show profile <profile_name> key=clear
command for each profile, which retrieves the details of the profile including the clear text key (password)..decode('utf-8').split('\n')
: Decodes and splits the output into lines.
- The loop iterates over each profile name in
results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
- Extracting Passwords:
- Another list comprehension filters lines that contain "Key Content", indicating the presence of the password.
b.split(":")[1][1:-1]
: Splits the line at the colon, takes the second part (the password), and removes leading/trailing spaces and quotes.
try:
print("{:<30} | {:<}".format(i, results[0]))
except IndexError:
print("{:<30} | {:<}".format(i, ""))
- Displaying Results:
print("{:<30} | {:<}".format(i, results[0]))
: Prints the profile name and password in a formatted manner.except IndexError
: If no password is found, catches the exception and prints the profile name with an empty password field.
The main part of the script handles user interaction and calls the process_wifi
function if the user agrees to the terms and conditions.
print("""
░░ ░░ ░░ ░░░░░░░ ░░ ░░░░░░ ░░░░░░ ░░░░░ ░░░░░░ ░░ ░░ ░░░░░░░ ░░░░░░
▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒ ▒▒
▒▒ ▒ ▒▒ ▒▒ ▒▒▒▒▒ ▒▒ ▒▒ ▒▒▒▒▒▒ ▒▒▒▒▒▒▒ ▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒
▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓ ▓▓
███ ███ ██ ██ ██ ██████ ██ ██ ██ ██ ██████ ██ ██ ███████ ██ ██
""")
- This prints a stylized ASCII art title.
print("Wifi Password Cracker")
print("Copyright 2024 - Shabir Mahfudz Prahono")
print()
terms = input("Agree Terms and Conditions ? (Y/n) ")
- Displays the program title and copyright notice.
- Prompts the user to agree to the terms and conditions.
if terms.lower() == 'y':
print("-"*70)
print("WiFi Name | WiFi Password")
process_wifi()
else:
print("Program End")
exit()
- If the user agrees (
terms.lower() == 'y'
), it prints a header line and calls theprocess_wifi
function. - If the user does not agree, it prints "Program End" and exits.
The script uses the netsh
command-line tool to retrieve and display saved WiFi profiles and their passwords on a Windows machine. It includes user interaction to ensure consent before proceeding with the password retrieval. The process_wifi
function handles the main logic of extracting and displaying the WiFi names and passwords.
This script is intended for educational purposes only. Unauthorized access to networks is illegal and unethical. Use this script responsibly and only on networks you own or have permission to access.
This project is licensed under the MIT License. See the LICENSE file for more details.