Skip to content

Instantly share code, notes, and snippets.

@sanderfoobar
Last active October 11, 2023 16:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sanderfoobar/6d98bcad533855b1b81b7fdd4e04930e to your computer and use it in GitHub Desktop.
Save sanderfoobar/6d98bcad533855b1b81b7fdd4e04930e to your computer and use it in GitHub Desktop.
Convert ASN to IPv4 list
#!/bin/bash
# one-liner to convert ASN to ip addresses. Results will be appended to `ips.out`. sander@cedsys.nl | 1-7-2017
# requires: apt-get install prips
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 >> ips.out;
done);
done
@WaterLord7788
Copy link

This is such a great tool! Thank you for developing this.
I'll include you as contributor in my newest GitHub project.
Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment