Skip to content

Commit 44086d6

Browse files
authored
Create get-wifi-passwords.py
1 parent 1ecf8dd commit 44086d6

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
This scripts fetches all saved wifi passwords in your Windows PC
3+
"""
4+
5+
import subprocess
6+
7+
8+
def get_all_profiles():
9+
try:
10+
data = subprocess.check_output(
11+
["netsh", "wlan", "show", "profiles", "key=clear"]
12+
).decode("utf-8", errors="backslashreplace")
13+
return data
14+
except FileNotFoundError:
15+
return "Only For Windows"
16+
17+
18+
def get_profiles_info(profile):
19+
try:
20+
data = subprocess.check_output(
21+
["netsh", "wlan", "show", "profiles", profile, "key=clear"]
22+
).decode("utf-8", errors="backslashreplace")
23+
24+
return data
25+
except subprocess.CalledProcessError:
26+
return "Profile Not Found"
27+
except FileNotFoundError:
28+
return "Only For Windows"
29+
30+
31+
if __name__ == "__main__":
32+
print(get_all_profiles())
33+
profile = input("Enter the profile Name: ")
34+
print(get_profiles_info(profile))

0 commit comments

Comments
 (0)