Posted by Sander ‘dsc’ Ferdinand under misc with tag(s) reconnaissance bash tools

Which ipv4 addresses belong to a given ASN? Use the following script:

for asn in AS51468 AS37061 AS198810 AS39513; 
    do $(for range in $(echo $(whois -h -- "-i origin $asn" | grep -Eo "([0-9.]+){4}/[0-9]+") | sed ':a;N;$!ba;s/\n/ /g'); 
        do prips $range >> ipv4.out; 
  • Requires: apt-get install prips
  • Results will be appended to ipv4.out
  • Github Gist