Skip to content
/ honeypot Public

一个基于 FastAPI 的蜜罐(Honeypot)系统,用于模拟服务接口并记录攻击行为,容器化部署。

License

Notifications You must be signed in to change notification settings

qqAys/honeypot

Repository files navigation

HoneyPot

HoneyPot 是一个基于 FastAPI 构建的蜜罐系统,用于记录和分析潜在攻击行为。通过模拟登录与注册接口,捕获恶意请求并将其存储在数据库中以供后续分析。

📦 功能特性

  • 模拟登录和注册页面。
  • 记录访问者的 IP 地址、User-Agent 和提交的数据。
  • 异步数据处理,用户无感知。
  • 长度攻击防范,避免塞爆数据库。

🔧 安装与部署

  1. 克隆仓库

    git clone https://github.com/qqAys/honeypot.git
    cd honeypot
  2. 配置数据库

    mv .env.example .env
    vim .env
  3. 构建并启动

    docker compose up -d

🪜 用户真实 IP 获取

ip = request.headers.get("X-Real-IP", request.client.host)

如果您将 HoneyPot 部署在中间件(如 Nginx、Caddy 等)之后。此时,需要确保中间件转发请求时添加 X-Real-IP 请求头,以便 HoneyPot 能够正确获取用户的真实 IP 地址。

Caddyfile

honeypot.qqays.xyz {
    reverse_proxy 127.0.0.1:8200 {
        header_up X-Real-IP {http.request.remote.host}
    }
}

🚧 503 Service Unavailable

qqAys/HoneyPot 被设计成无业务后端,任何操作都会异步处理主动返回 503 Service Unavailable ,是最简单蜜罐系统。

⚠️ 注意事项

  • 本项目为蜜罐系统,请勿用于非法用途。
  • 建议部署于内网或测试环境中。
  • 如需增强安全性,建议添加 HTTPS 支持。

👮 免责声明

参见 disclaimer.md

🪪 许可证

This project is licensed under the MIT License.

About

一个基于 FastAPI 的蜜罐(Honeypot)系统,用于模拟服务接口并记录攻击行为,容器化部署。

Topics

Resources

License

Stars

Watchers

Forks