首先详细教程已经有前辈做了详细的安装和使用介绍,本人只是参照学习和记录下自己的实际操做。
本文参考档:http://www.cnblogs.com/mchina/archive/2012/12/24/2831220.html
介绍
nali,名字取自中文“哪里”的拼音。nali包含一组命令行程序,其主要功能就是把一些网络工具的输出的IP字符串,附加上地理位置信息(使用纯真数据库QQWry.Dat)。例如74.125.128.104会变成74.125.128.104[美国 加利福尼亚州山景市谷歌公司]。查询是在本地进行,并不会进行联网查询,所以效率方面不会对原始命令产生什么影响。
目前包含以下几个命令:
- nali
- nali-dig
- nali-nslookup
- nali-traceroute
- nali-tracepath
- nali-ping
使用这些命令的前提是,他们对应的命令必须存在。例如你要用nali-dig,必须保证dig是存在的。他们的用法和原始命令是一样的。例如nali-dig,用法就和dig一样。(nali-dig等同于dig |nali)
下载
这里强调下原文的下载是行不通了,因为是谷歌退出大陆前的,后者可以根据我下面提供的下载命令
1 wget --no-check-certificate http://qqwry.googlecode.com/files/nali-0.2.tar.gz
1 [root@localhost ~]# wget --no-check-certificate http://qqwry.googlecode.com/files/nali-0.2.tar.gz 2 --2013-06-18 22:31:46-- http://qqwry.googlecode.com/files/nali-0.2.tar.gz 3 正在解析主机 qqwry.googlecode.com... 74.125.31.82, 2404:6800:4008:c01::52 4 正在连接 qqwry.googlecode.com|74.125.31.82|:80... 已连接。 5 已发出 HTTP 请求,正在等待回应... 200 OK 6 长度:4443880 (4.2M) [application/octet-stream] 7 正在保存至: “nali-0.2.tar.gz” 8 9 18% [========> ] 805,090 648K/s in 1.2s 10 11 2013-06-18 22:31:48 (648 KB/s) - 在 805090/4443880 字节处发生读取错误 (Connection reset by peer)。重试中。 12 13 --2013-06-18 22:31:49-- (尝试次数: 2) http://qqwry.googlecode.com/files/nali-0.2.tar.gz 14 正在连接 qqwry.googlecode.com|74.125.31.82|:80... 已连接。 15 已发出 HTTP 请求,正在等待回应... 206 Partial Content 16 长度:4443880 (4.2M),3638790 (3.5M) 字节剩余 [application/octet-stream] 17 正在保存至: “nali-0.2.tar.gz” 18 19 79% [+++++++++=============================> ] 3,542,110 884K/s eta(英国中部时94% [+++++++++=====================================> ] 4,188,470 994K/s eta(英国中部时100%[+++++++++========================================>] 4,443,880 1021K/s in 3.5s 20 21 2013-06-18 22:31:53 (1021 KB/s) - 已保存 “nali-0.2.tar.gz” [4443880/4443880]) 22 23 [root@localhost ~]# tar zxvf nali-0.2.tar.gz 24 nali-0.2/ 25 nali-0.2/bin/ 26 nali-0.2/configure 27 nali-0.2/INSTALL 28 nali-0.2/libqqwry/ 29 nali-0.2/LICENSE 30 nali-0.2/Makefile 31 nali-0.2/nali.c 32 nali-0.2/README 33 nali-0.2/share/ 34 nali-0.2/share/nali.pl 35 nali-0.2/share/nali.sh 36 nali-0.2/share/QQWry.Dat 37 nali-0.2/libqqwry/qqwry.c 38 nali-0.2/libqqwry/qqwry.h 39 nali-0.2/bin/nali-dig 40 nali-0.2/bin/nali-nslookup 41 nali-0.2/bin/nali-ping 42 nali-0.2/bin/nali-tracepath 43 nali-0.2/bin/nali-traceroute 44 [root@localhost ~]# cd nali-0.2 45 [root@localhost nali-0.2]# ./configure 46 ***** Configure Successfully ***** 47 48 Install: 49 make && make install 50 51 Usage and Examples: 52 http://www.surfchen.org/wiki/Nali 53 [root@localhost nali-0.2]# make && make install 54 gcc -o bin/qqwrynali nali.c libqqwry/qqwry.c 55 cp share/nali.sh bin/nali 56 install bin/qqwrynali /usr/local/bin 57 install bin/nali /usr/local/bin 58 install bin/nali-traceroute /usr/local/bin 59 install bin/nali-tracepath /usr/local/bin 60 install bin/nali-dig /usr/local/bin 61 install bin/nali-nslookup /usr/local/bin 62 install bin/nali-ping /usr/local/bin 63 install bin/nali-update /usr/local/bin 64 install share/QQWry.Dat /usr/local/share 65 install share/nali.pl /usr/local/share 66 [root@localhost nali-0.2]# cd /usr/local/share/ 67 [root@localhost share]# ls 68 applications info man nali.pl QQWry.Dat 69 [root@localhost share]# nali-update 70 Updating /usr/local/share/QQWry.Dat 71 % Total % Received % Xferd Average Speed Time Time Time Current 72 Dload Upload Total Spent Left Speed 73 100 8932k 100 8932k 0 0 143k 0 0:01:02 0:01:02 --:--:-- 411k 74 Successfully Updated 75 [root@localhost share]# nali-dig www.baidu.com 76 77 ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6 <<>> www.baidu.com 78 ;; global options: +cmd 79 ;; Got answer: 80 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36989 81 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 82 83 ;; QUESTION SECTION: 84 ;www.baidu.com. IN A 85 86 ;; ANSWER SECTION: 87 www.baidu.com. 0 IN CNAME www.a.shifen.com. 88 www.a.shifen.com. 35 IN A 61.135.169.125[北京市 百度蜘蛛] 89 www.a.shifen.com. 35 IN A 61.135.169.105[北京市 百度蜘蛛] 90 91 ;; Query time: 3 msec 92 ;; SERVER: 202.106.0.20[北京市 联通DNS服务器]#53(202.106.0.20[北京市 联通DNS服务器]) 93 ;; WHEN: Tue Jun 18 22:36:09 2013 94 ;; MSG SIZE rcvd: 90 95 96 [root@localhost share]# nali-nslookup www.baidu.com 97 Server: 202.106.0.20[北京市 联通DNS服务器] 98 Address: 202.106.0.20[北京市 联通DNS服务器]#53 99 100 Non-authoritative answer: 101 www.baidu.com canonical name = www.a.shifen.com. 102 Name: www.a.shifen.com 103 Address: 61.135.169.125[北京市 百度蜘蛛] 104 Name: www.a.shifen.com 105 Address: 61.135.169.105[北京市 百度蜘蛛]
此工具可以在搭建网站访问监控时的插件可以显示出对用访问ip的地理位置情况
我记着我曾经搭建过一个监控网站用到了该工具所用到的ip数据库 详细的使用和介绍请移步到上述参考档案这里只是记录本人的实验随笔过程!