blechschmidt / massdns

A high-performance DNS stub resolver for bulk lookups and reconnaissance (subdomain enumeration)
GNU General Public License v3.0
3.1k stars 459 forks source link

"-o Sm" gives no results #44

Closed Chaz6 closed 2 years ago

Chaz6 commented 5 years ago

My interpretion of the help suggests that the option "-o Sm" should use simple output and only output records that match the query name. However, no records are output whatsoever. I want to exclude any CNAME records from the output.

blechschmidt commented 2 years ago

Previously, the simple output mode would, by default, print the resource records from the answer section that match the question name. As soon as any advanced output flag was specified, one would have to specifiy the sections to be output explicitly because the internal array of which section to be printed was reset.

Commit 59c18ae finally changes this, so that only the advanced output flags concerning the output of other sections have any influence on other sections to be printed.

The new manual page deals with this:

Due to the multitude of advanced flags that have accumulated over time, the "sim‐
ple  text  output" has become less simple.  It now supports many flags that allow
for an advanced customization of the output. Really, you should probably use JSON
instead. By default, this output mode outputs all resource records of the DNS an‐
swer section that match the question name. Each record  will  be  on  a  separate
line.  If any advanced output flag has been specified, this output mode will also
print resource records that do not match the question name, unless specified oth‐
erwise by the advanced output flag m.

Advanced output flags:
d  -  Include records from the additional section. As the simple text output out‐
puts records from the answer section by default, enabling  this  flag  will  only
output  records  from  the  additional section, unless the output of records from
other sections is explicitly turned on.

This complexity certainly not optimal, but the tweak solves this issue and it is the best way I can currently think of to improve the behavior of massdns while not breaking existing workflows.