TOC

Doggo DNS 工具

  • https://github.com/mr-karan/doggo
  • https://doggo.mrkaran.dev/docs/

安装

$ go install github.com/mr-karan/doggo/cmd/doggo@latest
$ doggo
NAME:
  doggo 🐶 DNS Client for Humans

USAGE:
  doggo [--] [query options] [arguments...]

VERSION:
  unknown - unknown

EXAMPLES:
  doggo mrkaran.dev                             Query a domain using defaults.
  doggo mrkaran.dev CNAME                       Query for a CNAME record.
  doggo mrkaran.dev MX @9.9.9.9                 Uses a custom DNS resolver.
  doggo -q mrkaran.dev -t MX -n 1.1.1.1         Using named arguments.
  doggo mrkaran.dev --aa --ad                   Query with Authoritative Answer and Authenticated Data flags set.
  doggo mrkaran.dev --cd --do                   Query with Checking Disabled and DNSSEC OK flags set.
  doggo mrkaran.dev --gp-from Germany           Query using Globalping API from a specific location.

FREE FORM ARGUMENTS:
  Supply hostnames, query types, and classes without flags. Example:
  doggo mrkaran.dev A @1.1.1.1

TRANSPORT OPTIONS:
  Specify the protocol with a URL-type scheme.
  UDP is used if no scheme is specified.
  @udp://     eg: @1.1.1.1                                                        initiates a UDP query to 1.1.1.1:53.
  @tcp://     eg: @tcp://1.1.1.1                                                  initiates a TCP query to 1.1.1.1:53.
  @https://   eg: @https://cloudflare-dns.com/dns-query                           initiates a DOH query to Cloudflare via DoH.
  @tls://     eg: @tls://1.1.1.1                                                  initiates a DoT query to 1.1.1.1:853.
  @sdns://    initiates a DNSCrypt or DoH query using a DNS stamp.
  @quic://    initiates a DOQ query.

SUBCOMMANDS:
  completions [bash|zsh|fish]   Generate the shell completion script for the specified shell.

QUERY OPTIONS:
  -q, --query=HOSTNAME          Hostname to query the DNS records for (eg mrkaran.dev).
  -t, --type=TYPE               Type of the DNS Record (A, MX, NS etc).
  -n, --nameserver=ADDR         Address of a specific nameserver to send queries to (9.9.9.9, 8.8.8.8 etc).
  -c, --class=CLASS             Network class of the DNS record (IN, CH, HS etc).
  -x, --reverse                 Performs a DNS Lookup for an IPv4 or IPv6 address. Sets the query type and class to PTR and IN respectively.
  --any                         Query all supported DNS record types (A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, TXT, CAA).

RESOLVER OPTIONS:
  --strategy=STRATEGY           Specify strategy to query nameserver listed in etc/resolv.conf. (all, random, first).
  --ndots=INT                   Specify ndots parameter. Takes value from /etc/resolv.conf if using the system namesever or 1 otherwise.
  --search                      Use the search list defined in resolv.conf. Defaults to true. Set --search=false to disable search list.
  --timeout=DURATION            Specify timeout for the resolver to return a response (e.g., 5s, 400ms, 1m).
  -4, --ipv4                    Use IPv4 only.
  -6, --ipv6                    Use IPv6 only.
  --tls-hostname=HOSTNAME       Provide a hostname for verification of the certificate if the provided DoT nameserver is an IP.
  --skip-hostname-verification  Skip TLS Hostname Verification in case of DOT Lookups.

QUERY FLAGS:
  --aa                          Set Authoritative Answer flag.
  --ad                          Set Authenticated Data flag.
  --cd                          Set Checking Disabled flag.
  --rd                          Set Recursion Desired flag (default: true).
  --z                           Set Z flag (reserved for future use).
  --do                          Set DNSSEC OK flag.

OUTPUT OPTIONS:
  -J, --json                    Format the output as JSON.
  --short                       Short output format. Shows only the response section.
  --color                       Defaults to true. Set --color=false to disable colored output.
  --debug                       Enable debug logging.
  --time                        Shows how long the response took from the server.

GLOBALPING OPTIONS:
  --gp-from=Germany             Query using Globalping API from a specific location.
  --gp-limit=INT                Limit the number of probes to use from Globalping.

DNS 查询

$ doggo sendcloud.net a @223.5.5.5
NAME            TYPE    CLASS   TTL     ADDRESS         NAMESERVER
sendcloud.net.  A       IN      60s     106.75.106.173  223.5.5.5:53
sendcloud.net.  A       IN      60s     106.75.106.166  223.5.5.5:53

$ doggo sendcloud.net a @223.5.5.5 --json
{
  "responses": [
    {
      "answers": [
        {
          "name": "sendcloud.net.",
          "type": "A",
          "class": "IN",
          "ttl": "60s",
          "address": "106.75.106.173",
          "status": "",
          "rtt": "67ms",
          "nameserver": "223.5.5.5:53"
        },
        {
          "name": "sendcloud.net.",
          "type": "A",
          "class": "IN",
          "ttl": "60s",
          "address": "106.75.106.166",
          "status": "",
          "rtt": "67ms",
          "nameserver": "223.5.5.5:53"
        }
      ],
      "authorities": null,
      "questions": [
        {
          "name": "sendcloud.net.",
          "type": "A",
          "class": "IN"
        }
      ]
    }
  ]
}

$ doggo sendcloud.net a @223.5.5.5 --json | jq ".responses[].answers[].address"
"106.75.106.166"
"106.75.106.173"

查反解

$ doggo --reverse 101.44.172.1 @223.5.5.5
NAME                            TYPE    CLASS   TTL     ADDRESS                         NAMESERVER
1.172.44.101.in-addr.arpa.      PTR     IN      300s    hwsg1c1.email.engagelab.com.    223.5.5.5:53

$ doggo hwsg1c1.email.engagelab.com. a @223.5.5.5
NAME                            TYPE    CLASS   TTL     ADDRESS         NAMESERVER
hwsg1c1.email.engagelab.com.    A       IN      600s    101.44.172.1    223.5.5.5:53

Global Ping

$ doggo markjour.com --gp-from Germany,Japan --gp-limit 2
LOCATION                        NAME            TYPE    CLASS   TTL     ADDRESS         NAMESERVER
Falkenstein, DE, EU, Hetzner
Online GmbH (AS24940)
                                markjour.com.   A       IN      600s    121.42.82.115   private
Osaka, JP, AS, Oracle
Corporation (AS31898)
                                markjour.com.   A       IN      600s    121.42.82.115   8.8.8.8
如果你有魔法,你可以看到一个评论框~