mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
Python script to view wifi password. (#163)
* Added wifi.py * Delete main.py * Create wifi_password.py * Create requirements.txt * Create README.md * Rename wifi_password.py to main.py * Update README.md * Update README.md Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>
This commit is contained in:
parent
c19ba9da50
commit
3f90a01a5e
|
@ -150,6 +150,7 @@ So far, the following projects have been integrated to this repo:
|
|||
|[YTS Torrents](yts_torrents)|[Mayank Nader](https://github.com/makkoncept)|
|
||||
|[COVID visualiser (real-time) ](covdi_visualiser)|[Tushar Gupta](https://github.com/tushar5526)|
|
||||
|[Random_Email_Generator](Random_Email_Generator)|[Shubham Garg](https://github.com/shub-garg)|
|
||||
|[WiFi Password Viewer](Wifi-Password)|[Sagar Patel](https://github.com/sagar627)|
|
||||
|[Tambola_Ticket_Generator](Tambola_Ticket_Generator)|[Amandeep_Singh](https://github.com/Synster)|
|
||||
| [Py_Cleaner](Py_Cleaner) | [Abhishek Dobliyal](https://github.com/Abhishek-Dobliyal)
|
||||
|[Send messages to sqs in parallel](send_sqs_messages_in_parallel)|[Jinam Shah](https://github.com/jinamshah)|
|
||||
|
|
3
Wifi-Password/README.md
Normal file
3
Wifi-Password/README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
**A Simple python Script to view saved password on your system.**
|
||||
|
||||
This script works on both Windows and Linux.
|
30
Wifi-Password/main.py
Normal file
30
Wifi-Password/main.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import subprocess
|
||||
systemInfo=''
|
||||
try:
|
||||
systemInfo = subprocess.check_output(['uname']).decode('utf-8', errors="backslashreplace").split('\n')
|
||||
systemInfo = systemInfo[0]
|
||||
except :
|
||||
pass
|
||||
if systemInfo == "Linux":
|
||||
wifiData = subprocess.check_output(['ls', '/etc/NetworkManager/system-connections']).decode('utf-8', errors="backslashreplace").split('\n')
|
||||
print ("Wifiname Password")
|
||||
print ("----------------------------------------")
|
||||
|
||||
for wifiname in wifiData:
|
||||
if wifiname != '':
|
||||
wifiPass = subprocess.check_output(['sudo','cat', f"/etc/NetworkManager/system-connections/{wifiname}"]).decode('utf-8', errors="backslashreplace").split('\n')
|
||||
password=wifiPass[15].strip("psk=");
|
||||
print ("{:<30} {:<}".format(wifiname, password))
|
||||
else:
|
||||
wifi = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8', errors="backslashreplace").split('\n')
|
||||
profiles = [i.split(":")[1][1:-1] for i in wifi if "All User Profile" in i]
|
||||
for i in profiles:
|
||||
try:
|
||||
results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear']).decode('utf-8', errors="backslashreplace").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 :
|
||||
print ("{:<30}| {:<}".format(i, ""))
|
||||
except :
|
||||
print ("{:<30}| {:<}".format(i, "ENCODING ERROR"))
|
1
Wifi-Password/requirements.txt
Normal file
1
Wifi-Password/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
subprocess
|
Loading…
Reference in New Issue
Block a user