Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Nali in linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to use Nali in linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

What is Nali?

Dig, nslookup, traceroute and so on are all very useful network debugging tools. Nali is a tool that can automatically parse the IP in these tools stdout and attach their ISP and geographic information, which is like a Swiss Army knife.

Nali is taken from the Chinese "where". Nali, which started as a gadget written by surfchen in C and Perl a few years ago (C for parsing pure IP databases and Perl for parsing stdout), has been lost.

Today, I would like to introduce two new generation of Nali developed based on GO language and Nodejs, with more advanced functions.

Nali CLI

Nali CLI is developed in Nodejs, and your environment must already have a Nodejs environment before installation.

Project address:

GitHub: https://github.com/sukkaw/nali-cli

Official website: https://nali.skk.moe/

Installation

If you have Node.js in your environment, you can install it directly through NPM and Yarn:

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

Nali CLI also has precompiled binaries for macOS x64 and Linux x64, which can be downloaded from the? bin directory in GitHub Repo.

The first time you run Nali CLI, it automatically downloads the required qqwry.dat to the $HOME/.config/nali-cli/ directory.

Common command line syntax

$nali-- help Usage: nali [options] Options:-- version version information-h,-- help output usage information Commands: parse parses IP information in stdin or parameters (default) update updates IP library help [cmd] display help for [cmd] $nali update-- help Usage: update [options] Update IP library (qqwry.dat) Options:-r -- remote gets the latest IP library version information-- f,-- force forcefully updates IP library-y,-- yes updates IP library directly-h,-- help output usage information

Use

Nali CLI supports parsing IP from the passed parameters:

$nali 11.4.5.14 11.4.5.14 [DoD Network Information Center, Columbus, Ohio, USA] $nali Cloudflare 1.0.0.1 1.1.1.1 Cloudflare 1.1.1.1 [APNIC&CloudFlare Public DNS Server] 1.0.0.1 [APNIC&CloudFlare Public DNS Server] $nali 114.514.191.9 114.1.4 114.514.191.8 114 .5.1.4 [Indonesia]

In addition, Nali CLI comes with the following common tools:

Nali-dig

Nali-nslookup

Nali-ping

Nali-tracepath

Nali-traceroute

Note that the above tools are only Wrapper, and you still need to install the original program when you use them. For example, to use nali-dig and nali-nslookup, you need to install Bind (dnsutils) first.

$nali-nslookup nali.skk.moe 1.1.1.1 Server: 1.1.1.1 [US APNIC&CloudFlare Public DNS Server] Address: 1.1.1.1 [US APNIC&CloudFlare Public DNS Server] # 53 Non-authoritative answer: Name: nali.skk.moe Address: 104.18.100.28 [CloudFlare CDN Node] Name: nali.skk.moe Address: 104.18.101 .28 [CloudFlare CDN Node] Name: nali.skk.moe Address: 2606 Name 4700 Name: nali.skk.moe Address: 2606 4700 Name: nali.skk.moe Address: 6606 4700 nali.skk.moe Address: 6606

Nali CLI also supports parsing and querying IP information from external stdin, so tools like mtr that are not wrapped by Nali CLI can also be used:

# here take dig as an example $dig nali.skk.moe @ 1.1.1.1 + short | nali 104.18.100.28 [CloudFlare CDN Node] 104.18.101.28 [CloudFlare CDN Node]

For mtr, etc., you can also create your own nali-mtr file and add it to PATH:

#! / bin/sh mtr $@ 2 > & 1 | nali

You can also register nali-mtr directly with .bashrc or .zshrc:

Nali-mtr () {mtr $@ 2 > & 1 | nali}

Nali CLI can also update qqwry.dat:

$nali upadte

Nali (Go version)

Nali (Go version) is improved on the Nodejs version of Sukka. It adds support for IPv6 and Geoip2 database on the basis of the original functions.

Project address:

GitHub: https://github.com/zu1k/nali

Supported Featur

Pure IPv4 offline database

ZX IPv6 offline database

Geoip2 City Database (optional)

IPIP database (optional)

CDN Service provider query

Support pipeline processing

Support for interactive query

Support for both IPv4 and IPv6

Query is completely offline

Full platform support

Installation

Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community

Install from source code

Nali requires pre-installation of Go. After installation, you can install the software from the source code:

$go get-u-v github.com/zu1k/nali

two。 Download precompiled executable programs (recommended)

Download the precompiled executable program directly from the Release page of the project. You only need to choose the version that suits your system and hardware architecture to download, decompress and run it directly.

Common command syntax

Nali-- help Usage: nali [flags] nali [command] Available Commands: cdn Query cdn service provider 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.

Use

It will take some time to use it for the first time, because you have to download the database related to innocence and CDN.

$nali 17:37:14 file on 2020-08-20 does not exist, try to get the latest innocent IP library from the network 17:37:32 on 2020-08-20 saved the latest innocent IP library locally: / Users/Mike/.nali/qqwry.dat 2020-08-20 17:37:32 file does not exist Try to get the latest ZX IPv6 database from the network 17:37:33 on 2020-08-20 saved the latest ZX IPv6 database locally: / Users/Mike/.nali/ipv6wry.db 2020-08-20 17:37:33 file does not exist, try to get the latest CDN database from the network 17:37:34 on 2020-08-20 saved the latest CDN database locally: / Users/Mike/.nali/cdn.json

Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community

Query the geographic information of an IP

