码迷,mamicode.com
首页 > 系统相关 > 详细

# Linux Whois3获取 运营商信息

时间:2015-10-18 20:00:03      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:

Linux Whois3获取 运营商信息

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文件

  1. This is whois3, a very simple and generic whois client.
  2. This client, unlike the "classic" whois client,
  3. does not check for supported flags at the client side,
  4. except for -h (whois host) and -p (whois port).
  5. The syntax checks for flags are made at the server side.
  6. The default host and port of whois3 is whois.ripe.net
  7. at port 43 (or to be more exact, the tcp port specified
  8. for whois in /etc/services). You can change the default host
  9. by setting NICHOST in the source.
  10. To compile and install, just type:
  11. % ./configure [--prefix=your_prefix_dir]
  12. % make
  13. % make install
  14. Type "configure --help" for generic help on how to use configure.
  15. This client has been compiled and tested on a variety of systems;
  16. please contact <ripe-dbm@ripe.net> for comments and bug reports.

执行编译安装命令 (本机已有 Cygwin64环境 )

  1. ./configure
  2. make
  3. make install

运行命令

  1. 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

查看结果

结果如下

  1. % Information related to ‘202.111.151.80 - 202.111.151.87‘
  2. inetnum: 202.111.151.80 - 202.111.151.87
  3. netname: SMX-DEMO
  4. descr: San men xia telecom bureau
  5. descr: No.29 branch bureau for multimedia server demo,
  6. descr: San men xia city, Henan Provice
  7. descr: 20020826
  8. country: CN
  9. admin-c: LZ33-AP
  10. tech-c: LZ33-AP
  11. remarks: custmor
  12. mnt-by: MAINT-CNCGROUP
  13. changed: zhonglp@email.online.ha.cn 19990430
  14. status: ASSIGNED NON-PORTABLE
  15. source: APNIC
  16. person: Liping Zhong
  17. address: Henan Multimedia Information Bureau
  18. address: 70, Nong Ye Road
  19. address: ZhengZhou, Henan 450002
  20. address: CN
  21. country: CN
  22. phone: +86-371-3962276
  23. fax-no: +86-371-3962068
  24. e-mail: antispam@public.zz.ha.cn
  25. nic-hdl: LZ33-AP
  26. mnt-by: MAINT-NULL
  27. changed: zhail@email.online.ha.cn 20001124
  28. source: APNIC




# Linux Whois3获取 运营商信息

标签:

原文地址:http://www.cnblogs.com/wishmo/p/854f1dde3317d706c097d46d65c2c98b.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!