Linux Whois3获取 运营商信息
APNIC是管理亚太地区IP地址分配的机构,它有着丰富准确的IP地址分配库,同时这些信息也是对外公开的,并提供了一个查询工具,下面就让我们看看如何在Linux下获得一些中国基础电信运营商(网通、电信、铁通、教育网)的IP地址分配情况:
(我们平时用whois查询是知道域名或IP查信息, 这里用的是知道地理区域批量查IP及其信息)
获取安装包
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.net
at port 43 (or to be more exact, the tcp port specified
for whois in /etc/services). You can change the default host
by setting NICHOST in the source.
To compile and install, just type:
% ./configure [--prefix=your_prefix_dir]
% make
% make install
Type "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.
执行编译安装命令 (本机已有 Cygwin64环境 )
./configure
make
make 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.87
netname: SMX-DEMO
descr: San men xia telecom bureau
descr: No.29 branch bureau for multimedia server demo,
descr: San men xia city, Henan Provice
descr: 20020826
country: CN
admin-c: LZ33-AP
tech-c: LZ33-AP
remarks: custmor
mnt-by: MAINT-CNCGROUP
changed: zhonglp@email.online.ha.cn 19990430
status: ASSIGNED NON-PORTABLE
source: APNIC
person: Liping Zhong
address: Henan Multimedia Information Bureau
address: 70, Nong Ye Road
address: ZhengZhou, Henan 450002
address: CN
country: CN
phone: +86-371-3962276
fax-no: +86-371-3962068
e-mail: antispam@public.zz.ha.cn
nic-hdl: LZ33-AP
mnt-by: MAINT-NULL
changed: zhail@email.online.ha.cn 20001124
source: APNIC