summaryrefslogtreecommitdiff
path: root/iplist/get_ips.sh
blob: d44b677b58b36c1690ae8abfe2a8a36bff18a05e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
wget -c http://ftp.apnic.net/stats/apnic/delegated-apnic-latest
cat delegated-apnic-latest | awk -F '|' '/CN/&&/ipv4/ {print $4 "/" 32-log($5)/log(2)}' | cat > ./cn_rules
cat ./own_world_rules > ./world_rules
cat delegated-apnic-latest | grep -v "CN" \
        | awk -F '|' '/ipv4/ {print $4 "/" 32-log($5)/log(2)}' | cat > tmp_world_rules

cat own_world_rules tmp_world_rules | cidr-merger --batch --cidr > ./world_rules
rm tmp_world_rules
rm delegated-apnic-latest

curl https://git.jettsang.com/mirrors/china_ip_list.git/plain/china_ip_list.txt -o cn_rules
cat cn_rules own_cn_rules | cidr-merger --batch --cidr >> ./all_cn_rules

curl https://gitlab.com/gfwlist/gfwlist/raw/master/gfwlist.txt | base64 -d > gfwlist.txt