GET SAVED WIFI PASSWORDS USING PYTHON

GET SAVED WIFI PASSWORDS USING PYTHON


Source Code:-   

 
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Get Saved wifi passwords using Python
 
import subprocess
 
data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8',
                                                errors="backslashreplace").split('\n')
 
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
 
for i in profiles:
 
    try:
        results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i,
                    'key=clear']).decode('utf-8', errors="backslashreplace").split('\n')
         
        results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
 
        try:
            print ("{:<30}|  {:<}".format(i, results[0]))
         
        except IndexError:
            print ("{:<30}|  {:<}".format(i, ""))
 
    except subprocess.CalledProcessError:
        print ("{:<30}|  {:<}".format(i, "ENCODING ERROR"))
 
input("")
 
 
# Get Saved wifi passwords using Python

import subprocess

data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8',
                                                errors="backslashreplace").split('\n')

profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]

for i in profiles:

    try:
        results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i,
                    'key=clear']).decode('utf-8', errors="backslashreplace").split('\n')
        
        results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]

        try:
            print ("{:<30}|  {:<}".format(i, results[0]))
        
        except IndexError:
            print ("{:<30}|  {:<}".format(i, ""))

    except subprocess.CalledProcessError:
        print ("{:<30}|  {:<}".format(i, "ENCODING ERROR"))

input("")


Follow me on Instagram:- Python_with_Shubham


0 Comments