自動更新 翻牆 ip 列表

些脚本为自动从apnic.net数据中提取 中国 ipv4 并制作成可阅读列表

1
2
3
4
5
6
7
#!/bin/bash
curl http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest | \
grep 'CN' | \
grep 'ipv4' | \
sed 's/256/\/24/;s/512/\/23/;s/1024/\/22/;s/2048/\/21/;s/4096/\/20/;s/8192/\/19/;s/16384/\/18/;s/32768/\/17/;s/65536/\/16/;s/131072/\/15/;s/262144/\/14/;s/524288/\/13/;s/1048576/\/12/;s/2097152/\/11/;s/4194304/\/10/' | \
awk -F '|' '{print $4 $5}' > ${HOME}/ss-ip_cn.txt

执行完成后,china ip list文档会保存在 ${HOME}/ss-ip_cn.txt