标签:
APNIC是管理亚太地区IP地址分配的机构,它有着丰富准确的IP地址分配库,同时这些信息也是对外公开的,并提供了一个查询工具,下面就让我们看看如何在Linux下获得一些中国基础电信运营商(网通、电信、铁通、教育网)的IP地址分配情况:
(我们平时用whois查询是知道域名或IP查信息, 这里用的是知道地理区域批量查IP及其信息)
APNIC ripe-dbase-client-v3.tar.gz
http://ftp.apnic.net/apnic/dbase/tools/ripe-dbase-client-v3.tar.gz
解压缩后,可以打开README文件
This is whois3, a very simple and generic whois client.This client, unlike the "classic" whois client,does not check for supported flags at the client side,except for -h (whois host) and -p (whois port).The syntax checks for flags are made at the server side.The default host and port of whois3 is whois.ripe.netat port 43 (or to be more exact, the tcp port specifiedfor whois in /etc/services). You can change the default hostby setting NICHOST in the source.To compile and install, just type:% ./configure [--prefix=your_prefix_dir]% make% make installType "configure --help" for generic help on how to use configure.This client has been compiled and tested on a variety of systems;please contact <ripe-dbm@ripe.net> for comments and bug reports.
./configuremakemake install
whois3 -h whois.apnic.net -l -i mb MAINT-CNCGROUP | grep "descr" | grep "Reverse" | awk -F "for" ‘{if ($2!="") print $2}‘| sort -n | awk ‘BEGIN{print "acl \"CNC\" ‘{‘"}{print $1";"}END{print "‘}‘;"}‘ > cnc_acl.conf
结果如下
% Information related to ‘202.111.151.80 - 202.111.151.87‘inetnum: 202.111.151.80 - 202.111.151.87netname: SMX-DEMOdescr: San men xia telecom bureaudescr: No.29 branch bureau for multimedia server demo,descr: San men xia city, Henan Provicedescr: 20020826country: CNadmin-c: LZ33-APtech-c: LZ33-APremarks: custmormnt-by: MAINT-CNCGROUPchanged: zhonglp@email.online.ha.cn 19990430status: ASSIGNED NON-PORTABLEsource: APNICperson: Liping Zhongaddress: Henan Multimedia Information Bureauaddress: 70, Nong Ye Roadaddress: ZhengZhou, Henan 450002address: CNcountry: CNphone: +86-371-3962276fax-no: +86-371-3962068e-mail: antispam@public.zz.ha.cnnic-hdl: LZ33-APmnt-by: MAINT-NULLchanged: zhail@email.online.ha.cn 20001124source: APNIC
标签:
原文地址:http://www.cnblogs.com/wishmo/p/854f1dde3317d706c097d46d65c2c98b.html