Created
October 18, 2023 09:18
-
-
Save suvl/db3f87852ae3b3eb16a647ebcfb7234d to your computer and use it in GitHub Desktop.
Find AS2860 IP addresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o pipefail | |
set -o nounset | |
set -o errexit | |
set -o errtrace | |
set -o functrace | |
set -o xtrace | |
set -o verbose | |
# get all IPs for the AS2860 | |
ips=$(whois -h whois.radb.net -- '-i origin AS2860' | grep --extended-regexp '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/[0-9]+' --only-matching) | |
# return all these IPs in a json array | |
echo $ips | jq --raw-input --slurp --raw-output 'split("\n") | map(select(. != "")) | split(" ") | map(select(. != "")) | map({ip: .})' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment