blechschmidt / massdns

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

Thoughts on implicitly or explicitly translating dotted quad to in-addr.arpa for PTR questions #121

Closed mzpqnxow closed 2 years ago

mzpqnxow commented 2 years ago

I'm curious what your thoughts are on implicitly (or explicitly, via a flag) performing a run-time transform on dotted quad inputs when the question type is PTR. You probably know exactly what I'm describing, but the example:

1.2.3.4
3.4.5.6
...

... would be converted at run-time to:

4.3.2.1.in-addr.arpa
6.5.4.3.in-addr.arpa
...

Currently if you want to do PTR lookups from a list of dotted quads, you're responsible for doing the translation before the inputs get to massdns. This is easy enough to do by piping inputs through a simple script but I was curious what your thoughts on it were. It's not a difficult thing to do, nor does it have a big footprint depending on how you do it- it's more a question of whether you think it's the role of massdns to do this sort of thing

Thanks for reviewing this and thanks for your work on the project

EDIT: I realize this would probably be implemented as translating the dotted quad directly into the DNS label, rather than going to the intermediate format instead- but you get what I mean I'm sure :)

blechschmidt commented 2 years ago

9f37f3bc0bc3d5add215e67a983fabed80bd8c22 implements this. For now, I chose to use the intermediate string representation, simply because it was the fastest and most readable way to implement it. As long as there are no dynamic memory allocations, I am not overly pedantic when it comes to these small tradeoffs.

Implementing it by directly converting it to the DNS label is left as an exercise to the reader ;) Direct conversion is implemented by 0639b8cecca2a91134b65563f9c729de8d7e79eb.

mzpqnxow commented 2 years ago

oh dang, that was quick, thanks. I figured you would ask me to send a PR but this works even better :)

Thanks again!