-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_password.py
30 lines (18 loc) · 878 Bytes
/
get_password.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Retreive local SSID and Password from Windows Machine
import subprocess, re
# Runs windows command to gather all profiles saved on machine
command_output = subprocess.run(["netsh","wlan","show","profiles"], capture_output=True).stdout.decode()
profile_names = (re.findall("All User Profile : (.*)\r", command_output))
wifi_list = list()
wifi_past_dict = dict()
if profile_names != 0:
for name in profile_names:
#print("netsh","wlan","show","profile",name,"key=clear")
second_command = subprocess.run(["netsh","wlan","show","profile",name,"key=clear"],capture_output=True).stdout.decode()
password = (re.findall("Key Content : (.*)\r",second_command))
if len(password) == 0:
pass
else:
wifi_past_dict[name] = password[0]
for x,y in wifi_past_dict.items():
print(x+":",y)