Instantly share code, notes, and snippets.

Embed
What would you like to do?
Will find each network profile on a windows machine and print the profile and password
import subprocess
a = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8', errors="ignore").split('\n')
a = [i.split(":")[1][1:-1] for i in a if "All User Profile" in i]
for i in a:
try:
results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear']).decode('utf-8', errors="ignore").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, ""))
except subprocess.CalledProcessError:
print ("{:<30}| {:<}".format(i, "ENCODING ERROR"))
a = input("")
@halljames631

This comment has been minimized.

halljames631 commented Sep 23, 2017

great program

@ZanoDev

This comment has been minimized.

ZanoDev commented Feb 22, 2018

line 6 gives me the error:
"UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 361: invalid start byte"

@1sahitya

This comment has been minimized.

1sahitya commented Apr 18, 2018

wow amazing

@jonasermert

This comment has been minimized.

jonasermert commented Apr 20, 2018

great program

@brentvollebregt

This comment has been minimized.

Owner

brentvollebregt commented Apr 26, 2018

@ZanoDev sorry for the late reply, didn't realise people actually visited this.
Looks like there are characters in one of your profiles that utf-8 can't decode. This could also be caused by languages to different characters than English. This will be an issue when you print out at the end as they will not be able to print to the console. Execute "netsh wlan show profiles" and you will be able to see the non-utf-8 character.
You could try using 'cp1252' instead of 'utf-8' decoding (has worked for others)

@letzcode97

This comment has been minimized.

letzcode97 commented Oct 17, 2018

Hi guys,
I also added a function to upload the the wifi passwords and network names to dropbox and also created a dialog box to make the process less suspicious if an sudo or adminstator runs the program and creating an initial delay in time. I did it on ubuntu(debian) environment.
link:https://github.com/letzcode97/wifi_grabber_linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment