- #!/bin/sh
- #filename cn_isp.sh;auto get the IP of CHINANET and CNC;
- rm delegated-apnic-latest
- rm cnnet
- rm IP_CHINANET
- rm IP_UNICOM
- rm IP_CNC
- fetch http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
- grep 'CN|ipv4' delegated-apnic-latest | cut -f 4,5 -d '|' | tr '|' ' ' >> cnnet
- cat cnnet | while read ip cnt
- do
- mask=$(bc < <END | tail -1
- pow=32;
- define log2(x) {
- if (x<=1) return (pow);
- pow--;
- return(log2(x/2));
- }
- log2($cnt);
- END
- )
» 阅读全文
