4 ms·
With the help of a couple of prefix aggregation tools [1] [2], the BASH shell, and the RIPE database, it is straightforward to block any Autonomous System with,
by iam-TJ 10y ago
With the help of a couple of prefix aggregation tools [1] [2], the BASH shell, and the RIPE database, it is straightforward to block any Autonomous System with, e.g:
$ ASN=32934; for IP in 4 6; do \
whois -h riswhois.ripe.net \!${IP/4/g}as${ASN} |\
sed -n '2 p' | tr \ \\n | aggregate${IP/4/} |\
while read NET; do echo ip${IP/4/}tables -I OUTPUT -d ${NET} -j REJECT;\
done; done
(note this command uses echo to show the command it could execute)
[1] aggregate http://packages.ubuntu.com/source/xenial/aggregate http://packages.ubuntu.com/source/xenial/aggregate
[2] aggregate6 https://github.com/job/aggregate6 https://github.com/job/aggregate6