$nali 1.2.3.4 1.2.3.4 [Australian APNIC Debogon-prefix Network] # or use the pipeline $echo IP 6.6.6.6 | nali IP 6.6.6.6 [U.S. Department of Defense Network Center in Fort Watchuca, Arizona, USA]

two。 Query the geographic information of multiple IP simultaneously

$nali 1.2.3.4 4.3.2.1 123.23.3.0 1.2.3.4 [Australian APNIC Debogon-prefix Network] 4.3.2.1 [Level3Communications, Newark, New Jersey, USA] 123.23.3.0 [Vietnam posts and Telecommunications Group]

3. Interactive query

Use exit or quit to exit the query.

$nali 123.23.23.23 123.23.23.23 [Vietnam posts and Telecommunications Group] 1.0.0.1 1.0.0.1 [APNIC&CloudFlare Public DNS Server] 8.8.8.8.8.8.8.8 [Google DNS Server in Mountain View, Santa Clara County, California] quit

4. Use with the dig command

You need to have the dig program installed on your system.

$dig nali.lgf.im + short | nali 104.28.2.115 [CloudFlare CDN node] 104.28.3.115 [CloudFlare CDN node] 172.67.135.48 [American CloudFlare node]

5. Use with the nslookup command

You need to have the nslookup program installed on your system. $nslookup nali.lgf.im 8.8.8.8 | nali Server: 8.8.8.8 [Google DNS Server in Mountain View, Santa Clara County, California] Address: 8.8.8.8 [Google DNS Server in Mountain View, Santa Clara County, California] # 53 Non-authoritative answer: Name: nali.lgf.im Address: 104.28.3 .115 [CloudFlare CDN node] Name: nali.lgf.im Address: 104.28.2.115 [CloudFlare CDN node] Name: nali.lgf.im Address: 172.67.135.48 [American CloudFlare node]

6. Used in conjunction with any program

Because nali supports pipeline processing, it can be used with any program.

$bash abc.sh | nali

Nali inserts IP geographic information after IP and CDN service provider information after CDN domain name.

7. Support for IPv6

The usage is exactly the same as IPv4. $nslookup google.com | nali Server: 127.0.0.53 [LAN IP] Address: 127.0.0.53 [LAN IP] # 53 Non-authoritative answer: Name: google.com Address: 216.58.211.110 [American Google Global Edge Network] Name: google.com Address: 2a00:1450:400e:809::200e [Holland Amsterdam Google Inc. Server network segment]

8. Query CDN service provider

Because CDN services usually use the domain name resolution method of CNAME, it is recommended to use it with nslookup or dig, which can be used separately after CNAME is known.

Query only CDN service providers

$nslookup www.gov.cn | nali cdn Server: 127.0.0.53 Address: 127.0.53 Non-authoritative answer: www.gov.cn canonical name = www.gov.cn.bsgslb.cn [Baishanyun CDN]. Www.gov.cn.bsgslb.cn [Baishan cloud CDN] canonical name = zgovweb.v.bsgslb.cn [Baishanyun CDN]. Name: zgovweb.v.bsgslb.cn [Baishanyun CDN] Address: 185.232.56.148 Name: zgovweb.v.bsgslb.cn [Baishanyun CDN] Address: 185.232.56.147 Name: zgovweb.v.bsgslb.cn [Baishanyun CDN] Address: 2001:428:6402:21b::6 Name: zgovweb.v.bsgslb.cn [Baishanyun CDN] Address: 2001:428:6402:21b::5

Query all information

$nslookup www.gov.cn | nali Server: 127.0.0.53 [LAN IP] Address: 127.0.0.53 [LAN IP] # 53 Non-authoritative answer: www.gov.cn canonical name = www.gov.cn.bsgslb.cn [Baishan Cloud CDN]. Www.gov.cn.bsgslb.cn [Baishan cloud CDN] canonical name = zgovweb.v.bsgslb.cn [Baishanyun CDN]. Name: zgovweb.v.bsgslb.cn [Baishanyun CDN] Address: 103.104.170.25 [Singapore] Name: zgovweb.v.bsgslb.cn [Baishanyun CDN] Address: 2001:428:6402:21b::5 [Louisiana State Monroe Qwest Communications Company, LLC (CenturyLink)] Name: zgovweb.v.bsgslb.cn [Baishanyun CDN] Address: 2001:428:6402:21b::6 [Louisiana State Monroe Qwest Communications Company, LLC (CenturyLink)]

Use alone

You need to query the CNAME domain name in advance.

$nali cdn cdn.somecdncname.com

Some skills to use

Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community

Update innocence database

Nali update is downloading the latest innocent IP library at 12:53:46 on 2020-07-17. 12:54:05 on 2020-07-17 saved the latest innocent IP library to your local / root/.nali/qqwry.dat

two。 Use custom IP libraries

Before using the custom IP library, you need to set the environment variable: NALI_DB. Currently supported variables are as follows:

Geoip2 ['geoip',' geoip2', 'geo'] Chunzhen [' chunzhen', 'qqip',' qqwry']

To use the three-party IP library, you need to download the corresponding IP database manually in advance.

# Windows platform # # using geoip database set NALI_DB=geoip # # using ipip database set NALI_DB=ipip # Linux platform # # using geoip database export NALI_DB=geoip # # using ipip database export NALI_DB=ipip thank you for reading! This is the end of this article on "how to use Nali in linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report