WIFI PASSWORD CHECKER APP using Tkinter Python
In previous articles, we learned to create some GUI applications using the Tkinter module in python. With used other modules too with Tkinter to add more functionality to the application. Through this article, we are going to use ‘Tkinter’, ‘pyperclip’, and ‘subprocess’ to create a WIFI password checker app.
If you want to know more about ‘Tkinter’ and ‘subprocess’ then I would suggest you read my previous articles. In those articles, I have covered all important concepts related to both these modules. In this article, we are using one more python module “pyperclip”.
The topics that we will cover through this article are:
About Modules:
Tkinter: Tkinter is a standard python library. Python with a tkinter module is the fastest and easiest way to develop an object-oriented GUI application. It provides us a variety of common GUI(graphical user interface) elements that we can use to build our user interface like buttons, menus, and various kinds of entry fields and display areas.
Subprocess: This helps to check the connected wifi password easily by allowing us to run command prompt commands inside the program. This module is supported in both 2.x and 3.x. this is used to run the new programs and applications through python code by creating new processes. It can be used to get the input/output/errors and exit codes. If we want to execute different programs then we can use the functions of the subprocess.
Pyperclip: This module is used to copying and pasting the content on the clipboard in python. It takes data of any type and converts it into a “string” type. It can send and receive text using functions. It works with both python (2.x & 3.x). It has two types of functions:
1. copy() 2. paste()
Here, we are using this to copy the extracted content from the label to the clipboard.
Project Explanation:
This is the program where you can see the previously connected wifi passwords just by clicking the buttons, and also you can copy them to the clipboard as well.
Step1: Install all libraries either through command prompt or your IDE’s terminal by simply writing.
pip install tkinter
pip install subprocess
pip install pyperclip
step2: Create a python file as GUIwifi.py
step3: Start Coding:
#importing tkinter module
from tkinter import *
#importing pyperclip to copy the extracted password to the clipboard
import pyperclip
#creating tkinter window
root = Tk()
#providing geometry to tkinter window
root.geometry("450x450")
#setting the background colour of the tkinter window
root['background']='#856ff8'
#Providing title to tkinter window
root.title("MY WIFI PASSWORD CHECKER APPLICATION")
#creating an object of type StringVar(): it will accept String text only
pass_details = StringVar()
#creating an empty list
myList = []
# it is the function to define the see_wifi_pass
def see_wifi_pass():
#importing subprocess module: helps to create new processes.
import subprocess
#defining myList as a global variable
global myList
#this will get the output like netsh,wlan,show,profiles and then decode it in 'utf-
#8' format,removes the backspaces and store the final output into 'data'
data = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles']).decode('utf-
8').split('\n')
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
for i in profiles:
results = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i,
'key=clear']).decode('utf-8').split('\n')
results = [b.split(":")[1][1:-1] for b in results if "Key Content" in b]
try:
myList.append(i)
myList.append("--")
myList.append(results[0])
myList.append("|")
except IndexError:
myList.append(i)
myList.append("--")
myList.append("")
#Defining function "show_wifi_pass"
def show_wifi_pass():
pass_details.set(myList)
#defining function "copytoclipboard
def copytoclipboard():
#stores the obtained password using get() i.e pass_details into password.
password = pass_details.get()
pyperclip.copy(password)
#creating label and packing it using pack() method
Label(root, text="WIFI PASSWORD CHECKER APPLICATION", font="Lucida 15 bold").pack()
#Creating button for "Initiate the process"
Button(root, text="Initiate the process",bg='blue' , command=see_wifi_pass).pack(pady=10)
#Creating button for "Show all WIFI details"
Button(root, text="Show all WIFI details",bg='blue' , command=show_wifi_pass).pack(pady=10)
Entry(root, textvariable=pass_details, width=50).pack(pady=10)
#Creating button for ""COPY to CLIPBOARD"
button = Button(root, text="COPY to
CLIPBOARD",bg='blue',command=copytoclipboard).pack(pady=10)
#running the main application
root.mainloop()
Output:
1. GUI APPLICATION:
2. Initiated the Process:
3. Show ALL :
4. Copied Data:
Hope you like this article, If you stuck somewhere while writing the code then feel free to comment. For more projects and python tutorials, check out my previous articles. In upcoming articles, we will create more Interesting python projects. So stay tuned, does sharing, and keep on learning.
Regards, Happy Learning😊