2020-07-17 09:05:25 +08:00
|
|
|
<h1 align="center">
|
2020-07-17 13:24:05 +08:00
|
|
|
<br>Nali<br>
|
2020-07-17 09:05:25 +08:00
|
|
|
</h1>
|
|
|
|
|
2020-07-17 13:24:05 +08:00
|
|
|
<h4 align="center">An offline tool for querying IP geographic information.</h4>
|
2020-07-17 09:05:25 +08:00
|
|
|
|
|
|
|
<p align="center">
|
|
|
|
<a href="https://github.com/zu1k/nali/actions">
|
|
|
|
<img src="https://img.shields.io/github/workflow/status/zu1k/nali/Go?style=flat-square" alt="Github Actions">
|
|
|
|
</a>
|
|
|
|
<a href="https://goreportcard.com/report/github.com/zu1k/nali">
|
|
|
|
<img src="https://goreportcard.com/badge/github.com/zu1k/nali?style=flat-square">
|
|
|
|
</a>
|
|
|
|
<a href="https://github.com/zu1k/nali/releases">
|
|
|
|
<img src="https://img.shields.io/github/release/zu1k/nali/all.svg?style=flat-square">
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
|
2020-07-17 13:24:05 +08:00
|
|
|
## Feature
|
|
|
|
|
|
|
|
- Chunzhen qqip database
|
|
|
|
- Geoip2 city database
|
|
|
|
- Pipeline support
|
|
|
|
- Interactive query
|
|
|
|
- Offline query
|
|
|
|
|
2020-07-17 09:05:25 +08:00
|
|
|
## Install
|
|
|
|
|
2020-07-17 13:24:05 +08:00
|
|
|
### Install from source
|
|
|
|
|
|
|
|
Nali Requires Go >= 1.14. You can build it from source:
|
2020-07-17 09:05:25 +08:00
|
|
|
|
|
|
|
```sh
|
|
|
|
$ go get -u -v github.com/zu1k/nali
|
|
|
|
```
|
|
|
|
|
2020-07-17 13:24:05 +08:00
|
|
|
### Install pre-build binariy
|
|
|
|
|
2020-07-17 09:05:25 +08:00
|
|
|
Pre-built binaries are available here: [release](https://github.com/zu1k/nali/releases)
|
|
|
|
|
2020-07-17 13:24:05 +08:00
|
|
|
Download the binary compatible with your platform, unpack and copy to the directory in path
|
|
|
|
|
|
|
|
### Install from docker
|
|
|
|
|
|
|
|
```
|
|
|
|
docker pull docker.pkg.github.com//zu1k/nali/nali:v0.0.2
|
|
|
|
```
|
|
|
|
|
2020-07-17 09:05:25 +08:00
|
|
|
## Usage
|
2020-07-17 13:24:05 +08:00
|
|
|
|
|
|
|
#### Query a simple IP address
|
|
|
|
|
|
|
|
```
|
|
|
|
$ nali 1.2.3.4
|
|
|
|
1.2.3.4 [澳大利亚 APNIC Debogon-prefix网络]
|
|
|
|
```
|
|
|
|
|
|
|
|
##### or use `pipe`
|
|
|
|
|
|
|
|
```
|
|
|
|
$ echo IP 6.6.6.6 | nali
|
|
|
|
IP 6.6.6.6 [美国 亚利桑那州华楚卡堡市美国国防部网络中心]
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Query multiple IP addresses
|
|
|
|
|
|
|
|
```
|
|
|
|
$ 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 [越南 越南邮电集团公司]
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Interactive query
|
|
|
|
|
|
|
|
use `exit` or `quit` to quit
|
|
|
|
|
|
|
|
```
|
|
|
|
$ 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
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Use with dig
|
|
|
|
|
|
|
|
```
|
|
|
|
$ dig nali.lgf.im +short | nali
|
|
|
|
104.28.2.115 [美国 CloudFlare公司CDN节点]
|
|
|
|
104.28.3.115 [美国 CloudFlare公司CDN节点]
|
|
|
|
172.67.135.48 [美国 CloudFlare节点]
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Use with nslookup
|
|
|
|
|
|
|
|
```
|
|
|
|
$ nslookup nali.lgf.im 8.8.8.8 | nali
|
|
|
|
Server: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]
|
|
|
|
Address: 8.8.8.8 [美国 加利福尼亚州圣克拉拉县山景市谷歌公司DNS服务器]#53
|
|
|
|
|
|
|
|
Non-authoritative answer:
|
|
|
|
Name: nali.lgf.im
|
|
|
|
Address: 104.28.3.115 [美国 CloudFlare公司CDN节点]
|
|
|
|
Name: nali.lgf.im
|
|
|
|
Address: 104.28.2.115 [美国 CloudFlare公司CDN节点]
|
|
|
|
Name: nali.lgf.im
|
|
|
|
Address: 172.67.135.48 [美国 CloudFlare节点]
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Use with any other program
|
|
|
|
|
|
|
|
Because nali can read the contents of the `stdin` pipeline, it can be used with any program
|
|
|
|
|
|
|
|
```
|
|
|
|
bash abc.sh | nali
|
|
|
|
```
|
|
|
|
|
|
|
|
Nali will insert ip information after ip
|
|
|
|
|
|
|
|
## Interface
|
|
|
|
|
|
|
|
#### Help
|
|
|
|
|
|
|
|
```
|
|
|
|
$ nali --help
|
|
|
|
Usage:
|
|
|
|
nali [flags]
|
|
|
|
nali [command]
|
|
|
|
|
|
|
|
Available Commands:
|
|
|
|
help Help about any command
|
|
|
|
parse Query IP information
|
|
|
|
update update chunzhen ip database
|
|
|
|
|
|
|
|
Flags:
|
|
|
|
-h, --help help for nali
|
|
|
|
-t, --toggle Help message for toggle
|
|
|
|
|
|
|
|
Use "nali [command] --help" for more information about a command.
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Update chunzhen IP database
|
|
|
|
|
|
|
|
```
|
|
|
|
$ nali update
|
|
|
|
2020/07/17 12:53:46 正在下载最新纯真 IP 库...
|
|
|
|
2020/07/17 12:54:05 已将最新的纯真 IP 库保存到本地 /root/.nali/qqwry.dat
|
|
|
|
```
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
MIT
|
|
|
|
|