iptogeo/data/get_prefixs.sh
2016-01-31 11:42:28 +01:00

20 lines
479 B
Bash
Executable File

#!/bin/bash
PROVIDERS="afrinic arin apnic lacnic ripencc"
DEST=prefix_res_ipv4
SHA1_FILE=prefix_res_ipv4.sha1
for provider in $PROVIDERS; do
wget "ftp://ftp.ripe.net/pub/stats/${provider}/delegated-${provider}-extended-latest" -O $provider
done
cat $PROVIDERS | grep -v asn | grep -v summary | grep -v '#' | grep ipv4 | sort -n -k 4 -t '|' > $DEST
sha1sum -c $SHA1_FILE && exit
sha1sum $DEST > $SHA1_FILE
echo "Rebuild ip_data.c"
./build_c_array.py > ../src/ip_data.c