Skip to content

Instantly share code, notes, and snippets.

@jayswan
Created July 26, 2016 13:27
Show Gist options
  • Save jayswan/6bbd0511584a1957f481ed9dae6ab61f to your computer and use it in GitHub Desktop.
Save jayswan/6bbd0511584a1957f481ed9dae6ab61f to your computer and use it in GitHub Desktop.
Scripts to retrieve CIDR blocks for various services
# Fastly
curl -s https://api.fastly.com/public-ip-list | jq -r '.addresses | .[]'
# Google
dig @8.8.8.8 +short txt _netblocks.google.com | awk '{gsub("ip4:","");for (col=2; col<NF;++col) print $col}'
# AWS
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | \
jq --raw-output '.prefixes | map(.ip_prefix) | .[]'
# Tor
curl -s https://check.torproject.org/exit-addresses \
| awk '/ExitAddress/ {print $2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment