Skip to content
项目

关于

CLI tool for querying DNS records with readable, colored output.

系统与基础设施

这些数字如何统计

可以做什么

  • Supports all DNS record types
  • DNSSEC support, including chain-of-trust validation
  • Reverse lookups and delegation tracing from the root nameservers
  • Colorized and tabular output for easy reading

实测星标增长

24小时
0
7天
+1
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

zns

zns is a command-line utility for querying DNS records, displaying them in a human-readable, colored format that includes type, name, TTL, and value.

Features

  • Supports all DNS record types
  • DNSSEC support, including chain-of-trust validation
  • Reverse lookups and delegation tracing from the root nameservers
  • Colorized and tabular output for easy reading
  • Concurrent queries for improved performance
  • JSON output format for machine-readable results
  • Option to write output to a file
  • Option to query a specific DNS server

Installing

Homebrew

brew install zns

MacPorts

port install zns

FreeBSD

pkg install zns

Usage

$ zns google.com
A       google.com.   01m35s   142.250.180.14
AAAA    google.com.   02m35s   2a00:1450:400e:808::200e
CAA     google.com.   05m07s   0 issue pki.goog
HTTPS   google.com.   50m03s   1 . alpn="h2,h3"
MX      google.com.   01m47s   10 smtp.google.com.
NS      google.com.   50m03s   ns1.google.com.
NS      google.com.   50m03s   ns2.google.com.
SOA     google.com.   01m00s   ns1.google.com. dns-admin.google.com.
TXT     google.com.   49s      v=spf1 include:_spf.google.com ~all
TXT     google.com.   49s      google-site-verification=wD8N7i1JTNTkezJ49swvWW48f8_9xveREV4oB-0Hf5o
...

Query a specific record type

Any DNS record type can be queried, e.g. -q NS, -q CAA, -q DNSKEY, or -q HTTPS.

$ zns google.com -q HTTPS
HTTPS   google.com.   50m03s   1 . alpn="h2,h3"

Query multiple record types

Types can be passed as bare arguments, comma-separated, or by repeating the flag. Results render in the requested order.

$ zns google.com CAA HTTPS
CAA     google.com.   05m07s   0 issue pki.goog
HTTPS   google.com.   50m02s   1 . alpn="h2,h3"

Reverse lookup

An address is looked up in reverse, through its .arpa name.

$ zns 1.1.1.1
PTR   1.1.1.1.in-addr.arpa.   01m08s   one.one.one.one.

Trace the delegation

--trace resolves the name iteratively from the root nameservers, printing the nameservers of every zone along the way and finally the answer.

$ zns google.com --trace

DNSSEC

--dnssec requests DNSSEC records (sets the DO bit), returning RRSIGs alongside the answers. --dnssec-validate additionally validates every record against the DNSSEC chain of trust — RRSIG, DNSKEY, and DS records up to the IANA root trust anchors — and reports a per-record status: secure, insecure, bogus, or unknown when the chain could not be retrieved.

$ zns cloudflare.com -q SOA --dnssec
SOA     cloudflare.com.   04m59s   ns3.cloudflare.com. dns.cloudflare.com.
RRSIG   cloudflare.com.   04m59s   SOA 13 2 300 20260728220715 20260726200715 34505 cloudflare.com. 6+sA0dU1MBiTcMAq+rcpOWQhQWGCLqCuiuDtCp+ddk+t/IJvf7D7eiBjFhZvKAzGJq53SgU9LZ5jKbFqZa3B9Q==

These examples use cloudflare.com because google.com is not DNSSEC-signed, which is exactly what the second command below shows.

$ zns cloudflare.com -q A --dnssec-validate
A       cloudflare.com.   02m08s   secure   104.16.133.229
A       cloudflare.com.   02m08s   secure   104.16.132.229

$ zns google.com -q A --dnssec-validate
A   google.com.   04m12s   insecure   216.58.198.46

Use a specific DNS server

$ zns google.com -q NS --server 1.1.1.1
NS   google.com.   50m03s   ns1.google.com.
NS   google.com.   50m03s   ns2.google.com.

JSON output

$ zns google.com --json -q A | jq
{
  "domain": "google.com",
  "level": "info",
  "message": "Successful query",
  "record": "142.250.180.14",
  "timestamp": "2026-07-27T22:03:32.246721+02:00",
  "ttl": "01m35s",
  "type": "A",
  "version": "dev",
  "view": "json"
}

Values only

--short prints just the record values, for piping into other commands.

$ zns google.com -q A --short
142.251.209.238

zns exits non-zero when a query fails or the domain does not exist, so failures can be acted on in scripts.

Writing to a file

export ZNS_LOG_FILE=/tmp/zns.log
$ zns google.com

Contributing

Contributions are highly appreciated and always welcome. Have a look through existing Issues and Pull Requests that you could help with.

License

This project is licensed under the MIT License. You are free to use, modify, and distribute the software, provided that you include the original license in any copies of the software. See the LICENSE file for more details.

探索相关项目

加载中…