hannob / snallygaster

Tool to scan for secret files on HTTP servers
BSD Zero Clause License
2.07k stars 228 forks source link

Fix crash due to DNS timeout #76

Closed undergroundwires closed 3 days ago

undergroundwires commented 2 years ago

Fixes crash due to dns.resolver.LifetimeTimeout: The resolution lifetime expired after 19.275 seconds.

snallygaster crashes during axfr test if the DNS server of the target responds slowly. It should not crash completely but instead pass the test as desired behavior.

During crash, snallygaster logs to stderr the following:

Traceback (most recent call last):
  File "/tools/snallygaster/bin/snallygaster", line 1022, in <module>
    test(host)
  File "/tools/snallygaster/bin/snallygaster", line 801, in test_axfr
    ipv4 = dns.resolver.resolve(r, 'a').rrset
  File "/tools/snallygaster/lib/python3.10/site-packages/dns/resolver.py", line 1193, in resolve
    return get_default_resolver().resolve(qname, rdtype, rdclass, tcp, source,
  File "/tools/snallygaster/lib/python3.10/site-packages/dns/resolver.py", line 1066, in resolve
    timeout = self._compute_timeout(start, lifetime,
  File "/tools/snallygaster/lib/python3.10/site-packages/dns/resolver.py", line 879, in _compute_timeout
    raise LifetimeTimeout(timeout=duration, errors=errors)
dns.resolver.LifetimeTimeout: The resolution lifetime expired after 19.275 seconds: 

And stdout to:

Oh oh... an unhandled exception has happened. This shouldn't be.
Please report a bug and include all output.
hannob commented 3 days ago

Looks good, sorry for the long wait. Patch no longer applies, I'll re-do it manually.