Flowtriq/flowtriq-migrate
GitHub: Flowtriq/flowtriq-migrate
一个零依赖的 Python 配置迁移工具,帮助用户在五分钟内将 FastNetMon、Wanguard 或 Corero SmartWall 的 DDoS 防护配置自动转换为 Flowtriq agent 配置。
Stars: 0 | Forks: 0
# flowtriq-migrate
**5 分钟内从 FastNetMon、Wanguard 或 Corero 迁移至 Flowtriq。**
`flowtriq-migrate` 会读取您现有的 DDoS 平台配置,并生成可直接使用的 [Flowtriq](https://flowtriq.com) agent 配置。所有的阈值、网络定义和采集方法——全部自动映射。
支持 **FastNetMon**(社区版和高级版)、**Andrisoft Wanguard** 以及 **Corero SmartWall**。
零依赖。支持 Python 3.8+。
## 快速开始
```
git clone https://github.com/flowtriq/flowtriq-migrate.git
cd flowtriq-migrate
# FastNetMon
python3 -m flowtriq_migrate /etc/fastnetmon.conf -o /etc/ftagent/config.json
# Wanguard(从 Console 导出 JSON)
python3 -m flowtriq_migrate wanguard-export.json --vendor wanguard
# Corero SmartWall(通过 REST API 导出)
python3 -m flowtriq_migrate corero-api-export.json --vendor corero
```
大功告成。安装 Flowtriq agent,粘贴您的 API key,即可上线运行。
## 迁移内容说明
### FastNetMon
| 设置 | Flowtriq 等效项 | 是否自动迁移? |
|---|---|---|
| `interfaces` | `interface` | 是 |
| `mirror` + `mirror_afpacket` | `mirror_mode` + `mirror_capture_mode` | 是 |
| `sflow` + `sflow_port` | `flow_enabled` + `flow_protocol` + `flow_port` | 是 |
| `netflow` + `netflow_port` | `flow_enabled` + `flow_protocol` + `flow_port` | 是 |
| `networks_list` | `mirror_subnets` | 是(镜像模式) |
| `ban_for_pps` / `threshold_pps` | `dynamic_threshold`(自适应基线) | 映射并附带指南 |
| `enable_ban` / `ban_time` | 自动缓解规则 | 仪表盘设置指南 |
| `notify_script_path` | 告警渠道(12+ 种选项) | 仪表盘设置指南 |
| `exabgp` / `gobgp` 配置 | BGP 适配器(FlowSpec/RTBH) | 仪表盘设置指南 |
### Wanguard (Andrisoft)
| 设置 | Flowtriq 等效项 | 是否自动迁移? |
|---|---|---|
| 传感器类型(NetFlow/sFlow/packet) | `flow_enabled` + `flow_protocol` | 是 |
| 传感器接口 + 端口 | `interface` + `flow_port` | 是 |
| PPS/Mbps 阈值 | `dynamic_threshold`(自适应基线) | 映射并附带指南 |
| 异常配置文件 | 每节点自适应基线 | 映射并附带指南 |
| 过滤器类型(FlowSpec/RTBH) | 自动缓解规则 | 仪表盘设置指南 |
| SNMP traps / email / 脚本 | 告警渠道(12+ 种选项) | 仪表盘设置指南 |
| BGP community + next-hop | BGP 适配器配置 | 仪表盘设置指南 |
| 网络 / 子网 | `mirror_subnets` 或 agent 模式 | 是 |
### Corero SmartWall
| 设置 | Flowtriq 等效项 | 是否自动迁移? |
|---|---|---|
| 接口 | `interface` | 是 |
| 防护配置文件 | 每节点自适应基线 | 映射并附带指南 |
| Smart-Rules(阈值) | `dynamic_threshold`(自适应基线) | 映射并附带指南 |
| 托管对象(前缀) | 每个子网的 agent 部署 | 映射并附带指南 |
| BGP RTBH / FlowSpec | BGP 适配器配置 | 仪表盘设置指南 |
| Syslog / SNMP / webhook 告警 | 告警渠道(12+ 种选项) | 仪表盘设置指南 |
| 部署模式(inline/OOB) | 每服务器 agent 模式 | 提供指南 |
## 功能对比
| 功能 | FastNetMon | Wanguard | Corero SmartWall | Flowtriq |
|---|---|---|---|---|
| 检测来源 | NetFlow/sFlow | NetFlow/sFlow/PF_RING | inline 硬件 | 内核级别的每包检测 |
| 检测延迟 | 30-60 秒 | 10-60 秒 | 亚秒级(inline) | 亚秒级 |
| L7 检测 | 否 | 否 | 有限 | 是(HTTP floods,DNS) |
| 攻击分类 | 仅协议 | 仅协议 | 基于规则 | 8+ 种攻击家族及置信度 |
| PCAP 取证 | 否 | 否 | 否 | 自动捕获攻击前数据 |
| 告警渠道 | 脚本 / 邮件 | 邮件 / SNMP / 脚本 | Syslog / SNMP / webhook | 支持 NOC 常用的告警工具(Slack、PagerDuty、Discord、短信等) |
| 仪表盘 | 无 / LiveView | Web 控制台 | CMS Web UI | 内置(不限用户数) |
| 每主机阈值 | 仅高级版 | 每传感器 | 每托管对象 | 每服务器自动基线 |
| BGP FlowSpec | 仅高级版 | 是 | 是 | 是 |
| XDP/eBPF 缓解 | 否 | 否 | 否 | 是 |
| 硬件要求 | 服务器 | 服务器 | 专用设备 | 无(在现有服务器上运行) |
| 定价 | 免费 / $115+/月 | $1,500+/年 | $10K+/设备 | $9.99/节点/月 |
## 安装
```
git clone https://github.com/flowtriq/flowtriq-migrate.git
cd flowtriq-migrate
```
零依赖。开箱即用,支持 Python 3.8+。
## 用法
### FastNetMon
```
python3 -m flowtriq_migrate /etc/fastnetmon.conf
python3 -m flowtriq_migrate /etc/fastnetmon.conf -o /etc/ftagent/config.json
python3 -m flowtriq_migrate fastnetmon-advanced.json # Advanced edition auto-detected
```
### Wanguard
从 Wanguard 控制台将您的设置导出为 JSON 文件(格式参见 `examples/wanguard-export.json`),然后执行:
```
python3 -m flowtriq_migrate wanguard-export.json --vendor wanguard
```
### Corero SmartWall
通过 CMS REST API 导出您的防护配置文件和托管对象(格式参见 `examples/corero-api-export.json`),然后执行:
```
python3 -m flowtriq_migrate corero-api-export.json --vendor corero
```
### 其他选项
```
# 预填充 Flowtriq 凭据
python3 -m flowtriq_migrate config.conf --api-key "your-key" --node-uuid "your-uuid"
# Dry run(预览而不写入文件)
python3 -m flowtriq_migrate config.conf --dry-run
# 手动指定网络文件
python3 -m flowtriq_migrate config.conf --networks-file ./my-networks.txt
```
该工具会根据配置格式自动检测平台。使用 `--vendor` 可覆盖自动检测。
## 输出示例
针对典型的 FastNetMon 社区版配置运行的结果:
```
============================================================
Flowtriq Migration Report
Source: /etc/fastnetmon.conf (Community Edition)
============================================================
+ MAPPED SETTINGS
Interface: eth0
Mirror/SPAN mode (AF_PACKET) on eth0
Monitored subnets: 10.0.0.0/24, 192.168.1.0/24
FastNetMon static thresholds: 20,000 PPS, 1,024 Mbps.
Flowtriq uses adaptive baselining instead.
! MANUAL STEPS REQUIRED
1. Get your API key and Node UUID from https://flowtriq.com/dashboard
2. Configure alert channels (replaces notify_about_attack.sh)
3. Configure auto-mitigation rules (replaces enable_ban)
4. Configure BGP mitigation in dashboard (replaces ExaBGP config)
* NEW IN FLOWTRIQ (not available in FastNetMon)
- Sub-second attack detection (vs 30-60s with flow sampling)
- L7 application-layer DDoS detection
- Per-packet PCAP forensics with automatic capture
- Adaptive baseline learning (no manual threshold tuning)
- Real-time dashboard with attack timelines
- Alerts wherever your NOC works
- XDP/eBPF kernel-level filtering
- Service port awareness
Config written to: ./config.json
Next: pip install ftagent && sudo ftagent --test
```
## 迁移后续步骤
1. 在您的服务器上**安装 ftagent**:
pip install ftagent
sudo ftagent --setup
2. **并行运行两者** 24-72 小时,直到 Flowtriq 基线成型
3. 在 [Flowtriq 仪表盘](https://flowtriq.com/dashboard)中**配置告警渠道**(Slack、Discord、PagerDuty、电子邮件、webhook 等)
4. 验证 Flowtriq 的检测功能后,**停用 FastNetMon**
完整迁移指南:[flowtriq.com/blog/migrate-from-fastnetmon-to-flowtriq](https://flowtriq.com/blog/migrate-from-fastnetmon-to-flowtriq)
## 常见问题
### 支持哪些平台?
FastNetMon(社区版 INI 配置和高级版 JSON 配置)、Andrisoft Wanguard(从控制台导出的 JSON)以及 Corero SmartWall(REST API 导出的 JSON)。该工具会自动检测格式,或者您也可以通过 `--vendor` 指定。
### 如何导出 Wanguard 配置?
Wanguard 将配置存储在其 Web 控制台数据库中。请创建一个包含您的传感器设置、阈值、网络、BGP 配置和告警渠道的 JSON 文件。具体格式请参见 `examples/wanguard-export.json`。
### 如何导出 Corero 配置?
查询 CMS REST API 端点(`/api/v1/protection-profiles/`、`/api/v1/managed-objects/`、`/api/v1/smart-rules/`),并将响应内容合并到一个 JSON 文件中。格式请参见 `examples/corero-api-export.json`。
### 我需要先停止当前的平台吗?
不需要。在 Flowtriq 学习您的流量基线期间(24-72 小时),请并行运行这两个系统。只有在您验证了 Flowtriq 的检测和告警功能后,才停用旧平台。
### 我现有的 BGP 黑洞设置怎么办?
您的 BGP 会话保持不变。Flowtriq 支持 ExaBGP、GoBGP、BIRD 2 和 FRRouting 作为 BGP 适配器。只需在 Flowtriq 仪表盘中配置 BGP 对等体,Flowtriq 就会通过相同的会话编排路由通告。
### Corero 是 inline 硬件设备。Flowtriq 如何替代它?
Flowtriq 会在您的服务器上部署轻量级 agent,而不是使用 inline 设备。检测在内核级别按数据包进行。缓解措施在本地使用 iptables/nftables/XDP,并辅以 BGP FlowSpec/RTBH 进行上游过滤。无需专用硬件。
### 此工具是开源的吗?
是的。采用 MIT 授权。您可以自由使用、修改并为其贡献代码。
## 许可证
MIT 许可证。详情请参阅 [LICENSE](LICENSE)。
由 [Flowtriq](https://flowtriq.com) 构建 —— 专为托管服务商、ISP 和游戏网络提供的实时 DDoS 检测与缓解服务。
标签:DDoS防护, FastNetMon, Python, 无后门, 运维工具, 逆向工具, 配置迁移