Skip to content

Instantly share code, notes, and snippets.

@simplyvikram
Created June 6, 2016 20:01
Show Gist options
  • Save simplyvikram/8943a72a84a5e03d70429c183297e065 to your computer and use it in GitHub Desktop.
Save simplyvikram/8943a72a84a5e03d70429c183297e065 to your computer and use it in GitHub Desktop.
#!/bin/bash
# https://cloud.google.com/compute/docs/faq#ipranges
#nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`
do
dig txt $LINE +short
done | tr " " "\n" | grep ip4 | cut -f 2 -d : | sort -n | tr '\n' ',' | sed 's/,$//g'
# adapted from https://gist.github.com/n0531m/f3714f6ad6ef738a3b0a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment