Skip to content

Instantly share code, notes, and snippets.

@pdfcrowd
Last active February 24, 2020 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdfcrowd/2d0f45f5d8c0dbd0469180d3f88e1410 to your computer and use it in GitHub Desktop.
Save pdfcrowd/2d0f45f5d8c0dbd0469180d3f88e1410 to your computer and use it in GitHub Desktop.
Output Google Cloud IP ranges
#!/bin/bash
dig @8.8.8.8 +short txt _cloud-netblocks.googleusercontent.com | \
sed 's/"//g; s/ip4://g; s/ip6://g;' | \
tr ' ' '\n' | \
grep include | cut -d ':' -f2 | \
xargs dig @8.8.8.8 +short txt | \
sed 's/"//g; s/ip4://g; s/ip6://g;' | tr ' ' '\n' | grep '/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment