# Linux Whois3获取 运营商信息

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
上一篇:java selenium 自动化笔记-不是0基础,至少有java基础


下一篇:Python(phone)模块获取手机号归属地、区号、运营商等