1. Tim Tomes
  2. Recon-ng
  3. Pull requests

Pull requests

#263 Open
Repository
Recon-ng
Branch
staging

fix `domain` bug on dns resolver

Bitbucket cannot automatically merge this request.

The commits that make up this pull request have been removed.

Bitbucket cannot automatically merge this request due to conflicts.

Review the conflicts on the Overview tab. You can then either decline the request or merge it manually on your local system using the following commands:

git checkout staging
git remote add nil0x42/recon-ng-1 https://bitbucket.org/nil0x42/recon-ng-1.git
git fetch nil0x42/recon-ng-1
git merge --no-ff -m 'Merged in nil0x42/recon-ng-1/nil0x42/fix-domain-bug-on-dns-resolver-1499132158594 (pull request #263)' remotes/nil0x42/recon-ng-1/nil0x42/fix-domain-bug-on-dns-resolver-1499132158594
Author
  1. nil0x42
Reviewers
Description

fix domain bug on dns resolver

Comments (1)

  1. nil0x42 author

    recon-ng uses dns.resolver.get_default_resolver() as resolver. this resolver's configuration i fed by /etc/resolv.conf (unlike dns.resolver.Resolver(configure=False))

    this becomes a problem when resolv.conf contains a domain configuration option, and for DHCP users, it is not rare, as many ISP add a domain option to resolve local NAT hosts.

    this should not be a problem in normal circumstances, but python-dnslib will raises a NoNameservers() exception for any non-existent host when a domain is set. for example, if domain my-isp-domain.com is on resolv.conf, and we call resolver.query("somesubdomain.target.com"), it will first try to resolve somesubdomain.target.com.my-isp-domain.com, and immediately raise a NoNameservers exception.

    This exception is used by recon/domains-hosts/brute_hosts to abort plugin execution, so the plugin is unusable for anyone having a domain config option in it's resolv.conf, as first non-exsisting domain will throw an exception and exit the plugin.

    there are two way to get away this: 1 - creating a default resolver by ignoring resolv.conf (resolver = dns.resolver.Resolver(configure=False))

    2 - just override `resolver.domain` and set it to it's default value (`dns.name.Name(("",))`)
    

    second option has been chosen because on only adds a single line, so it's easy to understand what the patch does :p