Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f77d40e

Browse files
authored
Merge pull request metafy-social#349 from rahulkarda/master
Script to fetch all the wifi passwords
2 parents 88bb5de + e495af5 commit f77d40e

File tree

4 files changed

+75
-0
lines changed

4 files changed

+75
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Fetching System Information
2+
This is a simple script that fetches system information for your system.(Windows)
3+
4+
## Usage
5+
1. Clone the repo
6+
2. Run python script.py
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import wmi
2+
3+
c = wmi.WMI()
4+
my_system = c.Win32_ComputerSystem()[0]
5+
6+
print(f"Manufacturer: {my_system.Manufacturer}")
7+
print(f"Model: {my_system. Model}")
8+
print(f"Name: {my_system.Name}")
9+
print(f"NumberOfProcessors: {my_system.NumberOfProcessors}")
10+
print(f"SystemType: {my_system.SystemType}")
11+
print(f"SystemFamily: {my_system.SystemFamily}")
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Wifi Passwords
2+
This is a simple script that fetches all the saved passwords.
3+
4+
## Improvements
5+
Generating a QR code to easily connect mobile devices.
6+
7+
## Usage
8+
1. Clone the repo
9+
2. Run python script.py
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import subprocess
2+
import os
3+
import platform
4+
5+
pswd_txt = open(f"{os.getlogin()}-{platform.node()}", "w")
6+
7+
data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8', errors="backslashreplace").split(
8+
'\n')
9+
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
10+
11+
pswd_txt.write(f'{"{:<30}| {:<}".format("WIFI", "Password")} \n')
12+
pswd_txt.write(f'{"-" * 50} \n')
13+
14+
print("{:<30}| {:<}".format('WIFI', 'Password'))
15+
print("-" * 50)
16+
17+
for i in profiles:
18+
try:
19+
20+
results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 'key=clear']).decode('utf-8',
21+
errors="backslashreplace").split(
22+
'\n')
23+
results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
24+
25+
try:
26+
27+
pswd_txt.write(f'{"{:<30}| {:<}".format(i, results[0])} \n')
28+
pswd_txt.write(f'{"-" * 50} \n')
29+
30+
print("{:<30}| {:<}".format(i, results[0]))
31+
print("-" * 50)
32+
33+
34+
except IndexError:
35+
36+
pswd_txt.write(f'{"{:<30}| {:<}".format(i, "")} \n')
37+
pswd_txt.write(f'{"-" * 50} \n')
38+
print("{:<30}| {:<}".format(i, ""))
39+
print("-" * 50)
40+
41+
42+
except subprocess.CalledProcessError:
43+
44+
pswd_txt.write(f'{"{:<30}| {:<}".format(i, "ENCODING ERROR")} \n')
45+
pswd_txt.write(f'{"-" * 50} \n')
46+
print("{:<30}| {:<}".format(i, "ENCODING ERROR"))
47+
print("-" * 50)
48+
49+
pswd_txt.close()

0 commit comments

Comments
 (0)