Which ipv4 addresses belong to a given ASN? Use the following script:
#!/bin/bash
for asn in AS51468 AS37061 AS198810 AS39513;
do $(for range in $(echo $(whois -h whois.radb.net -- "-i origin $asn" | grep -Eo "([0-9.]+){4}/[0-9]+") | sed ':a;N;$!ba;s/\n/ /g');
do prips $range >> ipv4.out;
done);
done
- Requires:
apt-get install prips
- Results will be appended to
ipv4.out
- Github Gist