
Un risolutore DNS stub ad alte prestazioni per interrogazioni massive e ricognizione (enumerazione dei sottodomini).
MassDNS è un semplice resolver stub DNS ad alte prestazioni pensato per chi cerca di risolvere una quantità enorme di nomi di dominio, nell’ordine di milioni o addirittura miliardi. Senza configurazioni particolari, MassDNS è in grado di risolvere oltre 350.000 nomi al secondo utilizzando resolver pubblicamente disponibili.
Clona il repository git e cd nella cartella principale del progetto. Quindi esegui make per compilare dal codice sorgente.
Se non sei su Linux, esegui make nolinux. Su Windows sono richiesti i pacchetti Cygwin gcc-core, git e make.
Usage: ./bin/massdns [options] [domainlist]
-b --bindto Bind to IP address and port. (Default: 0.0.0.0:0)
--busy-poll Use busy-wait polling instead of epoll.
-c --resolve-count Number of resolves for a name before giving up. (Default: 50)
--drop-group Group to drop privileges to when running as root. (Default: nogroup)
--drop-user User to drop privileges to when running as root. (Default: nobody)
--extended-input Input names are followed by a space-separated list of resolvers.
These are used before falling back to the resolvers file.
--filter Only output packets with the specified response code.
--flush Flush the output file whenever a response was received.
-h --help Show this help.
--ignore Do not output packets with the specified response code.
-i --interval Interval in milliseconds to wait between multiple resolves of the same
domain. (Default: 500)
-l --error-log Error log file path. (Default: /dev/stderr)
--norecurse Use non-recursive queries. Useful for DNS cache snooping.
-o --output Flags for output formatting.
--predictable Use resolvers incrementally. Useful for resolver tests.
--processes Number of processes to be used for resolving. (Default: 1)
-q --quiet Quiet mode.
--rand-src-ipv6 Use a random IPv6 address from the specified subnet for each query.
--rand-src-ipv6-file Use a random IPv6 address from the specified file.
--rcvbuf Size of the receive buffer in bytes.
--retry Unacceptable DNS response codes.
(Default: All codes but NOERROR or NXDOMAIN)
-r --resolvers Text file containing DNS resolvers.
--root Do not drop privileges when running as root. Not recommended.
-s --hashmap-size Number of concurrent lookups. (Default: 10000)
--sndbuf Size of the send buffer in bytes.
--status-format Format for real-time status updates, json or ansi (Default: ansi)
--sticky Do not switch the resolver when retrying.
--socket-count Socket count per process. (Default: 1)
-t --type Record type to be resolved. (Default: A)
--verify-ip Verify IP addresses of incoming replies.
-w --outfile Write to the specified output file instead of standard output.
Output flags:
L - domain list output
S - simple text output
F - full text output
B - binary output
J - ndjson output
Advanced flags for the domain list output mode:
0 - Include NOERROR replies without answers.
Advanced flags for the simple output mode:
d - Include records from the additional section.
i - Indent any reply record.
l - Separate replies using a line feed.
m - Only output reply records that match the question name.
n - Include records from the answer section.
q - Print the question.
r - Print the question with resolver IP address, Unix timestamp and return code prepended.
s - Separate packet sections using a line feed.
t - Include TTL and record class within the output.
u - Include records from the authority section.
Advanced flags for the ndjson output mode:
e - Write a record for each terminal query failure.
Per una descrizione dettagliata dell'interfaccia a riga di comando, consulta la pagina man usando man ./doc/massdns.1.
Risolvi tutti i record AAAA dai domini contenuti in domains.txt utilizzando i resolver in resolvers.txt in lists e salva i risultati in results.txt:
$ ./bin/massdns -r lists/resolvers.txt -t AAAA domains.txt > results.txt
Equivale a:
$ ./bin/massdns -r lists/resolvers.txt -t AAAA -w results.txt domains.txt
Di default, MassDNS produce i pacchetti di risposta in formato testo, simile al seguente:
;; Server: 77.41.229.2:53
;; Size: 93
;; Unix time: 1513458347
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51298
;; flags: qr rd ra ; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION:
example.com. IN A
;; ANSWER SECTION:
example.com. 45929 IN A 93.184.216.34
;; AUTHORITY SECTION:
example.com. 24852 IN NS b.iana-servers.net.
example.com. 24852 IN NS a.iana-servers.net.
L'indirizzo IP del resolver è incluso per facilitare il filtraggio dell'output nel caso in cui rilevi che alcuni resolver producono risultati errati.
Il repository include il file resolvers.txt costituito da un sottoinsieme filtrato dei resolver forniti dal progetto subbrute.
Tieni presente che l'utilizzo di MassDNS può causare un carico significativo sui resolver usati e potrebbe portare all'invio di reclami per abuso al tuo ISP.
Inoltre, i resolver forniti non sono garantiti come affidabili. La lista dei resolver è attualmente obsoleta e una grande parte di essi non funziona.
L'implementazione DNS personalizzata e senza malloc di MassDNS supporta attualmente solo i record più comuni. Sei invitato a contribuire per cambiare questa situazione collaborando.
MassDNS include uno script Python che consente di risolvere tutti i record PTR IPv4 stampando le relative query sullo standard output.
$ ./scripts/ptr.py | ./bin/massdns -r lists/resolvers.txt -t PTR -w ptr.txt
Tieni presente che le etichette all'interno di in-addr.arpa sono invertite. Per risolvere il nome di dominio di 1.2.3.4, MassDNS si aspetta 4.3.2.1.in-addr.arpa come nome di query in input.
Di conseguenza, lo script Python non risolve i record in ordine crescente, il che è un vantaggio perché si evitano improvvisi picchi di carico sui name server dei sottoinsiemi IPv4.
Esegui le scansioni di ricognizione in modo responsabile e regola il parametro -s per non sovraccaricare i name server autorevoli.
Similmente a subbrute, MassDNS permette di fare brute force dei sottodomini utilizzando lo script subbrute.py incluso:
$ ./scripts/subbrute.py example.com lists/names.txt | ./bin/massdns -r lists/resolvers.txt -t A -o S -w results.txt
Come metodo aggiuntivo di ricognizione, lo script ct.py estrae i sottodomini dai log di trasparenza dei certificati, recuperando i dati da crt.sh:
$ ./scripts/ct.py example.com | ./bin/massdns -r lists/resolvers.txt -t A -o S -w results.txt