Created
May 9, 2017 11:08
-
-
Save kinshasha/6bce746d7273264bdcb8d7adf78cb017 to your computer and use it in GitHub Desktop.
GCP Netblock lookup tool for ipv4 and ipv6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://cloud.google.com/compute/docs/faq#ipranges | |
for LINE in `nslookup -q=txt _cloud-netblocks.googleusercontent.com 8.8.8.8 | tr " " "\n" | grep include | cut -f 2 -d :` | |
do | |
nslookup -type=txt $LINE | |
done | tr " " "\n" | grep ip4 | cut -f 2 -d : | sort -n | |
#add v6 handling | |
nslookup -q=TXT _cloud-netblocks5.googleusercontent.com 8.8.8.8 | tr " " "\n" | grep ip6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment