Created
July 15, 2018 02:41
-
-
Save q8f13/6e9cca4c924f3e78b18fbc7da56ea6e5 to your computer and use it in GitHub Desktop.
get wifi information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
a = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8').split('\n') | |
a = [i.split(":")[1][1:-1] for i in a if "All User Profile" in i] | |
for i in a: | |
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, "")) | |
a = input("") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment