佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > Shell腳本獲取國內(nèi)各大運營商網(wǎng)段腳本分享

Shell腳本獲取國內(nèi)各大運營商網(wǎng)段腳本分享

熱門標(biāo)簽:呼叫中心市場需求 服務(wù)外包 AI電銷 網(wǎng)站排名優(yōu)化 地方門戶網(wǎng)站 Linux服務(wù)器 百度競價排名 鐵路電話系統(tǒng)

亞太地區(qū)網(wǎng)絡(luò)信息記錄在這里,每天都有更新。

http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest

下面這個腳本將對這段文本進行編輯,輸出國內(nèi)幾大運營商網(wǎng)段。

復(fù)制代碼 代碼如下:

#!/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
do
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

標(biāo)簽:銅川 湖南 仙桃 衡水 崇左 蘭州 黃山 湘潭

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Shell腳本獲取國內(nèi)各大運營商網(wǎng)段腳本分享》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    遂溪县| 昌邑市| 巴林左旗| 三亚市| 潮安县| 米易县| 天峨县| 资源县| 万源市| 石首市| 长治县| 犍为县| 瑞安市| 年辖:市辖区| 教育| 成武县| 林口县| 九寨沟县| 嘉荫县| 泰州市| 镇平县| 揭阳市| 永城市| 中牟县| 黔江区| 西充县| 兴文县| 舞钢市| 泸州市| 阳朔县| 深泽县| 江安县| 龙口市| 芮城县| 巴塘县| 浏阳市| 台南市| 封丘县| 平凉市| 长春市| 孝感市|