DNSanity:快速大规模验证DNS服务器
DNSanity: Quickly validate DNS servers at scale

原始链接: https://github.com/nil0x42/dnsanity

DNSanity 是一款快速可靠的 DNS 解析器验证工具,旨在快速精确地测试海量服务器列表。它提供了深度定制和并发功能,确保结果准确,同时避免被列入黑名单。 该工具分两个阶段运行:首先,它会针对 Google DNS 等可信解析器验证用户定义的模板,以确保其准确性;其次,它会根据此验证后的模板测试每个不可信的 DNS 服务器,并丢弃超过定义不匹配阈值的服务器。 主要功能包括:极速并行测试(包含全局和服务器级别速率限制)、灵活的自定义模板编写以及自动模板重新验证。DNSanity 支持多种 DNS 记录类型(A、CNAME、NXDOMAIN)和模式匹配。它还包括超时、重试以及调整可信服务器验证参数的选项。速率限制和尽早丢弃故障服务器的功能有助于避免服务器过载并最大限度地减少带宽使用。

Hacker News 最新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 DNSanity:快速大规模验证DNS服务器 (github.com/nil0x42) 18 分,来自 nil0x42,1 天前 | 隐藏 | 过去 | 收藏 | 讨论 考虑申请 Y Combinator 2025 夏季批次!申请截止日期为 5 月 13 日 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系我们 搜索:

原文



DNSanity is a fast DNS resolvers validator, offering deep customization and reliable concurrency.

If you want to validate massive lists with speed and precision, we have you covered !

  • Blazing-Fast: Test thousand servers in parallel, with global & per-server rate-limiting.
  • Flexible: Easily write your own template for custom validation.
  • Reliable: Automatic template re-validation before every usage.

Template Validation (step 1/2)
Make sure template is still valid, matching it against trusted servers.

Servers Sanitization (step 2/2)
For each server, every template test is checked. If mismatches exceed threshold, server is dropped. Undropped servers are considered valid.


go install github.com/nil0x42/dnsanity@latest   # go 1.22+ recommended
dnsanity --help                                 # show help
dnsanity -list "untrustedDNS.txt" -o "out.txt"  # basic usage

# <FQDN>             <EXPECTED-RESULT>                 <COMMENT>
cr.yp.to             A=131.193.32.108 A=131.193.32.109 # two specific A records
wiki.debian.org      A=* CNAME=wilder.debian.org.      # specific CNAME with any A record
dn05jq2u.fr          NXDOMAIN                          # invalid TLD: NXDOMAIN
dnssec-failed.org    SERVFAIL                          # valid TLD & no records: SERVFAIL
lists.isc.org        A=149.20.*                        # A record matching pattern
app-c0a801fb.nip.io  A=192.168.1.251                   # specific single A record
retro.localtest.me   A=127.0.0.1                       # specific single A record

A template test (line) defines what a domain must return when resolved by a DNS server. Create your template, and use it with dnsanity -template /path/to/template.txt

DNSanity aims for maximum speed without sacrificing reliability or risking blacklisting. Here’s the core approach:

  • Trusted Validation
    Before checking your untrusted servers, DNSanity verifies the template itself against trusted resolvers (e.g., 8.8.8.8, 1.1.1.1). This ensures your template is valid and consistent.
  • Test-by-Test Concurrency
    For each untrusted server, DNSanity runs tests sequentially in an efficient pipeline. Once a server accumulates more mismatches than -max-mismatches (default 0), it’s dropped immediately, saving time & bandwidth.
  • Per-Server Rate Limit
    Use -ratelimit so you don’t overload any single DNS server. This is especially helpful for fragile networks or for preventing blacklisting on public resolvers.
  • Timeout & Retries
    If a query doesn’t reply within -timeout seconds, it fails. If -max-attempts is greater than 1, DNSanity can retry, up to the specified limit.

  • Craft a Thorough Template
    A varied template (involving A, CNAME, NXDOMAIN, and wildcard matches) quickly exposes shady or broken resolvers.
  • Geo-Located Domains
    Beware that some domains (e.g., google.com) may return different IP addresses based on location. This might cause expected results to mismatch.
  • Fine-tune template validation step -trusted-* flags allow fine-tuning specific limits for this step, which uses trusted server list (use --help for details)

  • dnsvalidator – for the original concept of verifying DNS resolvers.
  • dnsx – inspiration for a fast, multi-purpose DNS toolkit.
  • miekg/dns – the Go library powering DNSanity queries under the hood.

Happy Recon & Hacking!

联系我们 contact @ memedata.com