Wi-Fi manager

Author: o995Created Mar 4, 2026Updated May 27, 2026

import tkinter as tk import subprocess

def list_profiles(): cmd = ["netsh", "wlan", "show", "profiles"] result = subprocess.run(cmd, capture_output=True, text=True) networks = [line.split(":")[1].strip() for line in result.stdout.splitlines() if "All User Profile" in line] return networks

def refresh_list(): profiles.delete(0, tk.END) for net in list_profiles(): profiles.insert(tk.END, net)

def connect_wifi(): selected = profiles.curselection() if selected: ssid = profiles.get(selected[0]) # Check if network is secured cmd = f"netsh wlan show profile name={ssid}" result = subprocess.run(cmd, capture_output=True, text=True) if "Security key : Absent" not in result.stdout: # Prompt for password password = password_entry.get() if password: cmd = f"netsh wlan connect name={ssid} key={password}" subprocess.run(cmd, shell=True) status_label.config(text=f"Connecting to {ssid}...") else: status_label.config(text="Enter password") else: cmd = f"netsh wlan connect name={ssid}" subprocess.run(cmd, shell=True) status_label.config(text=f"Connecting to {ssid}...") else: status_label.config(text="Select a network")

def delete_wifi(): selected = profiles.curselection() if selected: ssid = profiles.get(selected[0]) cmd = f"netsh wlan delete profile name={ssid}" subprocess.run(cmd, shell=True) status_label.config(text=f"Deleted {ssid}") refresh_list() else: status_label.config(text="Select a network")

root = tk.Tk() root.title("Wi-Fi Manager")

profiles = tk.Listbox(root) profiles.pack(pady=10) refresh_list()

tk.Label(root, text="Password:").pack() password_entry = tk.Entry(root, show="*") password_entry.pack()

btn_frame = tk.Frame(root) btn_frame.pack() tk.Button(btn_frame, text="Refresh", command=refresh_list).pack(side=tk.LEFT) tk.Button(btn_frame, text="Connect", command=connect_wifi).pack(side=tk.LEFT) tk.Button(btn_frame, text="Delete", command=delete_wifi).pack(side=tk.LEFT)

status_label = tk.Label(root, text="") status_label.pack()

root.mainloop()