Get IP range by AS number
-
Found useful site for this https://hackertarget.com/as-ip-lookup/
You can simply add IPv4 feed:
https://api.hackertarget.com/aslookup/?q=AS15169But is more better to have native ability in pfBlockerNG, and get ip ranges from radb.net
like this script:
whois -h whois.radb.net -- '-i origin AS15169' | grep -Eo "([0-9.]+){4}/[0-9]+" -
@viktor_g your script only does IPv4
IPv4:-
whois -h whois.radb.net -- '-i origin ASS15169' | grep ^route: | awk '{print $2}'
IPv6:-
whois -h whois.radb.net -- '-i origin AS15169' | grep ^route6: | awk '{print $2}
-
pfBlockerNG-devel already has ASN support in the IP State setting. Also Radb registry isn't very accurate. The package is using bppview.io instead.
https://api.bgpview.io/ip/<IP>
Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.