Created
June 6, 2022 16:40
-
-
Save Bedrovelsen/ccbcafb309c494646a7b059a2f201442 to your computer and use it in GitHub Desktop.
ASN2NRICH.sh
This file contains hidden or 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
| # 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