# download from apnic
rm -f delegated-apnic-latest
wget http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
# IPs allocated to china.
grep 'apnic|CN|ipv4|' delegated-apnic-latest | cut -f 4 -d'|' > delegated-apnic-CN
# get detail of echo IP from apnic database.
rm -f apnic_CN.txt
while read ip
do
# query apnic database
echo "query who is $ip"
whois -h whois.apnic.net $ip > tmp.txt
grep inetnum tmp.txt >> apnic_CN.txt # IP range
grep netname tmp.txt >> apnic_CN.txt # netname which include sp information
grep descr tmp.txt >> apnic_CN.txt # description which include province information
echo "" >> apnic_CN.txt
done delegated-apnic-CN
# clean up
rm -f tmp.txt
rm -f delegated-apnic-latest
rm -f delegated-apnic-CN
標簽:巴彥淖爾 淘寶邀評 邵陽 婁底 赤峰 金昌 許昌 馬鞍山
巨人網(wǎng)絡(luò)通訊聲明:本文標題《從apnic提取ip信息腳本分享》,本文關(guān)鍵詞 從,apnic,提取,信息,腳本,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。