SniffCatDB/UFW-SniffCat-Reporter
GitHub: SniffCatDB/UFW-SniffCat-Reporter
一个基于 UFW 日志的实时监控上报工具,将被屏蔽 IP 自动提交至 SniffCat 数据库。
Stars: 1 | Forks: 0
# 🛡️ UFW SniffCat Reporter
[](https://github.com/SniffCatDB/UFW-SniffCat-Reporter)
[](https://www.gnu.org/licenses/gpl-3.0)
[](https://nodejs.org)
[](https://github.com/SniffCatDB/UFW-SniffCat-Reporter/commits)
[](https://github.com/SniffCatDB/UFW-SniffCat-Reporter/stargazers)
一个用于分析 UFW 日志并将被防火墙屏蔽的 IP 地址报告给 [SniffCat](https://sniffcat.com) 数据库的集成工具。
为了防止在短时间内对同一 IP 地址进行过多报告,该工具使用临时缓存文件来跟踪之前报告过的 IP 地址。
## 📋 需求
- [Node.js + npm](https://gist.github.com/sefinek/fb50041a5f456321d58104bbf3f6e649)
- [PM2](https://www.npmjs.com/package/pm2)(`npm i -g pm2`)
- [Git](https://gist.github.com/sefinek/1de50073ffbbae82fc901506304f0ada)
- Linux(Ubuntu 或 Debian)
## ✅ 功能
1. **易于配置** – 通过 [`config.js`](config.default.js) 文件即可快速简单配置。
2. **简单安装器** – 实现快速无缝的集成部署。
3. **自我保护 IP(IPv4 & IPv6)** – 即使使用动态 IP 地址,脚本也永远不会报告属于你自己或服务器的 IP。
4. **IP 过滤** – 本地地址和特殊用途地址永远不会被报告。
5. **IP 白名单** – 维护一个 `whitelist.txt` 文件,包含不应被报告的 IP(例如在 VPS 上运行时的家庭 IP)。该文件会被监控并在变更时自动重载。
6. **UDP 流量过滤** – UDP 流量会被自动跳过。
7. **报告冷却** – 防止在可配置的时间窗口内重复报告同一 IP。
8. **批量报告支持** – 如果脚本遇到速率限制,将开始缓冲收集的 IP 并发送批量报告。
9. **Discord Webhooks 集成**:
- 关键通知
- 脚本错误提醒
- 每日被报告 IP 的摘要
10. **自动更新** – 脚本会定期获取并应用最新更新。如需禁用此功能,可自行关闭。
## 📥 安装(Ubuntu & Debian)
### 自动安装(简单快速且推荐)
#### 通过 curl
```
bash <(curl -fsS https://raw.githubusercontent.com/SniffCatDB/UFW-SniffCat-Reporter/main/install.sh)
```
#### 通过 wget
```
bash <(wget -qO- https://raw.githubusercontent.com/SniffCatDB/UFW-SniffCat-Reporter/main/install.sh)
```
### 手动安装
#### Node.js 安装
请参考 https://gist.github.com/sefinek/fb50041a5f456321d58104bbf3f6e649。
#### Git 安装
请参考 https://gist.github.com/sefinek/1de50073ffbbae82fc901506304f0ada。
#### 命令
```
sudo apt update && sudo apt upgrade
cd ~
git clone --recurse-submodules https://github.com/SniffCatDB/UFW-SniffCat-Reporter.git ufw-sniffcat
cd ufw-sniffcat
npm install --omit=dev
cp config.default.js config.js
sudo chown syslog:"$USER" "$ufw_log_path"
sudo chmod 640 "$ufw_log_path"
npm install -g pm2@latest
sudo mkdir -p /var/log/ufw-sniffcat
sudo chown -R "$USER":"$USER" /var/log/ufw-sniffcat
pm2 start
eval "$(pm2 startup | grep sudo)"
pm2 save
```
## 🖥️ 使用
安装成功后,脚本将持续在后台运行,监控 UFW 日志并自动报告 IP 地址。
服务器会不断被机器人扫描,通常用于寻找安全漏洞和类似弱点。
因此,如果第二天发送到 SniffCat 的报告数量超过一千,也请不要惊讶。
### 🔍 查看日志
```
pm2 logs ufw-sniffcat
```
### 📄 示例报告
```
Blocked by UFW on homeserver1 [80/tcp]
Source port: 23639
TTL: 247
Packet length: 40
TOS: 0x00
This report was generated by:
https://github.com/SniffCatDB/UFW-SniffCat-Reporter
```
```
Blocked by UFW on homeserver1 [30049/tcp]. Generated by: https://github.com/SniffCatDB/UFW-SniffCat-Reporter
```
## 🤝 开发
如果你希望为该项目贡献开发,欢迎创建新的 [Pull 请求](https://github.com/SniffCatDB/UFW-SniffCat-Reporter/pulls)。我一定会非常感激!
## 🔑 [GPL-3.0 许可证](LICENSE)
版权 © 2025-2026 [Sefinek](https://sefinek.net)
标签:CMS安全, Debian, GNU通用公共许可证, GPLv3, IPv4, IPv6, IP报告, JavaScript, MITM代理, Node.js, PB级数据处理, PM2, PowerShell, Prompt Injection, Python 3.9+, SEO, SniffCat, UFW, 二进制发布, 动态IP, 安全运维, 实时日志分析, 开源工具, 本地IP过滤, 特殊用途IP过滤, 白名单, 简易安装, 缓存机制, 自IP保护, 防火墙监控