Skip to content

Instantly share code, notes, and snippets.

@Bedrovelsen
Created June 6, 2022 16:40
Show Gist options
  • Select an option

  • Save Bedrovelsen/ccbcafb309c494646a7b059a2f201442 to your computer and use it in GitHub Desktop.

Select an option

Save Bedrovelsen/ccbcafb309c494646a7b059a2f201442 to your computer and use it in GitHub Desktop.
ASN2NRICH.sh
# Requires wget https://bgp.tools/table.txt && wget https://bgp.tools/asns.csv
echo "Looking for $1 in asns.csv" && grep -Ei "$1" asns.csv | sort --field-separator=S --key=2n | tee matches.txt && echo "search finished" && cat matches.txt | xargs -I {} echo "{}" | grep -Ei -o 'AS[0-9]+,' | sed 's#\(AS\|,\)##g' | xargs -I {} grep -Ei ' {}' table.txt | sort --key=2n | tee ntblks.txt | grep -Ei '\/2[0-4]' | grepaddr -cidr4 | mapcidr --silent > ips.txt && nrich -o json ips.txt | tee nrichedasn.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment