-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWiFi Network Scanner.py
More file actions
31 lines (25 loc) · 904 Bytes
/
WiFi Network Scanner.py
File metadata and controls
31 lines (25 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import tkinter as tk
from tkinter import ttk
import subprocess
def scan_wifi():
try:
wifi_scan_result.delete('1.0', 'end') # Clear the previous results
result = subprocess.check_output(['iwlist', 'wlan0', 'scan'])
print(result)
wifi_scan_result.insert('end', result.decode('utf-8'))
except Exception as e:
wifi_scan_result.insert('end', f"Error: {str(e)}")
# Create the main window
root = tk.Tk()
root.title("WiFi Network Scanner")
# Create a label
label = ttk.Label(root, text="Available WiFi Networks:")
label.pack(pady=10)
# Create a text widget to display the scan results
wifi_scan_result = tk.Text(root, wrap=tk.WORD, width=90, height=40)
wifi_scan_result.pack()
# Create a button to initiate the scan
scan_button = ttk.Button(root, text="Scan WiFi Networks", command=scan_wifi)
scan_button.pack(pady=10)
# Start the main loop
root.mainloop()