Find wifi password-A python project for practice with explanation
You visit your friend's house and he/she makes your device connected to their wifi area. Now you want to explore the unknown password that your friend connected your device to their wifi router. In that condition, your friend does not want to share the password of their wifi network. What will you do? Just put the below code in your python shell or interpreter. It will show it. Not only that password but also all wifi passwords that your device connected to before. You can make it larger to find other things. isn't it a cool project for beginners in the ethical hacking area?
Python code for "Find wifi password-A python project for practice"
import subprocess as sp
wifi_data = (
sp.check_output(["netsh", "wlan", "show", "profiles"])
.decode("utf-8")
.split("\n")
)
wifi_profile = [i.split(":")[1][1:-1] for i in wifi_data if "All User Profile" in i]
for i in wifi_profile:
wifi_final_profile = (
sp
.check_output(["netsh", "wlan", "show", "profile", i, "key=clear"])
.decode("utf-8")
.split("\n")
)
wifi_final_profile = [p.split(":")[1][1:-1] for p in wifi_final_profile if "Key Content" in p]
try:
print("Wifi name: {:<30}| Password: {:<}".format(i, wifi_final_profile[0]))
except IndexError:
print("Wifi name: {:<30}| Password: Never connected but got signal for your device{:<}".format(i, ""))
Output sample: (Output can be varied in different devices)
Wifi name: Device name | Password: 354353
Wifi name: Wifi111 | Password: 5656E4e44
Wifi name: wifi4... | Password: AFDSFEDFd
Wifi name: AndroidAP | Password: 123456789
Wifi name: wifi5.... | Password: 3453534gfsDFG
Wifi name: wifi6 | Password: HELLO55
Wifi name: Guest WiFi | Password: 409804
Wifi name: 3rd dept east side | Password: 1233334
Wifi name: ???????? | Password: 3453534gfsDFG
Wifi name: SKKD WIFI | Password: 456456
Wifi name: 2Nd dept east side | Password: sdfgsdre4tr
Wifi name: Wifi not | Password: sdfds555
Wifi name: 11111wifi | Password: 45afsdfaad3
Wifi name: East_University_WiFi | Password: Not connected
Wifi name: A-Link_DIR-876 | Password: Not connected
Wifi name: VodafoneConnect29651356 2 | Password: Not connected
Wifi name: VodafoneConnect29758356 | Password: yyyyxzzzzzzzza
Wifi name: FIVE Network 5.4 | Password: Bidfornone!
Understand the "Find wifi password-A Cool python project for beginners"
Now, you have to understand the program properly. Here we use the subprocess package of the python language.
What is the subprocess in python?
The subprocess is a package or module in python language that is run an explicit program in an operating system being a part of a larger process. The subprocess is actually used to make a new application for creating a new process in a system for a particular purpose.
Why did we use the subprocess package and how does it work?
You are thinking that the subprocess's purpose is to make a program to create a new process, that's all, then how it is finding the saving password in my device. Actually, we make the subprocess work as an output process and check the valid output result for the user. When we run the code of the above python program. The subprocess creates a process to work with large processes and find the output. The large programs are wifi cached data processes.
What are netsh, wlan, show, and profiles on the above program?
The netsh, wlan, show, and profiles are one type of networking command in windows. The program will correctly work with windows.
netsh -> Network shell
wlan -> wireless local area network (Router is one type of wlan)
Now, what is utf-8?
utf-8 is a width character encoding variable in terms of 'network system'. By '8', it means the transformation is 8-bit.