The Asia Pacific Network information is recorded here, updated every day.
Http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
The following script will edit this text, output several major network segments of the domestic operators.
Copy Code code as follows:
#!/bin/sh
#auto Get the IP Table
#get the newest Delegated-apnic-latest
RM delegated-apnic-latest
If Type wget
Then wget http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
else Fetch Http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
Fi
grep ' apnic| Cn|ipv4 ' Delegated-apnic-latest | Cut-f 4,5-d ' | ' | Tr ' | ' ' ' | While read IP cnt
Todo
mask=$ (BC <<end | tail-1
pow=32;
Define LOG2 (x) {
if (x<=1) return (POW);
pow--;
Return (log2 (X/2));
}
LOG2 ($CNT);
End
)
echo $ip/$mask '; >>cnnet
resultext= ' whois $ip @whois.apnic.net | Grep-e ^netname-e ^descr-e ^role-e ^mnt-by | Cut-f 2-d ': ' | Sed ' s/*//'
If echo $resultext | Grep-i-E ' railcom '-e ' CRTC '-e ' railway '
then echo $ip/$mask '; ' >> CRC
elif echo $resultext | Grep-i-E ' cncgroup '-e ' netcom '
then echo $ip/$mask '; ' >> CNC
elif echo $resultext | Grep-i-E ' chinanet '-e ' Chinatel '
then echo $ip/$mask '; ' >> telcom_acl
elif echo $resultext | Grep-i-E ' unicom '
then echo $ip/$mask '; ' >> unicom
elif echo $resultext | Grep-i-E ' cmnet '
then echo $ip/$mask '; ' >> cmnet
Else
echo $ip/$mask '; ' >> other_acl
Fi
Done