From a552336beabb4ebb83bbaed15b7d9b894ebfcfa3 Mon Sep 17 00:00:00 2001 From: MaKyOtOx Date: Fri, 29 Sep 2023 16:26:57 +0200 Subject: [PATCH] fix ARS-135 fix whois --- VERSION | 2 +- engines/owl_dns/Dockerfile | 2 +- engines/owl_dns/VERSION | 2 +- engines/owl_dns/engine-owl_dns.py | 21 ++++++++++++++------- engines/owl_dns/install.sh | 0 engines/owl_dns/requirements.txt | 4 ++-- 6 files changed, 19 insertions(+), 12 deletions(-) mode change 100644 => 100755 engines/owl_dns/install.sh diff --git a/VERSION b/VERSION index df808199..41336a1c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.11 +1.5.12 diff --git a/engines/owl_dns/Dockerfile b/engines/owl_dns/Dockerfile index 6f0bf90e..19b2c965 100644 --- a/engines/owl_dns/Dockerfile +++ b/engines/owl_dns/Dockerfile @@ -1,5 +1,5 @@ FROM alpine:3.16.3 -LABEL Name="Patrowl\ DNS\ \(Patrowl engine\)" Version="1.5.1" +LABEL Name="Patrowl\ DNS\ \(Patrowl engine\)" Version="1.5.2" # Install dependencies RUN apk add --update --no-cache \ diff --git a/engines/owl_dns/VERSION b/engines/owl_dns/VERSION index 26ca5946..4cda8f19 100644 --- a/engines/owl_dns/VERSION +++ b/engines/owl_dns/VERSION @@ -1 +1 @@ -1.5.1 +1.5.2 diff --git a/engines/owl_dns/engine-owl_dns.py b/engines/owl_dns/engine-owl_dns.py index 5da3ca30..3ef530f7 100644 --- a/engines/owl_dns/engine-owl_dns.py +++ b/engines/owl_dns/engine-owl_dns.py @@ -316,6 +316,7 @@ def _get_wf_whois(apikey:str, value:str): return json.loads(resp.text) + def _get_wf_domains(wf_url:str, max_pages:int): wf_domains = [] page = 1 @@ -352,16 +353,16 @@ def _reverse_whois(scan_id, asset, datatype): if len(this.wf_apitokens) == 0: # No whoisfreak API Token available return res - + # Select an API KEY apikey = this.wf_apitokens[random.randint(0, len(this.wf_apitokens)-1)] - + # Check the asset is a valid domain name or IP Address if datatype in ["domain", "fqdn"]: if not __is_domain(asset): return res - # w = whois.whois(asset) - w = whois.query(asset, force=True) + w = whois.whois(asset) + # w = whois.query(asset, force=True) # print(w.name, w.registrant, w.owner) # if w.domain_name is None: @@ -718,13 +719,15 @@ def _get_whois(scan_id, asset): res = {} is_domain = __is_domain(asset) is_ip = __is_ip_addr(asset) - + + print(asset, is_domain, is_ip) + # Check the asset is a valid domain name or IP Address if not is_domain and not is_ip: return res if is_domain: - # w = whois.whois(asset) + w = whois.whois(asset) # if w.domain_name is None: # res.update({ # asset: {"errors": w} @@ -733,12 +736,15 @@ def _get_whois(scan_id, asset): # res.update({ # asset: {"raw": {'dict': w, 'text': w.text}, "text": w.text, "type": "domain"} # }) - w = whois.query(asset, force=True, include_raw_whois_text=True) + # w = whois.query(asset, force=True) + print("w.name:", w.name) if w.name is None: res.update({ asset: {"errors": w.__dict__} }) else: + print("w.__dict__:", w.__dict__) + print("w.__dict__:", w.__dict__) res.update({ asset: {"raw": {'dict': w.__dict__, 'text': w.text}, "text": w.text, "type": "domain"} }) @@ -748,6 +754,7 @@ def _get_whois(scan_id, asset): asset: {"raw": {'dict': w, 'text': "see raw"}, "text": "see raw", "type": "ip"} }) + print(res) scan_lock = threading.RLock() with scan_lock: if 'whois' not in this.scans[scan_id]['findings'].keys(): diff --git a/engines/owl_dns/install.sh b/engines/owl_dns/install.sh old mode 100644 new mode 100755 diff --git a/engines/owl_dns/requirements.txt b/engines/owl_dns/requirements.txt index dab865f4..34c8786f 100644 --- a/engines/owl_dns/requirements.txt +++ b/engines/owl_dns/requirements.txt @@ -14,7 +14,7 @@ itsdangerous==2.1.2 Jinja2==3.1.2 MarkupSafe==2.1.1 PatrowlEnginesUtils>=1.0.2 -#python-whois #==0.8.0 +python-whois==0.8.0 netaddr==0.8.0 requests==2.28.1 setuptools #==65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability @@ -22,4 +22,4 @@ six==1.16.0 urllib3==1.26.13 validators==0.20.0 werkzeug==2.2.3 -whois==0.8 +#whois==0.9.27