Milind027/wifi-attack-detector

GitHub: Milind027/wifi-attack-detector

基于 Scapy 和 PyQt5 的 Linux 无线安全平台,实时嗅探并检测多种 Wi-Fi 攻击,提供可视化仪表盘、多渠道告警与报告导出功能。

Stars: 1 | Forks: 1

# 🛡️ Wi-Fi 攻击检测器 一个基于 Linux 的网络安全工具,使用 Scapy 和 PyQt5 实时检测 WiFi Deauthentication(取消认证)攻击。 ## 功能特性 - **实时检测** — Deauth 泛洪、Evil Twin AP、PMKID 收集、Probe/Beacon 泛洪 - **多渠道告警** — Email (Gmail)、Telegram、ntfy.sh、Twilio SMS - **现代 GUI** — 仪表盘、可搜索日志、网络地图、数据分析、深色/浅色主题 - **系统托盘** — 最小化到托盘以进行后台监控 - **导出** — CSV 和带样式的 PDF 攻击报告 - **MAC 供应商查询** — 根据 MAC 地址识别设备制造商 - **威胁标记** — 右键点击以标记可疑 MAC(持久化存储于数据库) - **加密存储** — 使用 Fernet 加密密码和令牌 - **Google Drive 备份** — 自动上传日志到云端 ## 系统要求 - **Linux** 且配备支持 **监听模式 (monitor mode)** 的 WiFi 适配器 - **Python 3.8+** - **Root 权限**(监听模式和数据包嗅探所需) - `aircrack-ng` 套件 ## 安装说明 ### 1. 克隆仓库 ``` git clone https://github.com/Milind027/wifi-attack-detector.git cd wifi-attack-detector ``` ### 2. 安装系统依赖 ``` sudo ./install.sh ``` ### 3. 安装 Python 依赖 ``` pip install -r requirements.txt ``` ### 4. 配置密钥 ``` cp .env.example .env ``` 使用您的凭证编辑 `.env`: ``` # Gmail SMTP SENDER_EMAIL=your_email@gmail.com SENDER_PASSWORD=your_gmail_app_password # Telegram Bot (from @BotFather) TELEGRAM_BOT_TOKEN=your_bot_token TELEGRAM_CHAT_ID=your_chat_id # ntfy.sh NTFY_TOPIC=https://ntfy.sh/your-unique-topic # Twilio SMS TWILIO_ACCOUNT_SID=your_account_sid TWILIO_AUTH_TOKEN=your_auth_token TWILIO_FROM_NUMBER=+1234567890 TWILIO_TO_NUMBER=+0987654321 ``` ### 5. (可选)Google Drive 备份 1. 前往 [Google Cloud Console](https://console.cloud.google.com/) 2. 创建项目 → 启用 **Google Drive API** 3. 创建 **OAuth 2.0 Client ID** (桌面应用) 4. 下载 JSON 并将其保存为项目根目录下的 `credentials.json` ### 6. 运行 ``` sudo python main.py ``` ## 使用指南 1. **登录/注册** — 首次运行时创建账户 2. **开始监控** — 点击按钮开始数据包捕获 3. **仪表盘** — 查看实时攻击统计和近期日志 4. **日志** — 搜索、按类型/严重程度过滤、导出为 CSV 或 PDF 5. **网络地图** — 查看附近的 AP,包含供应商、信号、加密信息 6. **数据分析** — 顶级攻击者、攻击类型分布、按小时分布 7. **设置** — 调整阈值、配置邮件、切换告警渠道 告警渠道可以在 **Settings → Alert Channels** 中实时启用/禁用 — 无需重启。 ## 项目结构 ``` ├── main.py # Entry point ├── gui.py # PyQt5 GUI (dashboard, logs, network map, analytics, settings) ├── wifi_detector.py # Detection engine (Scapy sniffer) ├── database.py # SQLite database (attacks, users, threat flags) ├── config.py # Config loader (.env + YAML) ├── config.yaml # Non-sensitive settings (thresholds, interface) ├── mail.py # Email notifier ├── telegram_notifier.py # Telegram notifier ├── ntfy_notifier.py # ntfy.sh notifier ├── twilio_notifier.py # Twilio SMS notifier ├── oui_lookup.py # MAC vendor OUI database ├── auth.py # Login/registration ├── drive_uploader.py # Google Drive backup ├── .env.example # Secrets template ├── .gitignore # Excludes .env, credentials, DB, logs ├── requirements.txt # Python dependencies └── install.sh # System dependency installer ``` ## 测试 ``` python -m unittest test_threshold test_evil_twin -v ``` ``` Ran 16 tests in 0.003s OK ``` ## 安全说明 - 所有密钥存储在 `.env` 中(git-ignored)并通过 `python-dotenv` 加载 - 用户密码使用 `bcrypt` 进行哈希处理 - 邮件密码和 Drive 令牌使用 `Fernet` 加密 - `.env`、`credentials.json`、`encryption.key` 和 `*.db` 均已被 Git 排除 ## 许可证 MIT
标签:802.11 攻击, Aircrack-ng 套件, Deauth 攻击, DNS 反向解析, Evil Twin 检测, Fernet 加密, Linux 网络工具, MAC 地址查询, masscan, PMKID 攻击, PyQt5, Scapy, WIDS, Wi-Fi 安全, 信标洪泛, 去认证攻击检测, 图形化界面, 多渠道告警, 威胁情报平台, 安全报告生成, 无线网络入侵检测, 无线防御, 监控模式, 网络安全仪表盘, 逆向工具, 防御绕过