User Tools

Site Tools


Sidebar


Tags Cloud
google_ip_range

Получение диапазона IP адресов

Prerequisites

apt-get install jq netmask moreutils
wget -P ~/tmp https://gist.githubusercontent.com/kyxap1/5233d86a9649f142e0c894598d4d60b0/raw/b369cf61cea3f20cce96244c33e55a6da0c92b89/aggregate-cidr-addresses.pl
chmod +x ~/tmp/aggregate-cidr-addresses.pl

Google

dig +short TXT _spf.google.com \
  | grep -oP "(?<=include:).+?\s" \
  | xargs dig +short TXT \
  | grep -oP "(?<=ip4:).+?\s" \
  | xargs netmask -s \
  | perl -pne 's#(.+)/(.+)#route \1 \2 vpn_gateway#'

Amazon

wget https://ip-ranges.amazonaws.com/ip-ranges.json -O - \
  | jq -r ".prefixes[].ip_prefix" \
  | ./tmp/aggregate-cidr-addresses.pl \
  | sort -V

Github

wget -O - https://api.github.com/meta \
  | jq -r ".hooks, .web, .api, .git, .pages, .importer | .[]" \
  | ./tmp/aggregate-cidr-addresses.pl \
  | sort -V
google_ip_range.txt · Last modified: 2020/05/25 23:14 by kyxap