A terminal tool for offline query of IP geographic information and CDN providers

Time:2020-12-3

Introduction to Nali

Nali is a tool that can automatically parse IP in stdout and attach ISP and geographic information.

Nali is taken from the Chinese “where”. At the beginning, Nali was a small tool written by surfchen in C and Perl several years ago (C was used to parse pure IP databases, Perl was used to parse stdout). Queries were made locally, and no online queries were made, so there would be no impact on efficiency.

Nali cli is developed with nodejs. Before installation, you need to have nodejs environment.

Project address:

Nali installation

After you have prepared the nodejs environment, you only need to execute the following command to install successfully.

# NPM
$ npm i nali-cli -g
# Yarn
$ yarn global add nali-cli

Nali cli also has MacOS x64 and Linux x64 compiled binaries for download, which can be downloaded from the bin directory in GitHub repo.

  • nali-cli/blob/master/bin/nali-cli-linux
  • nali-cli/blob/master/bin/nali-cli-macos

Note: the first time you run the Nali cli, the required qqwry.dat Go to the $home /. Config / Nali cli / directory.

Use of Nali

1. Information help

$ nali --help
Usage: nali <command> [options]
Options:
  -v. -- version information
  -h, --help     output usage information
Commands:
  Parse parse stdin or IP information in the parameter (default)
  Update IP library
  help [cmd]     display help for [cmd]

2. Tools command

  • nali-dig
  • nali-nslookup
  • nali-ping
  • nali-tracepath
  • nali-traceroute

Nali required related software installed. For example, in order to use Nali dig and Nali NSLOOKUP you need to have bind (dnsutils) installed.

3. Examples of use

Query an IP address

$ nali 1.145.1.4
1.145.1.4 [Telstra, Melbourne, Australia]

Query a set of IP addresses

$ nali 114.5.1.4 191.919.8.10 1.0.0.1
114.5.1.4 [Indonesia] 191.919.8.10 1.0.0.1 [APNIC & cloudflare public DNS server]

It also supports querying information from the outside of nastli

$ dig blog.skk.moe +short | nali
104.18.101.28 [cloudflare CDN node]
104.18.100.28 [cloudflare CDN node]
$ nslookup www.gov.cn 1.0.0.1 | nali
Server: 1.0.0.1 [APNIC & cloudflare public DNS server]
Address: 1.0.0.1 [U.S. APNIC & cloudflare public DNS server] ා
Non-authoritative answer:
www.gov.cn     canonical name =  www.gov.cn.bsgslb.cn. [baishanyun CDN]
www.gov.cn.bsgslb.cn [CDN] canonical name = zgovweb. V bsgslb.cn . [baishanyun CDN]
Name:    zgovweb.v. bsgslb.cn [baishanyun CDN]
Address: 107.155.25.117 [zenlayer, Hong Kong]
Name:    zgovweb.v. bsgslb.cn [baishanyun CDN]
Address: 107.155.25.118 [zenlayer, Hong Kong]
Name:    zgovweb.v. bsgslb.cn [baishanyun CDN]
Address: 107.155.25.116 [zenlayer, Hong Kong]
Name:    zgovweb.v. bsgslb.cn [baishanyun CDN]
Address: 107.155.25.120
Name:    zgovweb.v. bsgslb.cn [baishanyun CDN]
Address: 2001:438:fffd:98::4
Name:    zgovweb.v. bsgslb.cn [baishanyun CDN]
Address: 2001:438:fffd:98::5

Use the built-in command

$ nali-nslookup blog.skk.moe
Server: 1.0.0.1 [APNIC & cloudflare public DNS server]
Address: 1.0.0.1 [U.S. APNIC & cloudflare public DNS server] ා
Non-authoritative answer:
Name:   blog.skk.moe
Address: 104.18.101.28 [cloudflare CDN node]
Name:   blog.skk.moe
Address: 104.18.100.28 [cloudflare CDN node]
Name:   blog.skk.moe
Address: 2606:4700::6812:641c
Name:   blog.skk.moe
Address: 2606:4700::6812:651c
$ nali-traceroute 117.8.222.169
Traceroute to 117.8.222.169 (117.8.222.169), 30 hops max, 60 byte packets
 1  dns1. online.tj.cn (111.161.19.1 [Tianjin Unicom]) 6.298 MS 6.767 MS 7.192 MS
 2. No data (125.39.237.237 [IDC room (Unicom)] 5.129 MS 5.509 MS 5.907 MS
 3  dns217. online.tj.cn (111.161.29.217 [Tianjin Unicom]) 0.573 MS no data (125.39.237.225 [IDC room (Unicom)]) 3.843 MS 3.148 Ms
 4  dns169. online.tj.cn (117.8.222.169 [Tianjin Unicom]) 10.547 MS 10.718 MS 10.771 MS

Update IP database( qqwry.dat )

nali update

The above is the introduction of Nali, interested students can install and experience, if this article is helpful to you, please clickWatchingAndForward sharing circle of friendsSupport Oh, thank you for watching and forwarding support all the time!!!

A terminal tool for offline query of IP geographic information and CDN providers