q icon indicating copy to clipboard operation
q copied to clipboard

CNAME multiple identical lines in output

Open uggyuggy opened this issue 2 years ago • 4 comments

Hi, Thank's for sharing q

I understand not putting a record type, test/output the results for MX TXT NS, A AAAA CNAME .. (which is nice default)

But in some cases, this will report the identical CNAME answer for each of those records types. Which may be quite confusing into the output as all exact same CNAME line.

$ q -V
https://github.com/natesales/q version 0.5.8 (e84c6bbbfaa762f904ffbbd402f83630fa67589e 2022-04-18T20:59:46Z)
$
$ q www.eff.org
www.eff.org. 2h0m0s CNAME eff.map.fastly.net.
www.eff.org. 2h0m0s CNAME eff.map.fastly.net.
www.eff.org. 2h0m0s CNAME eff.map.fastly.net.
www.eff.org. 2h0m0s CNAME eff.map.fastly.net.
www.eff.org. 2h0m0s CNAME eff.map.fastly.net.
www.eff.org. 2h0m0s CNAME eff.map.fastly.net.
eff.map.fastly.net. 30s AAAA 2a04:4e42:1d::201
eff.map.fastly.net. 30s A 151.101.120.201
$
$ q www.eff.org | sort -u
eff.map.fastly.net. 30s A 151.101.120.201
eff.map.fastly.net. 30s AAAA 2a04:4e42:1d::201
www.eff.org. 1h48m16s CNAME eff.map.fastly.net.

uggyuggy avatar Apr 21 '22 17:04 uggyuggy

This should be a trivial fix, but I wanted to confirm what you think the default behavior should be. What do you think about only removing duplicate answers when using the default query types?

natesales avatar Apr 24 '22 06:04 natesales

Hi @natesales,

Thank's for your work on this tool.

Yes, I think still asking all 6 types, and removing only duplicates is the best default behavior. The TTL may possibly slightly different in some replies

www.eff.org. 2h0m0s CNAME eff.map.fastly.net.
www.eff.org. 1h58m36s CNAME eff.map.fastly.net.
www.eff.org. 1h57m46s CNAME eff.map.fastly.net.
...

So I would ignore this TTL value before removing duplicates, and I would report in output the longest TTL found

www.eff.org. 2h0m0s CNAME eff.map.fastly.net.

Thank's !

uggyuggy avatar Apr 24 '22 22:04 uggyuggy

This remains a problem in other formatting modes e.g. column.

smlx avatar Dec 21 '23 08:12 smlx