onelove2

Paste ID: 57079259

Created at: 2025-05-16 16:46:19

onelove
from _pybgpstream import BGPStream, BGPRecord, BGPElement

stream = BGPStream()
stream.add_filter('record-type', 'updates')
stream.add_filter('prefix', '0.0.0.0/0')
stream.add_interval_filter(1670000000, 1670001000)  # example time

for rec in stream.records():
    for elem in rec:
        if "/32" in elem.fields['prefix']:  # highly specific
            print(f"Potential blackhole route: {elem.fields['prefix']} via {elem.fields['next-hop']}")

Share this Paste