From c0fc4450c06ac91e1efe7dc02634598701081a3f Mon Sep 17 00:00:00 2001 From: drighetto Date: Tue, 24 Oct 2023 16:52:25 +0200 Subject: [PATCH] Repair get_grayhatwarfare_infos() function - #110 --- wpr.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wpr.py b/wpr.py index d276011..d248fd8 100644 --- a/wpr.py +++ b/wpr.py @@ -767,12 +767,12 @@ def get_dns_dumpster_infos(domain, http_proxy): def get_grayhatwarfare_infos(domain, api_key, http_proxy): infos = {"DATA": [], "ERROR": None} - service_url_files = f"https://buckets.grayhatwarfare.com/api/v1/files/{domain}/2000?access_token={api_key}" - service_url_buckets = f"https://buckets.grayhatwarfare.com/api/v1/buckets/0/2000?keywords={domain}&access_token={api_key}" + service_url_files = f"https://buckets.grayhatwarfare.com/api/v2/files?keywords={domain}&limit=1000" + service_url_buckets = f"https://buckets.grayhatwarfare.com/api/v2/buckets?keywords={domain}&limit=1000" try: web_proxies = configure_proxy(http_proxy) req_session = requests.Session() - req_session.headers.update({"User-Agent": USER_AGENT}) + req_session.headers.update({"User-Agent": USER_AGENT, "Authorization": f"Bearer {api_key}"}) req_session.proxies.update(web_proxies) req_session.verify = (http_proxy is None) # Extract data for files @@ -795,9 +795,9 @@ def get_grayhatwarfare_infos(domain, api_key, http_proxy): if len(results["buckets"]) > 0: for bucket in results["buckets"]: if "container" in bucket: - infos["DATA"].append(f"[BUCKET]: {bucket['bucket']} in container {bucket['container']} ({bucket['fileCount']} files)") + infos["DATA"].append(f"[BUCKET]: '{bucket['bucket']}' in container '{bucket['container']}' ({bucket['fileCount']} files)") else: - infos["DATA"].append(f"[BUCKET]: {bucket['bucket']} ({bucket['fileCount']} files)") + infos["DATA"].append(f"[BUCKET]: '{bucket['bucket']}' ({bucket['fileCount']} files)") infos["DATA"].sort() except Exception as e: infos["ERROR"] = f"Error during web call: {str(e)}"