Add tools for ASNIP database

This commit is contained in:
Denys Fedoryshchenko
2023-08-18 20:02:12 +03:00
parent de020be72a
commit 3a64bfdfff
3 changed files with 115 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
# Retrieve the latest ASN database from github
# curl https://raw.githubusercontent.com/ipverse/asn-ip/master/as/1234/ipv4-aggregated.txt
# Set the path to the directory where the ASN database will be stored to script_dir
script_dir=$(dirname "$0")
cd $script_dir
curl https://raw.githubusercontent.com/ipverse/asn-info/master/as.csv > as-info.csv
if [ $? -eq 0 ]; then
echo "ASN-Info database updated successfully"
else
echo "ASN-Info database update failed"
fi
# https://iptoasn.com/
# https://iptoasn.com/data/ip2asn-v4.tsv.gz
curl https://iptoasn.com/data/ip2asn-v4.tsv.gz | gunzip > ip2asn-v4.tsv
if [ $? -eq 0 ]; then
echo "ASN database updated successfully"
else
echo "ASN database update failed"
fi
#range_start range_end AS_number country_code AS_description