Nali 功能
支持多种数据库
纯真 IPv4 离线数据库
ZX IPv6 离线数据库
Geoip2 城市数据库 (可选)
IPIP 数据库 (可选)
ip2region 数据库 (可选)
DB-IP 数据库 (可选)
IP2Location DB3 LITE 数据库 (可选)
CDN 服务提供商查询
支持管道处理
支持交互式查询
同时支持IPv4和IPv6
支持多语言
查询完全离线
全平台支持
支持彩色输出
安装
从源码安装
安装前 需要 预先安装 Go >=1.18 安装后可以从源码安装软件
1 go install github.com/zu1k/nali@latest
1 C:\Users\Administrator>go install github.com/zu1k/nali@latest
使用说明 查询一个IP的地理信息
1 2 $ nali 1.2.3.4 1.2.3.4 [澳大利亚 APNIC Debogon-prefix网络]
1 2 C:\Users\Administrator>nali 1.2 .3.4 1.2 .3.4 [澳大利亚 APNIC Debogon -prefix 网络]
1 2 $ echo IP 6.6.6.6 | naliIP 6.6.6.6 [美国 亚利桑那州华楚卡堡市美国国防部网络中心]
1 2 C:\Users\Administrator>echo IP 6.6 .6.6 | nali IP 6.6 .6.6 [美国亚利桑那州华楚卡堡市 美国国防部网络中心]
1 2 3 4 $ nali 1.2.3.4 4.3.2.1 123.23.3.0 1.2.3.4 [澳大利亚 APNIC Debogon-prefix网络] 4.3.2.1 [美国 新泽西州纽瓦克市Level3Communications] 123.23.3.0 [越南 越南邮电集团公司]
1 2 C:\Users\Administrator>nali 1.2 .3.4 4.3 .2.1 123.23 .3.0 1.2 .3.4 [澳大利亚 APNIC Debogon -prefix 网络] 4.3 .2.1 [美国新泽西州纽瓦克市 Level3Communications ] 123.23 .3.0 [越南 越南邮电集团公司]
交互式查询
1 2 3 4 5 6 7 8 $ nali 123.23.23.23 123.23.23.23 [越南 越南邮电集团公司] 1.0.0.1 1.0.0.1 [美国 APNIC&CloudFlare公共DNS服务器] 8.8.8.8 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器] quit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 C:\Users\Administrator>nali 255.255 .255.0 255.255 .255.0 [纯真网络 2023 年05 月10 日IP 数据] 192.168 .1.1 192.168 .1.1 [局域网 对方和您在同一内部网] www.baidu.com www.baidu.com 112.241 .85.156 112.241 .85.156 [山东省聊城市 联通]1.2 .3.4 1.2 .3.4 [澳大利亚 APNIC Debogon -prefix 网络]1.0 .0.1 1.0 .0.1 [美国 APNIC &CloudFlare 公共DNS 服务器]8.8 .8.8 8.8 .8.8 [美国加利福尼亚州圣克拉拉县山景市 谷歌公司DNS 服务器]quit
与 dig 命令配合使用
需要你系统中已经安装好 dig 程序
Dig 工具全称为域名信息搜索器(Domain InformationGroper),能够显示详细的DNS查询过程,是一个非常强大的DNS故障诊断工具。一般Linux和Unix系统都已内置了该功能,但是在Windows环境中只有nslookup工具,如果想用到 dig 命令,就只能自己手动安装了。
1 2 3 4 $ dig nali.zu1k.com +short | nali 104.28.2.115 [美国 CloudFlare公司CDN节点] 104.28.3.115 [美国 CloudFlare公司CDN节点] 172.67.135.48 [美国 CloudFlare节点]
输入相同的命令 由国内有墙 所以是没有反应的 将地址修改为百度的 域名地址
1 2 C:\Users\Administrator>dig www.baidu.com +short | nali 39.156 .66.14 [北京市 移动]
与 nslookup 命令配合使用
1 2 3 4 5 6 7 8 9 10 11 $ nslookup nali.zu1k.com 8.8.8.8 | nali Server: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器] Address: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]#53 Non-authoritative answer: Name: nali.zu1k.com Address: 104.28.3.115 [美国 CloudFlare公司CDN节点] Name: nali.zu1k.com Address: 104.28.2.115 [美国 CloudFlare公司CDN节点] Name: nali.zu1k.com Address: 172.67.135.48 [美国 CloudFlare节点]
本来我以为没有 nslookup 程序 但是没想到 windows 内置了这个程序
1 2 3 4 5 6 7 C:\Users\Administrator>nslookup nali.zu1k.com 8.8 .8.8 | nali *** Request to dns.google timed-out Server: dns.google Address: 8.8 .8.8 [美国加利福尼亚州圣克拉拉县山景市 谷歌公司DNS 服务器] DNS request timed out. timeout was 2 seconds.
与任意程序配合使用
因为 nali 支持管道处理,所以可以和任意程序配合使用
这里需要 linux 而我现在 正在使用的是windows windows脚本并不能使用 bash shell 脚本 所以这里并没有运行感兴趣的剋以自行尝试
值得一提的是 我在kali linux 中进行尝试使用的时候总是遇到问题 稍后将在我的小kali linux 物理机上 尝试
Nali 将在 IP后面插入IP地理信息,CDN域名后面插入CDN服务提供商信息
支持IPv6
1 2 3 4 5 6 7 8 9 $ nslookup google.com | nali Server: 127.0.0.53 [局域网 IP] Address: 127.0.0.53 [局域网 IP]#53 Non-authoritative answer: Name: google.com Address: 216.58.211.110 [美国 Google全球边缘网络] Name: google.com Address: 2a00:1450:400e:809::200e [荷兰Amsterdam Google Inc. 服务器网段]
1 2 3 4 5 6 7 8 9 C:\Users\Administrator>nslookup google.com | nali Non-authoritative answer: Server: UnKnown Address: fe80::1 [局域网 本地链路单播地址] Name: google.com [Google Web 业务] Address: 142.251 .42.238 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司]
查询 CDN 服务提供商
因为 CDN 服务通常使用 CNAME 的域名解析方式,所以推荐与 nslookup 或者 dig 配合使用,在已经知道 CNAME 后可单独使用
1 2 3 4 5 6 7 8 9 10 11 12 13 $ nslookup www.gov.cn | nali Server: 127.0.0.53 [局域网 IP] Address: 127.0.0.53 [局域网 IP]#53 Non-authoritative answer: www.gov.cn canonical name = www.gov.cn.bsgslb.cn [白山云 CDN]. www.gov.cn.bsgslb.cn [白山云 CDN] canonical name = zgovweb.v.bsgslb.cn [白山云 CDN]. Name: zgovweb.v.bsgslb.cn [白山云 CDN] Address: 103.104.170.25 [新加坡 ] Name: zgovweb.v.bsgslb.cn [白山云 CDN] Address: 2001:428:6402:21b::5 [美国Louisiana州Monroe Qwest Communications Company, LLC (CenturyLink)] Name: zgovweb.v.bsgslb.cn [白山云 CDN] Address: 2001:428:6402:21b::6 [美国Louisiana州Monroe Qwest Communications Company, LLC (CenturyLink)]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 C:\Users\Administrator>nslookup www.gov.cn | nali Non-authoritative answer: Server: UnKnown Address: fe80::1 [局域网 本地链路单播地址] Name: zgovweb.v.bsgslb.cn [白山云 CDN ] Addresses: 2409 :8720 :b201:300 ::8 :fe [中国 江苏省 泰州市 海陵区 中国移动政企专线] 2409 :8720 :b201:300 ::8 :fb [中国 江苏省 泰州市 海陵区 中国移动政企专线] 2409 :8728 :6 aff:f00e::1 :6 a [中国 浙江省 金华市 婺城区 中国移动政企专线] 2409 :8720 :b201:300 ::8 :fc [中国 江苏省 泰州市 海陵区 中国移动政企专线] 2409 :8720 :b201:300 ::8 :fd [中国 江苏省 泰州市 海陵区 中国移动政企专线] 111.32 .160.88 [天津市 移动] 111.2 .79.179 [浙江省金华市 移动] 111.32 .160.87 [天津市 移动] 111.32 .160.86 [天津市 移动] Aliases: www.gov.cn www.gov.cn.bsgslb.cn [白山云 CDN ]
用户交互
程序第一次运行后,会在工作目录生成配置文件 config.yaml (默认~/.nali/config.yaml),配置文件定义了数据库信息,默认用户无需进行修改
数据库格式默认如下:
1 2 3 4 5 6 7 8 9 10 11 - name: geoip name-alias: - geolite - geolite2 format: mmdb file: GeoLite2-City.mmdb languages: - ALL types: - IPv4 - IPv6
但是这个是linux 的位置 经过多方查找 (多谢 everthing 这个 软件)
windows 的位置是在 C:\Users\Administrator\AppData\Local\nali\config.yaml
但也不一定 每台机器 各不相同 也许 有个微小的设置就会把路径改变
这里直接使用 cat 命令 查看
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 C:\Users\Administrator>cat C:\Users\Administrator\AppData\Local\nali\config.yaml databases: - name: qqwry name-alias: - chunzhen format: qqwry file: qqwry.dat languages: - zh-CN types: - IPv4 download-urls: - https://gh-release.zu1k.com/HMBSbige/qqwry/qqwry.dat - name: zxipv6wry name-alias: - zxipv6 - zx format: zxipv6wry file: zxipv6wry.db languages: - zh-CN types: - IPv6 - name: geoip name-alias: - geoip2 - geolite - geolite2 format: mmdb file: GeoLite2-City.mmdb languages: - ALL types: - IPv4 - IPv6 - name: dbip name-alias: - db-ip format: mmdb file: dbip.mmdb languages: - ALL types: - IPv4 - IPv6 - name: ipip format: ipip file: ipipfree.ipdb languages: - zh-CN types: - IPv4 - IPv6 - name: ip2region name-alias: - i2r format: ip2region file: ip2region.xdb languages: - zh-CN types: - IPv4 download-urls: - https://cdn.jsdelivr.net/gh/lionsoul2014/ip2region/data/ip2region.xdb - https://raw.githubusercontent.com/lionsoul2014/ip2region/master/data/ip2region.xdb - name: ip2location format: ip2location file: IP2LOCATION-LITE-DB3.IPV6.BIN languages: - en types: - IPv4 - IPv6 - name: cdn format: cdn-yml file: cdn.yml languages: - zh-CN types: - CDN download-urls: - https://cdn.jsdelivr.net/gh/4ft35t/cdn/src/cdn.yml - https://raw.githubusercontent.com/4ft35t/cdn/master/src/cdn.yml - https://raw.githubusercontent.com/SukkaLab/cdn/master/src/cdn.yml selected: cdn: cdn ipv4: qqwry ipv6: zxipv6wry lang: zh-CN
其中,languages 和 types 表示该数据库支持的语言和查询类型。如果你需要增加数据库,需小心修改配置文件,如果有任何问题,欢迎提 issue 询问。
查看帮助 1 2 3 4 5 6 7 8 9 10 11 12 13 14 $ nali --help Usage: nali [flags] nali [command] Available Commands: help Help about any command update update qqwry, zxipv6wry, ip2region ip database and cdn Flags: -h, --help help for nali -t, --toggle Help message for toggle Use "nali [command] --help" for more information about a command.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 C:\Users\Administrator>nali --help An offline tool for querying IP geographic information. Find document on: https://github.com/zu1k/nali $ nali 1.2 .3.4 or use pipe $ echo IP 6.6 .6.6 | nali $ nali 1.2 .3.4 4.3 .2.1 123.23 .3.0 $ nali 123.23 .23.23 123.23 .23.23 [越南 越南邮电集团公司] quit $ dig nali.zu1k.com +short | nali $ nslookup nali.zu1k.com 8.8 .8.8 | nali bash abc.sh | nali Usage: nali [flags ] nali [command ] Available Commands: completion Generate the autocompletion script for the specified shell help Help about any command info get the necessary information of nali update update qqwry, zxipv6wry, ip2region ip database and cdn Flags: --gbk Use GBK decoder -h , --help help for nali -v , --version version for nali Use "nali [command] --help" for more information about a command.
更新数据库
1 2 3 $ nali update 2020/07/17 12:53:46 正在下载最新纯真 IP 库... 2020/07/17 12:54:05 已将最新的纯真 IP 库保存到本地 /root/.nali/qqwry.dat
1 2 3 4 5 6 7 8 9 10 11 C:\Users\Administrator>nali update 2023 /05 /15 16 :19 :29 正在下载最新 qqwry 数据库...2023 /05 /15 16 :20 :29 qqwry 数据库下载失败,请手动下载解压后保存到本地: qqwry.dat 2023 /05 /15 16 :20 :29 下载链接: [https ://gh -release.zu1k.com /HMBSbige /qqwry /qqwry.dat ]2023 /05 /15 16 :20 :29 error: context deadline exceeded (Client.Timeout or context cancellation while reading body)2023 /05 /15 16 :20 :29 正在下载最新 ZX IPv6数据库...2023 /05 /15 16 :20 :30 已将最新的 ZX IPv6数据库 保存到本地: [zxipv6wry.db ]2023 /05 /15 16 :20 :30 正在下载最新 ip2region 数据库...2023 /05 /15 16 :20 :36 ip2region 数据库下载成功: ip2region.xdb2023 /05 /15 16 :20 :36 正在下载最新 cdn 数据库...2023 /05 /15 16 :20 :37 cdn 数据库下载成功: cdn.yml
还是因为有墙的原因 有一些数据库就下载不下来
或者指定数据库
1 2 3 $ nali update --db qqwry,cdn 2020/07/17 12:53:46 正在下载最新纯真 IP 库... 2020/07/17 12:54:05 已将最新的纯真 IP 库保存到本地 /root/.nali/qqwry.dat
详细介绍链接 https://mp.weixin.qq.com/s/TIqC6zWnffrHmpJuyZpsuA