How to use Python to check wifi password
Today, I will talk to you about how to use Python to check the wifi password, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Often encounter such a situation: guests come to the house and ask you for your wifi password.
Awkwardly, you forgot your wifi password.
But your other devices are already connected to WiFi, so how do you use these devices to get your WiFi password back?
One way is to log on to the router administration page, but if you forget your router password, it will be very embarrassing.
Another way is through the iCloud keychain, but this method is very troublesome and needs to be obtained through backup.
Today, I will tell you the easiest way to find your current wifi password through Python.
1. Prepare for
Before you begin, you need to make sure that Python has been successfully installed on your computer, if not, please visit this article: hyperdetailed Python installation Guide for installation.
If you use Python for data analysis, you can directly install Anaconda:Python data analysis and mining helper-Anaconda
In addition, you need a computer that is already connected to Wifi, both macOS and windows.
two。 Principle analysis
In essence, the way to get a password is to use commands, such as obtaining a WiFi password under Windows:
Netsh wlan show profile name=Wifi name key=clear | key content of findstr
Obtain the WiFi password under macOS:
Sudo security find-generic-password-l wifi name-D'AirPort network password'-w
Obtain the WiFi password under Linux:
Sudo cat / etc/NetworkManager/system-connections/wifi name | grep psk=
Through these three commands, you can get the WiFi name that is currently in use.
3. Code writing
First, encapsulate the command:
, where fetch_result is used to execute commands to obtain data:
Decode_result is used to decode commands:
When you're done, all you have to do is:
Print (fetch_password ('system type', 'wifi name')
You can get the password.
If your computer is connected to other wifi and has not deleted the relevant network configuration, you can actually use this function to get the password of other wifi. The above is the complete source code.
After reading the above, do you have any further understanding of how to use Python to check the wifi password? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.