首先详细教程已经有前辈做了详细的安装和使用介绍,本人只是参照学习和记录下自己的实际操做。
本文参考档: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)
下载
这里强调下原文的下载是行不通了,因为是谷歌退出大陆前的,后者可以根据我下面提供的下载命令
wget --no-check-certificate http://qqwry.googlecode.com/files/nali-0.2.tar.gz
[root@localhost ~]# wget --no-check-certificate http://qqwry.googlecode.com/files/nali-0.2.tar.gz
--2013-06-18 22:31:46-- http://qqwry.googlecode.com/files/nali-0.2.tar.gz
正在解析主机 qqwry.googlecode.com... 74.125.31.82, 2404:6800:4008:c01::52
正在连接 qqwry.googlecode.com|74.125.31.82|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:4443880 (4.2M) [application/octet-stream]
正在保存至: “nali-0.2.tar.gz” 18% [========> ] 805,090 648K/s in 1.2s 2013-06-18 22:31:48 (648 KB/s) - 在 805090/4443880 字节处发生读取错误 (Connection reset by peer)。重试中。 --2013-06-18 22:31:49-- (尝试次数: 2) http://qqwry.googlecode.com/files/nali-0.2.tar.gz
正在连接 qqwry.googlecode.com|74.125.31.82|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 206 Partial Content
长度:4443880 (4.2M),3638790 (3.5M) 字节剩余 [application/octet-stream]
正在保存至: “nali-0.2.tar.gz” 79% [+++++++++=============================> ] 3,542,110 884K/s eta(英国中部时94% [+++++++++=====================================> ] 4,188,470 994K/s eta(英国中部时100%[+++++++++========================================>] 4,443,880 1021K/s in 3.5s 2013-06-18 22:31:53 (1021 KB/s) - 已保存 “nali-0.2.tar.gz” [4443880/4443880]) [root@localhost ~]# tar zxvf nali-0.2.tar.gz
nali-0.2/
nali-0.2/bin/
nali-0.2/configure
nali-0.2/INSTALL
nali-0.2/libqqwry/
nali-0.2/LICENSE
nali-0.2/Makefile
nali-0.2/nali.c
nali-0.2/README
nali-0.2/share/
nali-0.2/share/nali.pl
nali-0.2/share/nali.sh
nali-0.2/share/QQWry.Dat
nali-0.2/libqqwry/qqwry.c
nali-0.2/libqqwry/qqwry.h
nali-0.2/bin/nali-dig
nali-0.2/bin/nali-nslookup
nali-0.2/bin/nali-ping
nali-0.2/bin/nali-tracepath
nali-0.2/bin/nali-traceroute
[root@localhost ~]# cd nali-0.2
[root@localhost nali-0.2]# ./configure
***** Configure Successfully ***** Install:
make && make install Usage and Examples:
http://www.surfchen.org/wiki/Nali
[root@localhost nali-0.2]# make && make install
gcc -o bin/qqwrynali nali.c libqqwry/qqwry.c
cp share/nali.sh bin/nali
install bin/qqwrynali /usr/local/bin
install bin/nali /usr/local/bin
install bin/nali-traceroute /usr/local/bin
install bin/nali-tracepath /usr/local/bin
install bin/nali-dig /usr/local/bin
install bin/nali-nslookup /usr/local/bin
install bin/nali-ping /usr/local/bin
install bin/nali-update /usr/local/bin
install share/QQWry.Dat /usr/local/share
install share/nali.pl /usr/local/share
[root@localhost nali-0.2]# cd /usr/local/share/
[root@localhost share]# ls
applications info man nali.pl QQWry.Dat
[root@localhost share]# nali-update
Updating /usr/local/share/QQWry.Dat
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8932k 100 8932k 0 0 143k 0 0:01:02 0:01:02 --:--:-- 411k
Successfully Updated
[root@localhost share]# nali-dig www.baidu.com ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36989
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION:
;www.baidu.com. IN A ;; ANSWER SECTION:
www.baidu.com. 0 IN CNAME www.a.shifen.com.
www.a.shifen.com. 35 IN A 61.135.169.125[北京市 百度蜘蛛]
www.a.shifen.com. 35 IN A 61.135.169.105[北京市 百度蜘蛛] ;; Query time: 3 msec
;; SERVER: 202.106.0.20[北京市 联通DNS服务器]#53(202.106.0.20[北京市 联通DNS服务器])
;; WHEN: Tue Jun 18 22:36:09 2013
;; MSG SIZE rcvd: 90 [root@localhost share]# nali-nslookup www.baidu.com
Server: 202.106.0.20[北京市 联通DNS服务器]
Address: 202.106.0.20[北京市 联通DNS服务器]#53 Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 61.135.169.125[北京市 百度蜘蛛]
Name: www.a.shifen.com
Address: 61.135.169.105[北京市 百度蜘蛛]
此工具可以在搭建网站访问监控时的插件可以显示出对用访问ip的地理位置情况
我记着我曾经搭建过一个监控网站用到了该工具所用到的ip数据库 详细的使用和介绍请移步到上述参考档案这里只是记录本人的实验随笔过程!