Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dd10f4e

Browse files
Merge pull request avinashkranjan#3 from geekymeeky/wifiPassword
Script to find saved wifi Password
2 parents ee04bd6 + 1e24895 commit dd10f4e

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

‎Save-Wifi-Password/ReadME.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# About
2+
3+
## Utility
4+
5+
* Find and write all your saved wifi passwords in a txt file
6+
7+
## How to use
8+
9+
* ### Run the script
10+
11+
Windows:
12+
13+
> py wifiPassword.py
14+
15+
Linux:
16+
17+
> python3 wifiPassword.py
18+
19+
* ### Select Path
20+
21+
Browse to the path where you want to store the passwords
22+
23+
* ### Generate
24+
25+
Click on Generate button to save the txt file in the specified location.
26+

‎Save-Wifi-Password/backend.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import os
2+
3+
4+
class Pass:
5+
def clearPassword(self):
6+
res = input('Clear Previous Passwords?')
7+
if res.lower() == 'y':
8+
with open("passwords.txt", "w") as fh:
9+
fh.close()
10+
11+
def genPassword(self):
12+
with os.popen('netsh wlan show profiles') as f:
13+
output = f.read()
14+
output = output.replace('\n', ' ')
15+
ssidList = output.split(':')
16+
ssidList = ssidList[2:]
17+
for i in range(0, len(ssidList)):
18+
ssidList[i] = ssidList[i].replace("All User Profile", '').strip()
19+
passwords = []
20+
for ssid in ssidList:
21+
with os.popen(f'netsh wlan show profiles "{ssid}" key=clear') as f:
22+
output = f.read()
23+
lines = output.split('\n')
24+
line = [element.split(':')
25+
for element in lines if "Key Content" in element]
26+
passwords.append(line[0][1].lstrip())
27+
with open('passwords.txt', 'w') as fh:
28+
for i in range(0, len(ssidList)):
29+
fh.writelines(f'{ssidList[i]} : {passwords[i]}\n')
30+
31+
def chdir(self, path):
32+
if path == "":
33+
path = os.getcwd()

‎Save-Wifi-Password/wifiPassword.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from tkinter import Label, Button, Tk
2+
from tkinter.filedialog import askdirectory
3+
from backend import Pass
4+
5+
6+
class Gui:
7+
def __init__(self):
8+
window = Tk()
9+
wifi = Pass()
10+
window.geometry("600x300")
11+
window.resizable(False, False)
12+
window.configure(bg='white')
13+
window.title('Save Wi-Fi Password')
14+
Label(window, text="Save Wi-Fi Password",
15+
font=("Helvetica", "25"), bg='white', fg='black').grid(row=0, padx=10, pady=3)
16+
Label(window, text="Find Saved Passwords:", fg='black',
17+
bg='white').grid(row=1, padx=10, pady=2, rowspan=2)
18+
Button(window, text="Generate", bg="green", fg="black", width=20, height=2,
19+
command=lambda: wifi.genPassword(), activebackground="#2e7541").grid(row=3, column=0, pady=10, columnspan=2)
20+
Button(window, text="Browse", bg="#e8e8e8", fg="black", height="2", width="20",
21+
command=lambda: wifi.chdir(askdirectory()), activebackground="#bababa").grid(row=3, column=1, pady=10, rowspan=2)
22+
23+
window.mainloop()
24+
25+
26+
start = Gui()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /