Open geeseven opened 3 years ago
Hi,
This is something I actually deliberately avoided implementing, but I've had a ton of requests for it!
My rationale for not including it is that we already have other tools to do this: host
or nslookup
. I gave some explanation over on Hacker News, saying that it's like if curl
had a special flag to run curl ifconfig.me
because that's one of the things you can use HTTP for. People responded saying they use dig
for reverse lookups all the time, though.
It's not too hard a feature to add (mangle the input IP into a domain before sending it, and send PTR
records specifically), so I'll probably end up doing it at some point anyway.
Also,
ANY
does not returnPTR
records forin-addr.arpa
orip6.arpa
domains.
ANY
returns whatever the nameserver wants it to return. Using the router my ISP gave me (not exactly the pinnacle of advanced technology), I get PTR
results for both of those:
Hey @ogham,
Thanks for the timely reply. I had a feeling that this might have been a deliberate decision. I too use dig -x
a fair amount and would prefer to use a single tool for all DNS queries.
I'll probably end up doing it at some point anyway.
Glad to hear that you flexible. In the mean time, I would recommend updating the help output as it is currently misleading.
ANY
returns whatever the nameserver wants it to return.
TIL, thanks for sharing.
Sidenote, FreeBSD is already packaging dog.
$ pkg info dog
dog-0.1.0
Name : dog
Version : 0.1.0
Installed on : Sun Nov 15 13:13:11 2020 CST
Origin : dns/dog
Architecture : FreeBSD:12:amd64
Prefix : /usr/local
Categories : net dns
Licenses : EUPL
Maintainer : vulcan@wired.sh
WWW : https://dns.lookup.dog/
Comment : Command-line DNS client
Options :
COMPLETIONS : on
DOCS : on
Annotations :
FreeBSD_version: 1201000
repo_type : binary
repository : FreeBSD-faster
Flat size : 677KiB
Description :
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.
WWW: https://dns.lookup.dog/
I'll add the FreeBSD link to the list, thanks!
What's wrong with the help output? Ah, is it the "Host name or IP address to query"? I may have got ahead of myself there.
Ah, is it the "Host name or IP address to query"?
Yea, IP addresses currently do not work. See my pull request, #34.
I may have got ahead of myself there.
:wink: hehe
Just wanted to voice my support for better reverse DNS lookups. It's one of my primary use cases for using dig
.
Is this something you'd be willing to accept PRs for?
https://github.com/mrqwer88/dog/commit/7acfc357b3b3b3e38e3de33cc830c8b9bb197e44 write prototype for it.
Should be more dig-like -
./target/release/dog -x -q 127.0.0.1 -q 1.1.1.1 -q 2a00:1450:400f:80a::200e
PTR 1.0.0.127.in-addr.arpa. 3h00m00s "localhost."
PTR 1.1.1.1.in-addr.arpa. 22m26s "one.one.one.one."
PTR e.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.a.0.8.0.f.0.0.4.0.5.4.1.0.0.a.2.ip6.arpa. 22h36m46s "arn11s03-in-x0e.1e100.net."
Having a reverse lookup support will be nice. This will make one single tool for windows as dig is not available for windows.
This will make one single tool for windows as dig is not available for windows.
It doesn't look like this project is maintained anymore. You might be interested in a Go based alternative doggo
, it's actively maintained and inspired from dog
, also has rDNS lookup :+1:
Thanks for pointing out the alternative solution.
My rationale for not including it is that we already have other tools to do this
Why would I even use dog
in the first place, if I wanted to use the well-established tools that come pre-packaged with every OS?
My quick and dirty solution was to write a shell wrapper for dog:
#!/bin/zsh
dog=/usr/local/bin/dog
if [[ "$1" == "-x" ]]; then
IFS="."
echo $2 | read a b c d
unset IFS
$dog $d.$c.$b.$a.in-addr.arpa PTR
else
$dog "$@"
fi
If you're stuck on Windows, you can use something like this:
Import-Module IPv4Toolbox
if ($args[0] -like '-x') {
dog.exe (ConvertTo-InverseAddress $args[1]) PTR
} else {
dog.exe $args
}
Greetings,
Currently, IP/PTR look ups do not have the same polish of other records. The help output states
-q, --query=HOST Host name or IP address to query
, but it does not work for IPv4 or IPv6.One should not have to convert IPs to the
in-addr.arpa
orip6.arpa
domains, especially for IPv6. Should the default record for IPs bePTR
?Also,
ANY
does not returnPTR
records forin-addr.arpa
orip6.arpa
domains.This seems to be the only rough edge on an otherwise slick project.