Skip to content

Instantly share code, notes, and snippets.

@jeffmccune
Forked from n0531m/list_gcp_iprange.sh
Last active July 30, 2021 08:28
Show Gist options
  • Select an option

  • Save jeffmccune/e7d635116f25bc7e12b2a19efbafcdf8 to your computer and use it in GitHub Desktop.

Select an option

Save jeffmccune/e7d635116f25bc7e12b2a19efbafcdf8 to your computer and use it in GitHub Desktop.
Google Cloud Platform : ip address range
#! /bin/bash
#
# Return the subnets used by Google Services
#
# There are a growing number of netblocks, 2,3,4,5,6,7, etc...
# Dig them all until an empty string is returned.
txt="$(dig TXT _netblocks.google.com +short @8.8.8.8)"
idx=2
while [[ -n "${txt}" ]]; do
echo "$txt" | tr '[:space:]+' "\n" | grep : | cut -d: -f2-
txt="$(dig TXT _netblocks${idx}.google.com +short @8.8.8.8)"
((idx++))
done
@jeffmccune
Copy link
Author

@pedro14ha not that I'm aware of

@lord-alfred
Copy link

I've made a Github repo with an daily updates Google Cloud, Amazon AWS and Microsoft Azure IP Ranges:
https://github.com/lord-alfred/ipranges

Thanks to all of you

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