dog is a command-line DNS client, like dig

Overview

dog

dog is a command-line DNS client.

Build status Say thanks!

A screenshot of dog making a DNS request


Dogs can look up!

dog is a command-line DNS client, like dig. It has colourful output, understands normal command-line argument syntax, supports the DNS-over-TLS and DNS-over-HTTPS protocols, and can emit JSON.

Examples

dog example.net                          Query a domain using default settings
dog example.net MX                       ...looking up MX records instead
dog example.net MX @1.1.1.1              ...using a specific nameserver instead
dog example.net MX @1.1.1.1 -T           ...using TCP rather than UDP
dog -q example.net -t MX -n 1.1.1.1 -T   As above, but using explicit arguments

Command-line options

Query options


   
                  Human-readable host names, nameservers, types, or classes
-q, --query=HOST         Host name or domain name to query
-t, --type=TYPE          Type of the DNS record being queried (A, MX, NS...)
-n, --nameserver=ADDR    Address of the nameserver to send packets to
--class=CLASS            Network class of the DNS record being queried (IN, CH, HS)

   

Sending options

--edns=SETTING           Whether to OPT in to EDNS (disable, hide, show)
--txid=NUMBER            Set the transaction ID to a specific value
-Z=TWEAKS                Set uncommon protocol-level tweaks

Protocol options

-U, --udp                Use the DNS protocol over UDP
-T, --tcp                Use the DNS protocol over TCP
-S, --tls                Use the DNS-over-TLS protocol
-H, --https              Use the DNS-over-HTTPS protocol

Output options

-1, --short              Short mode: display nothing but the first result
-J, --json               Display the output as JSON
--color, --colour=WHEN   When to colourise the output (always, automatic, never)
--seconds                Do not format durations, display them as seconds
--time                   Print how long the response took to arrive

Installation

To install dog, you can download a pre-compiled binary, or you can compile it from source. You may be able to install dog using your OS’s package manager, depending on your platform.

Packages

  • For Arch Linux, install the dog package.
  • For Homebrew on macOS, install the dog formula.
  • For NixOS, install the dogdns package.

Downloads

Binary downloads of dog are available from the releases section on GitHub for 64-bit Windows, macOS, and Linux targets. They contain the compiled executable, the manual page, and shell completions.

Compilation

dog is written in Rust. You will need rustc version 1.45.0 or higher. The recommended way to install Rust for development is from the official download page, using rustup.

To build, download the source code and run:

$ cargo build
$ cargo test
  • The just command runner can be used to run some helpful development commands, in a manner similar to make. Run just --list to get an overview of what’s available.

  • If you are compiling a copy for yourself, be sure to run cargo build --release or just build-release to benefit from release-mode optimisations. Copy the resulting binary, which will be in the target/release directory, into a folder in your $PATH. /usr/local/bin is usually a good choice.

  • To compile and install the manual pages, you will need pandoc. The just man command will compile the Markdown into manual pages, which it will place in the target/man directory. To use them, copy them into a directory that man will read. /usr/local/share/man is usually a good choice.

Container image

To build the container image of dog, you can use Docker or Kaniko. Here an example using Docker:

$ docker build -t dog .

You can then run it using the following command:

$ docker run -it --rm dog

To run dog directly, you can then define the following alias:

$ alias dog="docker run -it --rm dog"

End-to-end testing

dog has an integration test suite written as Specsheet check documents. If you have a copy installed, you can run:

$ just xtests

Specsheet will test the compiled binary by making DNS requests over the network, checking that dog returns the correct results and does not crash. Note that this will expose your IP address. For more information, read the xtests README.

Feature toggles

dog has three Cargo features that can be switched off to remove functionality. While doing so makes dog less useful, it results in a smaller binary that takes less time to build.

There are three feature toggles available, all of which are active by default:

  • with_idna, which enables IDNA processing
  • with_tls, which enables DNS-over-TLS
  • with_https, which enables DNS-over-HTTPS (requires with_tls)

Use cargo to build a binary that uses feature toggles. For example, to disable TLS and HTTPS support but keep IDNA support enabled, you can run:

$ cargo build --no-default-features --features=with_idna

