How To Get Saved WIFI Password Using Python Script | CVFD

How To Get Saved WIFI Password Using Python Script it is made by Coding Vlogs YouTube Channel. you can download the source code or copy the source code and use it for free. if you have not subscribed to our youtube channel so subscribe now we are creating a beautiful coding project and providing source code for free. To Download Source Code Scroll Down 

Warning!
Use the below methods only for educational/testing purposes on your own device or with the permission of the owner. Don’t use this for malicious purposes.

How It Works?

Usually while connecting with the wifi we have to enter some password to access the network, but we are not directly able to see the password we entered earlier i.e password of the saved network. In this article, we will see how we can get all the saved WiFi names and passwords using Python, in order to do this we will use the subprocess module of python.

Note!
This method only works with windows computer.

Python

import subprocess
import re

command_output = subprocess.run(["netsh", "wlan", "show", "profiles"], capture_output = True).stdout.decode()
profile_names = (re.findall("All User Profile     : (.*)\r", 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            : (.*)\r", 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]) 

# (c) Coding Vlogs. All Rights Reserved
C:\User>cd your_directory
C:\User\your_directory>python password.py

OR

C:\User\your_directory>python3 password.py

Output

{'SSID': 'Your Wifi', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 2', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 3', 'Password': '--Your Password !--'}
{'SSID': "Your Wifi 4', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 5', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 6', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 7', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 8', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 9', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 10', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 11', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 12', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 13', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 14', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 15', 'Password': '--Your Password !--'}
{'SSID': 'Your Wifi 16', 'Password': '--Your Password !--'}

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.