by LinuxBender · 4y ago · 0 comments
Google:
for line in $(dig +short txt _cloud-netblocks.googleusercontent.com | tr " " "\n" | grep include | cut -f 2 -d :)
do
dig +short txt "${line}"
done | tr " " "\n" | grep ip4 | cut -f 2 -d : | sort -n | uniq | xz -9ecv > ./_GOOGLE.netset.xz
Amazon: curl --url "https://ip-ranges.amazonaws.com/ip-ranges.json" -o ./aws.json
grep ip_prefix ./aws.json | awk -F "\"" '{print $4}' | sort -n | uniq | xz -9ecv > ./_AWS.netset.xz
I don't have one for Azure handy at this time. Skip the xz compression step if you just want plain text. If some day they remove these services, you can also look up all the CIDR blocks using sites like this [1] Put in a name or IP to start with, then click on the AS number link, then click on prefixes v4 and prefixes v6.[1] - https://bgp.he.net/
No comments yet.