13 releases (stable)
2.0.0 | Sep 18, 2022 |
---|---|
1.3.0 | Feb 18, 2022 |
1.2.3 | Jan 31, 2022 |
1.2.1 | Nov 17, 2021 |
0.1.0 | Nov 29, 2020 |
#1349 in Command line utilities
42 downloads per month
270KB
5K
SLoC
toluol
toluol
is a command line tool for making DNS queries intended to replace dig
. It can be used for
all sort of DNS queries, including:
- Regular DNS queries
- Queries for DNSSEC records with the
+do
flag - DNS over TLS (DoT) with the
dot
/+tls
flag - DNS over HTTPS (DoH) with the
+doh
/+https
flag - DNS over HTTP (DoH but without TLS, great for locally debugging DoH) with the
+http
flag - Reverse lookups with the
-x
option
Other useful features include:
- short, readable output by default — verbose output by choice
- IPv6 by default
- script friendly options:
- JSON output (e.g. for use with
jq(1)
, see examples below) - unpadded output (e.g. for use with
cut(1)
, see examples below)
- JSON output (e.g. for use with
This repository consists of a library crate for creating, encoding and parsing DNS messages and a binary crate for making DNS queries from the command-line.
For example usage of most of the library capabilities have a look at the code of the binary
(src/main.rs
).
Installation
Arch Linux (AUR)
yay -S toluol
Via cargo install
cargo install toluol
Shoutout to cargo-update
— after
installing toluol
as above, you can update it via cargo install-update toluol
, if you have
cargo-update
installed (or run cargo install-update -a
to update all packages installed via
cargo install
).
Examples
AAAA query:
# the query type is not case-sensitive and order of the arguments does not matter, so `toluol example.com aaaa` would also work
# also, AAAA is the default query type, so in this case just `toluol example.com` would work as well
$ toluol AAAA example.com
example.com. 30283 AAAA 2606:2800:220:1:248:1893:25c8:1946
response from ordns.he.net:53 in 23 ms
DNS over TLS (DoT) query with sepcified nameserver:
# or `toluol @dns.google AAAA example.com +tls`
$ toluol @dns.google AAAA example.com +dot
example.com. 86400 AAAA 2606:2800:220:1:248:1893:25c8:1946
response from dns.google:853 in 35 ms
Query with DNSSEC records:
$ toluol AAAA example.com +do
example.com. 26860 AAAA 2606:2800:220:1:248:1893:25c8:1946
example.com. 26860 RRSIG AAAA 8 2 86400 20220309052808 20220216115840 1618 example.com. JlODulmkXKTi5EvxUJDcVh2pDZY8CovFWykPS9HhjbicMQJyCsngkHeRWVzndGU9nTYKiBGRJY2cMPzV5S4Lxh3AojM42xsuT0kQh7dDWOgfuZEeaLbSsZgLA1Xy2WnrxHlHv965cOMDcylqXHi7WEgBhiFTBMP6w6R5vgKxp5w=
response from ordns.he.net:53 in 15 ms
Verbose output:
$ toluol AAAA example.com
Header:
id: 57320, opcode: QUERY, rcode: NOERROR, flags: rd ra ad cd
OPT Pseudosection:
EDNS: Version 0, flags: <none>; payload size: 512
Question Section:
example.com. AAAA
Answer Section:
example.com. 28653 AAAA 2606:2800:220:1:248:1893:25c8:1946
Query metadata:
Time: 15 ms
Reply size: 68 bytes
Server: ordns.he.net:53
Reverse query:
$ toluol -x 2001:470:20::2
2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.7.4.0.1.0.0.2.ip6.arpa. 86400 PTR ordns.he.net.
response from ordns.he.net:53 in 141 ms
Only print RDATA using cut(1)
:
$ toluol MX gmail.com +no-padding +no-meta | cut -d' ' -f4-
10 alt1.gmail-smtp-in.l.google.com.
5 gmail-smtp-in.l.google.com.
40 alt4.gmail-smtp-in.l.google.com.
30 alt3.gmail-smtp-in.l.google.com.
20 alt2.gmail-smtp-in.l.google.com.
Only print RDATA as JSON array using jq(1)
:
$ toluol MX gmail.com +json | jq '[.[] | .rdata]'
[
[
"10",
"alt1.gmail-smtp-in.l.google.com."
],
[
"5",
"gmail-smtp-in.l.google.com."
],
[
"40",
"alt4.gmail-smtp-in.l.google.com."
],
[
"30",
"alt3.gmail-smtp-in.l.google.com."
],
[
"20",
"alt2.gmail-smtp-in.l.google.com."
]
]
Useful resources
- RFC 1035 (original specification of the DNS protocol)
- Explanation of the DNS specification
- Overview of the DNS record types
- Overview of some DNS parameters
License
See LICENSE.txt
.
Copyright (c) 2022 Max von Forell
Dependencies
~12–23MB
~419K SLoC