Last active
June 9, 2023 07:02
-
-
Save ryanking13/92c6f66bcd3334508e2045f942627bf8 to your computer and use it in GitHub Desktop.
windows_wifi_password
This file contains hidden or 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
| #-*- 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