Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to find wifi password using python

nasty boy
Comment

python program to find wifi password

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#..................python program to find the wifi passwords.....!
import subprocess
 
# now we will store the profiles data in "data" variable by 
# running the 1st cmd command using subprocess.check_output
data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-8').split('
')
# now we will store the profile by converting them to list
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
 
# using for loop in python we are checking and printing the wifi 
# passwords if they are available using the 2nd cmd command
for i in profiles:
    # running the 2nd cmd command to check passwords
    results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i, 
                        'key=clear']).decode('utf-8').split('
')
    # storing passwords after converting them to list
    results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
    # printing the profiles(wifi name) with their passwords using 
    # try and except method 
    try:
        print ("{:<30}|  {:<}".format(i, results[0]))
    except IndexError:
        print ("{:<30}|  {:<}".format(i, ""))
Comment

python wifi password display

import subprocess
import re

print('WIFI PASSWORD')
command_output = subprocess.run(["netsh", "wlan", "show", "profiles"], capture_output = True).stdout.decode()
profile_names = (re.findall("All User Profile     : (.*)
", command_output))
wifi_list = []

if len(profile_names) != 0:
    for name in profile_names:
        wifi_profile = {}
        profile_info = subprocess.run(["netsh", "wlan", "show", "profile", name], capture_output = True).stdout.decode()

        if re.search("Security key           : Absent", profile_info):
            continue
            
        else:
            wifi_profile["ssid"] = name
            profile_info_pass = subprocess.run(["netsh", "wlan", "show", "profile", name, "key=clear"], capture_output = True).stdout.decode()
            password = re.search("Key Content            : (.*)
", profile_info_pass)

            if password == None:
                wifi_profile["password"] = None
                
            else:
                wifi_profile["password"] = password[1]
                
            wifi_list.append(wifi_profile)

for x in range(len(wifi_list)):
    print(wifi_list[x])
Comment

PREVIOUS NEXT
Code Example
Python :: matplotlib insert text 
Python :: python color text on windows 
Python :: extract first letter of column python 
Python :: dropdown in tkinter 
Python :: os get current directory 
Python :: install aws sdk ubuntu 20.04 command line 
Python :: get all the keys in a dictionary python 
Python :: python append in specific position 
Python :: python: transform as type numeirc 
Python :: tkinter max size 
Python :: update anaconda 
Python :: using bs4 to obtain html element by id 
Python :: python discord webhook 
Python :: python create nested directory 
Python :: set os environment variable python 
Python :: columns to dictionary pandas 
Python :: python add titles to subplots 
Python :: get length of csv file with python 
Python :: age in days to age in years 
Python :: base64 decode python 
Python :: easiest way to position labels in tkinter 
Python :: plt.clear 
Python :: web3py to wei 
Python :: google colab matplotlib not showing 
Python :: install postgres for python mac 
Python :: import excel file to python 
Python :: convert dictionary keys to int python 
Python :: matplotlib x axis at the top 
Python :: string array to float array python 
Python :: pandas dataframe show one row 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =