Parth6317/darkweb-alert-tool

GitHub: Parth6317/darkweb-alert-tool

一个基于Python的自动化暗网监控工具,用于检测个人数据泄露和威胁情报,并通过Telegram发送警报。

Stars: 0 | Forks: 0

# 🕵️ 暗网监测器 一个基于Python的自动化Tor网络监控与警报系统,用于网络安全研究和个人数据泄露监测。 ## 📌 功能特性 ## 📁 项目结构 ``` darkweb-alert-tool/ ├── main.py # Main orchestrator — runs the full monitoring pipeline ├── scraper.py # Tor scraper, HTML parser, keyword matcher ├── alerts.py # Telegram alert sender ├── db.py # SQLite database handler ├── config.py # All settings — Tor proxy, sites, keywords, Telegram ├── app.py # Flask web dashboard server ├── templates/ │ └── index.html # Dashboard UI ├── alerts.db # Auto-created SQLite database (gitignored) └── README.md ``` ## ⚙️ 安装说明 ### 1. 克隆仓库 ### 2. 安装依赖 ``` pip install requests beautifulsoup4 flask --break-system-packages ``` ### 3. 启动Tor ``` sudo service tor start sudo service tor status ``` ## 🔧 配置说明 运行前请编辑 `config.py`: ``` # Tor 代理(默认——无需更改) TOR_PROXY = "socks5h://127.0.0.1:9050" # 监控的网站 ONION_SITES = [ "http://example.com", # clearnet test # "http://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion", ] # 搜索的关键词 KEYWORDS = [ "yourname", "youremail@gmail.com", "yourcompany", "leak", "breach", ] # Telegram Bot 凭证 BOT_TOKEN = "YOUR_BOT_TOKEN_HERE" CHAT_ID = 123456789 ``` ### 获取Telegram凭证 1. 打开Telegram → 搜索 **@BotFather** → 输入 `/newbot` 2. 复制 **Bot Token** 3. 向你的机器人发送任意消息,然后访问: https://api.telegram.org/bot/getUpdates 4. 在 `"chat"` 对象中找到 `"id"` — 这就是你的 **Chat ID** ## 🚀 使用方法 ### 运行监测器 ``` python main.py ``` ### 运行仪表盘 ``` python app.py ``` 然后在浏览器中访问 **http://127.0.0.1:5000**。 ### 测试Telegram警报 ``` python test_telegram.py ``` ### 设置自动扫描计划(每6小时) ``` crontab -e # 添加此行: 0 */6 * * * cd ~/darkweb-alert-tool && python main.py ``` ## 📊 仪表盘预览 Flask仪表盘提供: - 📈 **4个统计卡片** — 总警报数、监测站点数、独立关键词数、最热门关键词 - 📋 **警报日志表格** — 站点URL、匹配关键词、时间戳 - 🟢 **实时状态指示器** 与实时时钟 ## 🔄 工作原理 ``` Start → init_db() → Loop through ONION_SITES ↓ fetch_onion(url) ←— Tor SOCKS5 proxy ↓ extract_text(html) ←— BeautifulSoup parser ↓ find_keywords(text, KEYWORDS) ←— case-insensitive match ↓ Keywords found? YES → send_alert() + save_alert() (Telegram 🚨 + SQLite) NO → send_alert() clean scan notice (Telegram ✅ + continue) ``` ## 🧪 测试记录 | 阶段 | 目标 | 结果 | |-------|--------|--------| | 阶段1 | `http://example.com` | ✅ 检测到关键词 `example` | | 阶段2 | DuckDuckGo `.onion` 站点 | ✅ 通过Tor成功获取,扫描无异常 | | 阶段3 | Telegram Bot | ✅ 警报实时送达 | | 阶段4 | Flask 仪表盘 | ✅ 警报日志与统计数据正常显示 | ## ⚠️ 法律免责声明 本工具严格用于**学术研究、安全研究和经授权的网络安全用途**。 在**未经网站或网络所有者明确书面授权**的情况下,对任何网站或网络部署此工具属于违法行为,违反以下法律: - 《2000年信息技术法》(印度) - 《计算机欺诈和滥用法》— CFAA(美国) - 《计算机滥用法》— CMA(英国) 开发者对滥用行为**不承担任何责任**。 ## 👨‍💻 作者 **Patel Parth Mukeshbhai** 工学学士 — 计算机科学与工程(网络安全方向) Karnavati大学 Unitedworld理工学院 学号:202407020489 | KU ID:KU2407U644 **指导教师:** Animesh Aggrawal 博士 ## 📚 参考资料 - [Tor 项目文档](https://www.torproject.org/docs/) - [BeautifulSoup4 文档](https://www.crummy.com/software/BeautifulSoup/bs4/doc/) - [Telegram Bot API](https://core.telegram.org/bots/api) - [Flask 文档](https://flask.palletsprojects.com/) - [MITRE ATT&CK 框架](https://attack.mitre.org/)
标签:Atomic Red Team, Flask框架, Python, Splunk, SQLite数据库, Telegram机器人, Tor网络, Web仪表板, 个人数据保护, 关键字匹配, 内核监控, 后端开发, 威胁情报, 开发者工具, 数据泄露检测, 无后门, 暗网爬虫, 暗网监控, 网络安全, 自动化监控, 警报系统, 逆向工具, 道德监控, 隐私保护