The list of features that have been disabled can be checked at runtime as part of the --version string.


Documentation

For documentation on how to use dog, see the website: https://dns.lookup.dog/

See also

mutt, tail, sleep, roff

Licence

dog’s source code is licenced under the European Union Public Licence.

Comments
  • Consider changing default set of records

    Consider changing default set of records

    I really like this tool! However, one convenience feature that I'm missing is "Just show me commonly useful information about this domain". I know that with dig and drill you can use ANY but that's not quite what I want in most cases. Frankly, I'd be happy about ALL or --all or something like that which showed the equivalent of dog example.net A AAAA NS MX TXT SOA CNAME. Personally, I'd even like that by default.

    For instance, nowadays you at least have A and AAAA entries and dog by default only shows A which I don't think is very "modern" as a default. I know that other tools have the same default but in my understanding, dog is supposed to be convenient, too.

    opened by svenstaro 8
  • Always getting connection refused, no matter what I query

    Always getting connection refused, no matter what I query

    On my system, no matter what I query, I always get:

    dog example.net
    Error [network]: Connection refused (os error 111)
    
    dog google.com
    Error [network]: Connection refused (os error 111)
    
    $ dog --version 
    dog ● command-line DNS client
    v0.1.0
    https://dns.lookup.dog/
    

    I'm on Arch Linux. My network is actually fairly simple. I use systemd-resolved for my usual DNS. drill and dig are perfectly happy performing the queries.

    $ resolvectl
    Global
           LLMNR setting: yes                 
    MulticastDNS setting: yes                 
      DNSOverTLS setting: no                  
          DNSSEC setting: no                  
        DNSSEC supported: no                  
      Current DNS Server: 127.0.0.1           
             DNS Servers: 127.0.0.1           
    Fallback DNS Servers: 1.1.1.1             
                          9.9.9.10            
                          8.8.8.8             
                          2606:4700:4700::1111
                          2620:fe::10         
                          2001:4860:4860::8888
    
    Link 2 (enp67s0)
          Current Scopes: none
    DefaultRoute setting: no  
           LLMNR setting: yes 
    MulticastDNS setting: no  
      DNSOverTLS setting: no  
          DNSSEC setting: no  
        DNSSEC supported: no  
    
    Link 3 (br0)
          Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
    DefaultRoute setting: yes                      
           LLMNR setting: yes                      
    MulticastDNS setting: no                       
      DNSOverTLS setting: no                       
          DNSSEC setting: no                       
        DNSSEC supported: no                       
      Current DNS Server: 10.13.37.1               
             DNS Servers: 10.13.37.1               
                          fd00::3681:c4ff:fee4:7801
    
    Link 4 (docker0)
          Current Scopes: none
    DefaultRoute setting: no  
           LLMNR setting: yes 
    MulticastDNS setting: no  
      DNSOverTLS setting: no  
          DNSSEC setting: no  
        DNSSEC supported: no  
    
    Link 5 (br-b1c82fd2937d)
          Current Scopes: none
    DefaultRoute setting: no  
           LLMNR setting: yes 
    MulticastDNS setting: no  
      DNSOverTLS setting: no  
          DNSSEC setting: no  
        DNSSEC supported: no  
    
    opened by svenstaro 8
  • [Windows] Prints ANSI codes instead of colored text

    [Windows] Prints ANSI codes instead of colored text

    • dog version: 0.1.0 (Downloaded prebuilt binary from https://github.com/ogham/dog/releases/tag/v0.1.0 )
    • OS: Windows 10 (Microsoft Windows [Version 10.0.19042.572])

    Maybe need to call enable_ansi_support function somewhere...?

    image

    opened by gaeulbyul 5
  • installing via homebrew on ubuntu 20.04 fails

    installing via homebrew on ubuntu 20.04 fails

    Not sure if this is something that you might fix or if this is an issue with homebrew somehow, but trying to install dog via homebrew: brew install dog on ubuntu 20.04, getting this error:

    ==> Downloading https://github.com/ogham/dog/archive/v0.1.0.tar.gz
    Already downloaded: /home/pavel/.cache/Homebrew/downloads/e9869860b4b74bd1955a7e4be363a6bbd20d683ca8b4cf4942938e6567865c15--dog-0.1.0.tar.gz
    ==> cargo install
    Last 15 lines from /home/pavel/.cache/Homebrew/Logs/dog/01.cargo:
      If you're in a situation where you think the directory *should* be found
      automatically, please open a bug at https://github.com/sfackler/rust-openssl
      and include information about your system as well as this message.
    
      $HOST = x86_64-unknown-linux-gnu
      $TARGET = x86_64-unknown-linux-gnu
      openssl-sys = 0.9.58
    
      ', /home/pavel/.cache/Homebrew/cargo_cache/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.58/build/find_normal.rs:157:5
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    warning: build failed, waiting for other jobs to finish...
    error: failed to compile `dog v0.1.0 (/tmp/dog-20201110-1700102-b2dqt0/dog-0.1.0)`, intermediate artifacts can be found at `/tmp/dog-20201110-1700102-b2dqt0/dog-0.1.0/target`
    
    Caused by:
      build failed
    
    READ THIS: https://docs.brew.sh/Troubleshooting
    
    opened by sagor999 4
  • Support querying unknown types

    Support querying unknown types

    Cool project!

    It would be great if the --type parameter enabled the user to query types that dog doesn't know about.

    RFC3597 section 5 describes a conventional text representation for unknown (and optionally known) RR types:

       In the "type" field of a master file line, an unknown RR type is
       represented by the word "TYPE" immediately followed by the decimal RR
       type number, with no intervening whitespace.
    

    For example, --type=TYPE28 would be equivalent to --type=AAAA.

    I'd contribute a patch, but unfortunately my hands are tied due to the license.

    opened by dmcardle 3
  • Homebrew formula

    Homebrew formula

    Hi @ogham 👋

    Thanks for building this neat utility. 👍

    I've created a Homebrew formula for dog but until it passes 75 stars it can't be submitted to the default formulae. Once that happens feel free to ping me or submit my work directly. In the meantime, you can test it using the following command:

    brew install vladimyr/vladimyr/dog
    

    Formula source → https://github.com/vladimyr/homebrew-vladimyr/blob/aa8e7e1/Formula/dog.rb

    opened by vladimyr 3
  • Allow _ in domain names

    Allow _ in domain names

    While using dog locally to check some specific DKIM records, I realised that the _ was not recognised as a valid character in a domain name.

    $ dog default._domainkey.barrobes.com TXT
    dog: Invalid options: Invalid domain "default._domainkey.barrobes.com"
    

    After the change:

    $ cargo run -q default._domainkey.barrobes.com TXT
    TXT default._domainkey.barrobes.com. 1h53m30s   "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwOHVlAPSLPIbBSuXThuNq+d4OXI9A3Gln10RRN1c5ZIyrXkPReqAuBVp+/IFXHJdyCXPCmF/aAfs1Iiu3oXzVSPIOZIpVEfEIBazs2RHvnWFCJWom+O6tbWRmKAyacVZQfEhrdA8LPzCjSEXRs4wUClyQuOvDU1qOik5CAbsTYcL60eahdId+xiZFlDfrFf/OIdsR/diX91ur3hUBbO4H7Iue3DXBqgmAIvmi57DibqTbwOz+UXF7Bqoxe0pFlljQi18UV9Ck7mASq7qDAmMqQwqMJ24XPvKCiw2KLBWOrSqBXzzBinZTS/9WlkDFXcBH1ewyIpWixQeXcZjq7oMQwIDAQAB;"
    

    It still works with IDNA domains:

    $ cargo run -q österreich.icom.museum
    CNAME xn--sterreich-z7a.icom.museum. 9m29s   "redirections.icom.museum."
        A redirections.icom.museum.      9m29s   81.201.190.55
    $ cargo run -q беларусь.icom.museum
    CNAME xn--80abmy0agn7e.icom.museum. 10m00s   "redirections.icom.museum."
        A redirections.icom.museum.      9m59s   81.201.190.55
    

    Possibly this fix is not the right/full solution, but it's a way to keep the ball rolling. I didn't want to have a separate build of dog disabling IDNA just for this purpose (that might have done it). I think it should be possible to support IDNA and still allow for underscores.

    Open to any suggestions, and happy to add tests.

    opened by txels 2
  • Allow different tls implementations with cargo features

    Allow different tls implementations with cargo features

    This is a first try to fix #53 and #21

    It uses different features to allow the user to choose a tls implementation. For example, all of the following work:

    cargo build # Will use with_tls+with_https using nativetls
    
    cargo build --all-features # Will compile with with_tls+with_https+with_nativetls+withrustls but it will use nativetls
    
    cargo build --no-default-features --features with_tls,with_https,with_rustls # will use rustls
    
    cargo build --no-default-features --features with_tls,with_https,with_nativetls_vendored # will use nativetls_vendored
    

    When using rustls or nativetls_vendored, we can compile dog using musl:

    cargo build --target x86_64-unknown-linux-musl --no-default-features --features with_tls,with_https,with_nativetls_vendored
    

    --features with_tls,with_rustls is supported currently, but maybe we should not support this combination at the moment, because of https://github.com/ctz/rustls/issues/281 https://github.com/briansmith/webpki/issues/54 https://github.com/ctz/rustls/issues/184 This means for this to work you'd have to use a valid dns name as a dns server:

    $ cargo run --no-default-features --features with_tls,with_rustls -- github.com -S @one.one.one.one
    A github.com. 47s   140.82.121.4
    

    With an ip address for dns server:

    $ cargo run --no-default-features --features with_tls,with_rustls -- github.com -S @1.1.1.1
    Error [tls]: InvalidDNSNameError
    

    But it works with nativetls:

    $ cargo run --no-default-features --features with_tls,with_nativetls_vendored -- github.com -S @1.1.1.1
    A github.com. 30s   140.82.121.3
    

    DNS over HTTPS works with rustls though:

    $ cargo run --no-default-features --features with_https,with_rustls -- github.com -H @https://cloudflare-dns.com/dns-query
    A github.com. 50s   140.82.121.3
    

    --all-features is supported as per https://doc.rust-lang.org/cargo/reference/features.html#mutually-exclusive-features To not complicate builds etc.

    opened by simao 2
  • Error [protocol]: Malformed packet when querying TXT records

    Error [protocol]: Malformed packet when querying TXT records

    dog v0.1.0 Windows 10 2004

    When quering some domains for TXT records, dog only responds with Malformed packet:

    dog gp.se TXT
    Error [protocol]: Malformed packet: length 351 was specified, but read 7 bytes
    
    dog svt.se TXT
    Error [protocol]: Malformed packet: length 301 was specified, but read 237 bytes
    
    dog kungalv.se TXT
    Error [protocol]: Malformed packet: length 378 was specified, but read 172 bytes
    
    dog kungalv.se TXT @1.1.1.1
    Error [protocol]: Malformed packet: length 378 was specified, but read 172 bytes
    
    dog kungalv.se TXT @8.8.8.8
    Error [protocol]: Malformed packet: length 378 was specified, but read 172 bytes
    

    Although most other domains I've tested works fine, for example

    dog one.se TXT
    TXT one.se. 30m00s   "v=spf1 redirect=_spf.one.se"
    

    and other types of records seems to be no issue:

    dog kungalv.se MX
    MX kungalv.se.                             59m51s   10 "kungalv-se.mail.protection.outlook.com."
     A kungalv-se.mail.protection.outlook.com.     1s + 104.47.0.36
     A kungalv-se.mail.protection.outlook.com.     1s + 104.47.1.36
    
    X › duplicate 
    opened by tjoanp 2
  • Add CLI option to increase output verbosity

    Add CLI option to increase output verbosity

    This change will add a CLI option -v to increase output verbosity which can be used as an alternative to providing the DOG_DEBUG environment variable. You can specify one or more flags to increase the logging level:

    Eg.

    dog -v google.com    # Debug level
    dog -vv google.com   # Trace level
    

    The previous short flag for version was moved to -V leaving the long flag --version as-is.

    The usage looks like this:

      -V, --version            Print version information
      -v                       Increase verbosity by adding multiple (-vv)
    

    The cli arguments will override the DOG_DEBUG environment variable.

    opened by veloxl 2
  • Separate result between nameserver

    Separate result between nameserver

    I have a python script called digs that do multiple dig on specified nameservers.

    Today I am trying dog, and I love its ability to accept multiple nameservers.

    ~
    ❯ dog example.com MX -n 1.1.1.1 -n 8.8.8.8
    MX example.com.  23h57m48s   0 ""
    MX example.com. 1d0h00m00s   0 ""
    

    However I can't point which is wich. What if dog have a separator between them if we supply multiple nameservers ?

    ~
    ❯ dog example.com MX -n 1.1.1.1 -n 8.8.8.8 -n x.x.x.x
    [1.1.1.1]
    MX example.com.  23h57m48s   0 ""
    [8.8.8.8]
    MX example.com. 1d0h00m00s   0 ""
    [x.x.x.x]
    MX example.com. 1d0h00m00s   0 ""
    

    My current workaround is to use JSON output and filter the result:

    dog on  master is 📦 v0.1.0 via 🦀 v1.48.0
    ❯ cargo r --  example.com MX -n 1.1.1.1 -n 8.8.8.8 -J |  jq .responses[0].answers[0]
        Finished dev [unoptimized + debuginfo] target(s) in 0.02s
         Running `target/debug/dog example.com MX -n 1.1.1.1 -n 8.8.8.8 -J`
    {
      "class": "IN",
      "exchange": "",
      "name": "example.com.",
      "preference": 0,
      "ttl": 86126,
      "type": "MX"
    }
    
    dog on  master is 📦 v0.1.0 via 🦀 v1.48.0
    ❯ cargo r --  example.com MX -n 1.1.1.1 -n 8.8.8.8 -J |  jq .responses[1].answers[0]
        Finished dev [unoptimized + debuginfo] target(s) in 0.03s
         Running `target/debug/dog example.com MX -n 1.1.1.1 -n 8.8.8.8 -J`
    {
      "class": "IN",
      "exchange": "",
      "name": "example.com.",
      "preference": 0,
      "ttl": 86252,
      "type": "MX"
    }
    
    opened by azzamsa 2
  • Can dog support ARM linux?

    Can dog support ARM linux?

    Hello: We have some embedded device need test dns use dog, But our device can only run ARM linux(Openwrt arm aarch64),Would you like to add ARM binary to release list? Thank you.

    opened by missyoyo 1
  • Trim nameserver line in resolv.conf before parsing

    Trim nameserver line in resolv.conf before parsing

    Currently, a line like this in /etc/resolv.conf will cause the name server to not be picked up:

    nameserver    1.1.1.1
    

    Trimming the string before parsing fixes that.


    P.s. it is worth discussing whether this is a valid configuration at all. (I.e. is multiple spaces actually allowed?)

    So I took a look at the man page, and only found this small paragraph addressing the format:

    The keyword and value must appear on a single line, and the keyword (e.g., nameserver) must start the line. The value follows the keyword, separated by white space.

    Yeah... The description is very ambiguous - it didn't say either "a white space" or "one or more white spaces". On the other hand, dig seems to be okay with multiple white spaces, so I think it's best to be defensive and trim first. There's no real downsides so why not.

    opened by cyqsimon 0
  • Update Cargo dependencies

    Update Cargo dependencies

    our openssl-sys package is too old to support systems with openssl 3.0, running cargo update fixes that issue and is still compatible with older versions.

    Also checked tests pass and used dog a bit with no issue.

    Fixes: #98

    opened by martinetd 0
  • Error when attempting to run

    Error when attempting to run

    I downloaded dog-v0.1.0-x86_64-unknown-linux-gnu.zip to my Ubuntu 22.04 release, and I got this error

    support@Network-VM /t/completions> dog
    dog: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
    

    Looking for libssl I found:

    support@Network-VM /t/completions [124]> bash
    support@Network-VM:/tmp/completions$ sudo dpkg -l |grep libssl*
    ii  libss2:amd64                               1.46.5-2ubuntu1.1                       amd64        command-line interface parsing library
    ii  libssh-4:amd64                             0.9.6-2build1                           amd64        tiny C SSH library (OpenSSL flavor)
    ii  libssl3:amd64                              3.0.2-0ubuntu1.6                        amd64        Secure Sockets Layer toolkit - shared libraries
    

    Looks like It needs to be perhaps installed, or there is a dependency issue

    How do I install the correct ssl stuff, and could you please update your readme, thanks

    opened by StewAlexander-com 2
Releases(v0.1.0)
Command-line HTTP client for sending a POST request to specified URI on each stdin line.

line2httppost Simple tool to read lines from stdin and post each line as separate POST request to a specified URL (TCP connection is reused though). G

Vitaly Shukela 3 Jan 3, 2023
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
Low-level Rust library for implementing terminal command line interface, like in embedded systems.

Terminal CLI Need to build an interactive command prompt, with commands, properties and with full autocomplete? This is for you. Example, output only

HashMismatch 47 Nov 25, 2022
A command-line shell like fish, but POSIX compatible.

A command-line shell like fish, but POSIX compatible.

Seiya Nuta 813 Dec 29, 2022
A simple command line tool for creating font palettes for engines like libtcod

palscii A simple command line tool for creating font palettes for engines like libtcod. Usage This can also be viewed by running palscii --help. palsc

Steve Troetti 2 May 2, 2022
rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and much more.

rpsc rpsc is a *nix command line tool to quickly search for file systems items matching varied criterions like permissions, extended attributes and mu

null 3 Dec 15, 2022
nhdl - a command-line doujinshi downloader client built in rust!

nhdl nhdl - a command-line doujinshi downloader client built in rust! goals fast and asynchronous doujinshi downloader, supporting various doujinshi s

Lumine 2 Dec 23, 2022
Another HackerNews command-line client

Another HackerNews command-line client

Sébastien Castiel 22 Dec 12, 2021
Non-interactive nREPL client for shell scripts and command-line

nreplops-tool (nr) nreplops-tool (nr) is a non-interactive nREPL client designed to be used in shell scripts and on the command-line. Early α warning:

Matti Hänninen 3 Jul 1, 2022
BingGPT command line client, written in rust.

BingGPT BingGPT command line client, written in rust 中文说明 This project is a rust language implementation of EdgeGPT, all the hard stuff was done by th

null 16 Mar 19, 2023
Pink is a command-line tool inspired by the Unix man command.

Pink is a command-line tool inspired by the Unix man command. It displays custom-formatted text pages in the terminal using a subset of HTML-like tags.

null 3 Nov 2, 2023
REC2 (Rusty External Command and Control) is client and server tool allowing auditor to execute command from VirusTotal and Mastodon APIs written in Rust. 🦀

Information: REC2 is an old personal project (early 2023) that I didn't continue development on. It's part of a list of projects that helped me to lea

Quentin Texier (g0h4n) 104 Oct 7, 2023
A CLI app to set and organize your favorite DNS servers.

rdns A CLI app to set and organize your favorite DNS servers. Introduction rdns is a CLI utility that can set your system DNS, either directly or by m

null 4 Feb 19, 2024
A bit like tee, a bit like script, but all with a fake tty. Lets you remote control and watch a process

teetty teetty is a wrapper binary to execute a command in a pty while providing remote control facilities. This allows logging the stdout of a process

Armin Ronacher 259 Jan 3, 2023
A simple API client (postman like) in your terminal

ATAC ⚔?? Table Of Contents Description How to use Binary Compile by yourself Features Current TODO v1.0.0 TODO v2.0.0 Documentation Technical precisio

Julien C. 5 Feb 29, 2024
Checkline: checkbox line picker for stdin line input

checkline is a Unix command line interface (CLI) terminal user interface (TUI) that prompts you to check each line of stdin, to pick each line to output to stdout

SixArm 4 Dec 4, 2022
Provides a mock Ambi client that emulates real sensor hardware such as an Edge client

ambi_mock_client Provides a mock Ambi client that emulates real sensor hardware such as an Edge client. Usage You must have Rust installed to build am

Rust Never Sleeps 2 Apr 1, 2022
A full featured, fast Command Line Argument Parser for Rust

clap Command Line Argument Parser for Rust It is a simple-to-use, efficient, and full-featured library for parsing command line arguments and subcomma

null 10.4k Jan 10, 2023