Hacking into someone's WIFI network is illegal and I am not showing you how to do so. But the answer to the question is Yes, you can hack WIFI password using Python.
Here in This Blog I will show you how to extract passwords of all the saved networks in your System.
This can be done within few lines of code. We just have to execute two cmd Command using python and iterate it through for loop
Note : This is for educational purposes, don't misuse it. I have tried it on my own computer so be aware and don't try it without prior knowledge of Cyber Laws
Code :
import subprocess
data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8').split('\n')
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
for i in profiles:
results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear']).decode('utf-8').split('\n')
results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
try:
print("{:<30}| {:<}".format(i, results[0]))
except IndexError:
print("{:<30}| {:<}".format(i, ""))
Output :
Explanation :
cmd commands here to perform operations are
1. netsh wlan show profiles
This shows SSID of all the networks which were connected to your System
2. netsh wlan show profile 'PROFILE NAME' key = clear
this command will show the password of WIFI network by removing it's Security Key
subprocess module is used to run cmd command using python. Execute command 1 and store all values in a list. Now you have all the available SSID, we have to clear the Key and extract the passwords by using command 2 and store the values in a list
Use Exceptional Handler try-except to print the outputs. If the Key Content is not available for the network, program will through index error while printing the output. To handle this error try-except block is necessary to use.
0 Comments
Ask Your Queries in the comments