本示例演示如何使用 tabi 模块来检测从 BGP 收集器看到的所有可能的 BGP 劫持。
警告: 在尝试此示例之前,请确保你的计算机上至少有 2GB 的可用内存
安装步骤已在主 README 中说明。
python detect_hijacks.py -c rrc01 -i mabo \
--rpki-roa-file roa.csv \
--irr-ro-file routes.csv \
--irr-mnt-file maintainers.csv \
--irr-org-file organisations.csv \
../../{bview,updates}.*.gz
此示例脚本会打印由 tabi 模块检测到的异常事件。此外,它还会尝试使用以下方法过滤掉那些极可能合法的冲突:
AS_PATH 包含被劫持者的 ASN这些启发式方法在 tabi.annotate 模块中有文档说明。
在此示例中,由 AS55441 发起、更新 2403:8600:ea89::/48 路由的公告,可能导致原本定向到 AS131317 的流量发生重定向。这很可疑,因为原路由存在有效的路由对象和 ROA,但最新的路由更新却没有。
{
"timestamp" : 1451609472,
"collector" : "rrc01",
"peer_ip" : "2001:7f8:4::7992:1",
"peer_as" : 31122,
"announce" : {
"prefix" : "2403:8600:ea89::/48",
"asn" : 55441,
"as_path" : "31122 6939 6453 4755 45820 55441",
"type" : "U"
},
"conflict_with" : {
"prefix" : "2403:8600:ea89::/48",
"asn" : 131317,
"valid" : [
"apnic",
"roa"
]
},
"type" : "ABNORMAL"
}
U,若来自 BGP 全表视图则为 Fprefix 与 asn 这一组合的路由对象或 ROA在此示例中,由 AS5570 发起、撤销路由 23.192.176.0/20 的公告,可能导致流量重定向至 AS35889,后者正公告一条指向更不具体前缀 23.192.0.0/11 的路由。
{
"timestamp" : 1451609643,
"collector" : "rrc01",
"peer_ip" : "195.66.224.138",
"peer_as" : 2914,
"withdraw" : {
"asn" : 55740,
"prefix" : "23.192.176.0/20",
"type" : "W"
},
"conflict_with" : {
"prefix" : "23.192.0.0/11",
"asn" : 35994
},
"type" : "ABNORMAL"
}