Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added recursive_query function, fixes #6 #12

Merged
merged 3 commits into from
Aug 21, 2016
Merged

Conversation

zeedo
Copy link
Contributor

@zeedo zeedo commented Jul 4, 2016

Queries for SOA and NS now recursively search each domain and non-existing domains display an error instead of a stack trace.

Made wildcard handling a bit nicer:
When we find a wildcard user might be interested in seeing the IP. If wildcards exist the brute forcing code should ignore any subdomains that match the wildcard IP, otherwise all subdomains return an IP and the output has too much false positive noise.

@@ -112,6 +112,21 @@ def reverse_query(resolver, ip):
return query(resolver, dns.reversename.from_address(ip), record_type='PTR')


def recursive_query(resolver, domain, record_type='NS'):

query_domain = str(domain)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could make this a bit more Pythonic, and use the builtin features of dnspython with something like the following:

tld_length = 2
for _ in range(len(domain) - tld_length):
    resp = query(resolver, domain, record_type)
    if resp:
        break
    domain = domain.parent()
else:
    return None

return resp

@johanmazel
Copy link

The db4d0bc introduces an error (sorry I am not exactly sure how to refer a commit on another repository).
If the wildcard fails, its type is None
Consequently, this generates an error when each a A query is made on each subdomain because fierce tests if the A query result is None or if the found address is the same as the wildcard (which is None here).
There should an additional test for wildcard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants