Skip to content

Instantly share code, notes, and snippets.

View ricardocabral's full-sized avatar

Ricardo Niederberger Cabral ricardocabral

View GitHub Profile
@ricardocabral
ricardocabral / google_ips.sh
Created April 17, 2020 21:47
Prints all current Google Cloud public egress IPs
#!/bin/bash
# https://cloud.google.com/compute/docs/faq#find_ip_range
# nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
myarray=()
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`
do
myarray+=($LINE)
for LINE2 in `dig txt $LINE +short | tr " " "\n" | grep include | cut -f 2 -d :`