From ddfabee0d9f1a16fb87605725a468123129a55a1 Mon Sep 17 00:00:00 2001 From: Neo Date: Tue, 7 Feb 2017 22:09:58 +0200 Subject: [PATCH] Fix use of incorrect method When checking `CNAME` records, the code calls: ``` self.resolver.query(cname_host, "A", total_rechecks) ``` Which results in an integer argument being given for the `name_server` argument in the `resolver.query` method which has the signature: ``` def query(self, hostname, query_type = 'ANY', name_server = False, use_tcp = False): ``` And causes an error to be raised in `dnslib`: ``` File "dnslib/dns.py", line 375, in send sock.sendto(self.pack(),(dest,port)) TypeError: coercing to Unicode: need string or buffer, int found ``` It seems from the call signature intended to be recursive call to the `check` method itself with a preservation of the retry count so that's what I put in. --- subbrute.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subbrute.py b/subbrute.py index 37191cd..bd771b9 100755 --- a/subbrute.py +++ b/subbrute.py @@ -351,11 +351,11 @@ def check(self, host, record_type = "ANY", total_rechecks = 0): added_cname = False #A max 20 lookups cname_host = host - resp = self.resolver.query(cname_host, "A", total_rechecks) + resp = self.check(cname_host, "A", total_rechecks) if not resp: - resp = self.resolver.query(cname_host, "AAAA", total_rechecks) + resp = self.check(cname_host, "AAAA", total_rechecks) if not resp: - resp = self.resolver.query(cname_host, "CNAME", total_rechecks) + resp = self.check(cname_host, "CNAME", total_rechecks) for r in resp: return_name, record_type, record_data = r #if record_type in ["CNAME", "A", "AAAA"]: @@ -856,4 +856,4 @@ def signal_init(): target = target.strip() if target: trace(target, record_type, options.subs, options.resolvers, options.process_count, options.print_data, output, json_output) - print_target(target, record_type, options.subs, options.resolvers, options.process_count, options.print_data, output, json_output) \ No newline at end of file + print_target(target, record_type, options.subs, options.resolvers, options.process_count, options.print_data, output, json_output)