Introduce a terminal tool that can query IP source and ISP information offline

Introduce a terminal tool that can query IP source and ISP information offline

收录于话题
#打怪升级进阶之路
30个

Click on "Migrant Workers Technical Road" above, select "Set as Star" and
reply "1024" to get exclusive learning materials!
Introduce a terminal tool that can query IP source and ISP information offline

Introduction to Nali

Nali is a tool that can automatically resolve the IP in the stdout of these tools and attach the ISP and geographic information.

Nali is taken from the Chinese "Where". Nali was originally a small tool written in C and Perl by surfchen a few years ago (C is used to parse the pure IP database, Perl is used to parse stdout). The query is performed locally, and network query is not performed, so the efficiency is not What will be the impact.

Nali CLI is developed using Nodejs. Before installation, you need to have a Nodejs environment.

project address:

GitHub: https://github.com/sukkaw/nali-cli
official website: https://nali.skk.moe/

Nali installation

After preparing the Nodejs environment, you only need to execute the following command to successfully install it.

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

Nali CLI also has macOS x64 and Linux x64 compiled binary files 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: When you run Nali CLI for the first time, it will automatically download the required qqwry.dat to the $HOME/.config/nali-cli/ directory.

Nali use

1. Help information


$ nali --help

Usage: nali <command> [options]

Options:
v, --version  版本信息
h, --help     output usage information

Commands:
parse          解析 stdin 或参数中的 IP 信息 (默认)
update         更新 IP 库
help [cmd]     display help for [cmd]

2. Comes with tool commands

  • 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. It means that you need to install the application before you can use it.

3. Examples of use

Query an IP address


$ nali 1.145.1.4

1.145.1.4 [澳大利亚 墨尔本 Telstra]

Query a set of IP addresses


$ nali 114.5.1.4 191.919.8.10 1.0.0.1

114.5.1.4 [印度尼西亚] 191.919.8.10 1.0.0.1 [美国 APNIC&CloudFlare 公共 DNS 服务器]

Nali CLI also supports parsing and querying IP information from external stdin:


$ dig blog.skk.moe +short | nali

104.18.101.28 [美国 CloudFlare 公司 CDN 节点]
104.18.100.28 [美国 CloudFlare 公司 CDN 节点]
$ nslookup www.gov.cn 1.0.0.1 | nali
Server:        1.0.0.1 [美国 APNIC&CloudFlare 公共 DNS 服务器]
Address:    1.0.0.1 [美国 APNIC&CloudFlare 公共 DNS 服务器]#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: 107.155.25.117 [香港 Zenlayer]
Name:    zgovweb.v.bsgslb.cn [白山云 CDN]
Address: 107.155.25.118 [香港 Zenlayer]
Name:    zgovweb.v.bsgslb.cn [白山云 CDN]
Address: 107.155.25.116 [香港 Zenlayer]
Name:    zgovweb.v.bsgslb.cn [白山云 CDN]
Address: 107.155.25.120 [香港 Zenlayer]
Name:    zgovweb.v.bsgslb.cn [白山云 CDN]
Address: 2001:438:fffd:98::4
Name:    zgovweb.v.bsgslb.cn [白山云 CDN]
Address: 2001:438:fffd:98::5

Use built-in commands

$ nali-nslookup blog.skk.moe

Server:         1.0.0.1 [美国 APNIC&CloudFlare 公共 DNS 服务器]
Address:        1.0.0.1 [美国 APNIC&CloudFlare 公共 DNS 服务器]#53

Non-authoritative answer:
Name:   blog.skk.moe
Address: 104.18.101.28 [美国 CloudFlare 公司 CDN 节点]
Name:   blog.skk.moe
Address: 104.18.100.28 [美国 CloudFlare 公司 CDN 节点]
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[天津市 联通])  6.298 ms  6.767 ms  7.192 ms
 2  no-data (125.39.237.237[天津市 深圳市腾讯计算机系统有限公司IDC机房(联通)])  5.129 ms  5.509 ms  5.907 ms
 3  dns217.online.tj.cn (111.161.29.217[天津市 联通])  0.573 ms no-data (125.39.237.225[天津市 深圳市腾讯计算机系统有限公司IDC机房(联通)])  3.843 ms  3.148 ms
 4  dns169.online.tj.cn (117.8.222.169[天津市 联通])  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 it by themselves. If this article is helpful to you, please click to watch and forward to share the circle of friends to support it, thank you for your continued watching and forwarding support! !
Introduce a terminal tool that can query IP source and ISP information offline

Introduce a terminal tool that can query IP source and ISP information offline
Introduce a terminal tool that can query IP source and ISP information offline
Introduce a terminal tool that can query IP source and ISP information offline
Recommended reading Click on the title to jump to it
! I recommend a MySQL automated operation and maintenance tool!
Bug! Redis 6.0.8 is released urgently, please upgrade as soon as possible!
Early adopters on Huawei Hongmeng OS, my first "hello world" is the
most complete Linux/C/C++ learning mind map, please collect it!
I have compiled 15 useful API interface management artifacts, you can pick whatever...
Docker Container Network-Basics
will be updated after three years! An absolute conscience tool, free and easy to use.
Why is HTTPS safe?
Can SSH only be used on remote Linux hosts? That means you are too young!
Introduce a terminal tool that can query IP source and ISP information offline

Included in the topic # Daguai upgrade Advanced Road
30
Ge

Guess you like

Origin blog.51cto.com/mingongge/2554292