Rebantaa/Network-Security-Honeypot
GitHub: Rebantaa/Network-Security-Honeypot
一个模拟电商网站的诱饵型蜜罐系统,用于吸引、检测和分析恶意机器人流量,为安全团队提供威胁情报和自动化告警。
Stars: 0 | Forks: 0
🛡️ NetSentry
网页爬虫蜜罐与恶意机器人检测系统
一个诱饵型电子商务蜜罐,用于模拟真实的在线商店来吸引、识别和分析恶意机器人流量——为安全团队提供可操作的威胁情报和自动化告警。
## 📌 目录 - [问题陈述](#-problem-statement) - [工作原理](#-how-it-works) - [项目结构](#-project-structure) - [快速开始](#-getting-started) - [使用方法](#-usage) - [许可证](#-license) ## 🧩 问题陈述 现代电子商务平台面临无休止的自动化威胁——凭证填充、价格爬取、库存囤积以及侦察机器人探测漏洞。传统的 WAF 和速率限制器往往是被动响应的,且依赖于签名特征。 **NetSentry** 采用攻防结合的方法:部署一个令人信服的虚假店面作为诱饵。任何与隐藏端点交互或表现出非人类行为的实体都会被实时标记、记录和分析。 ## 🔄 工作原理 ``` Attacker / Bot NetSentry Honeypot │ │ │──── HTTP Request ────────────▶│ │ ├─── Log IP, UA, Headers, Timestamp │ ├─── Check against rate-limit rules │ ├─── Evaluate CAPTCHA interaction │ ├─── Detect hidden trap endpoint access │ │ │ ├─── 🚨 Suspicious? ──▶ Flag + Email Alert │ ├─── 📦 Store in DB (interactions, bot_flags) │◀── Fake Product Page ─────────┤ │ │ Scapy / Wireshark (Packet-level analysis) ``` ## 📂 项目结构 ``` Network-Security-Honeypot/ ├── app.py # Main Flask application and route definitions ├── main.py # Application entry point ├── db.py # Database initialization and query helpers ├── countermeasures.py # Rate limiting, IP blacklisting, bot mitigation ├── analyze_logs.py # Log analysis and bot-flagging logic ├── simulate_bot.py # Selenium/requests-based bot simulation scripts ├── basic_bot.py # Lightweight bot simulator for quick testing ├── honeypot.db # SQLite database (auto-generated at runtime) ├── Animation - 1741553560744.json # Lottie animation asset for the frontend ├── LICENSE # MIT License ├── README.md │ ├── static/ # Static assets served by Flask │ ├── css/ # Stylesheets (Bootstrap overrides, custom styles) │ └── images/ # Product images and site assets │ ├── templates/ # Jinja2 HTML templates │ ├── index.html # Homepage with product listings │ ├── product.html # Individual product detail page │ ├── signup.html # Signup page with CAPTCHA │ ├── login.html # Login page with CAPTCHA │ └── cart.html # Shopping cart page │ └── venv/ # Python virtual environment (not tracked in prod) ``` ## ⚡ 快速开始 ### 前置条件 - Python 3.10 或更高版本 - pip 包管理器 - MySQL(可选——默认使用 SQLite) - Wireshark(可选——用于数据包级分析) ### 安装 **1. 克隆仓库** ``` git clone https://github.com/Rebantaa/Network-Security-Honeypot.git cd Network-Security-Honeypot ``` **2. 创建并激活虚拟环境** ``` python3 -m venv venv # macOS / Linux source venv/bin/activate # Windows venv\Scripts\activate ``` **3. 安装依赖** ``` pip install -r requirements.txt ``` **4. 设置环境变量并启动** ``` export FLASK_APP=app.py export FLASK_ENV=development export SECRET_KEY="your_secret_key" # SMTP 设置用于邮件提醒 export SMTP_USER="you@gmail.com" export SMTP_PASS="app_password" flask run ``` 蜜罐将在 `http://127.0.0.1:5000/` 上线 ## 🎯 使用方法 ### 运行蜜罐 ``` flask run ``` 访问 `http://127.0.0.1:5000/` 查看虚假店面。 ### 模拟机器人流量 ``` # 基本的轻量级机器人模拟 python basic_bot.py # 使用 Selenium + requests 的完整爬虫模拟 python simulate_bot.py ``` ### 监控日志 直接在数据库中检查捕获的交互: ``` -- View all logged requests SELECT * FROM interactions ORDER BY timestamp DESC LIMIT 50; -- View flagged bot sessions SELECT * FROM bot_flags WHERE severity = 'HIGH'; ``` ### 分析捕获的数据 ``` # 运行日志分析器标记可疑会话 python analyze_logs.py ``` ### 网络级分析 ``` # 使用 Scapy 在 Flask 端口捕获数据包 sudo python utils/packet_monitor.py --port 5000 # 或在 Wireshark 中打开实时捕获 wireshark -i lo -f "tcp port 5000" ``` ### 邮件告警 当检测到高风险模式(快速请求、陷阱端点访问、缺失头部)时,告警会被发送到配置的 SMTP 收件人。 ## 📄 许可证 本项目基于 **MIT 许可证** 发布。详情请参阅 [LICENSE](LICENSE) 文件。
为安全研究和教育而构建。
NetSentry —— 诱捕。检测。防御。
标签:Bot检测, BurpSuite集成, CAPTCHA, CISA项目, Flask, Honeypot, IP 地址批量处理, MIT许可, Python, Syscall, Web安全, Web开发, Wildcard支持, 反爬虫, 威胁情报, 开发者工具, 恶意爬虫检测, 无后门, 电商安全, 网络安全, 自动化威胁防护, 蓝队分析, 蜜罐, 证书利用, 逆向工具, 配置错误, 隐私保护