diff --git a/api/global_parser.py b/api/global_parser.py index 0834968..3d87645 100644 --- a/api/global_parser.py +++ b/api/global_parser.py @@ -38,11 +38,9 @@ def main(domain: str, config: configuration): warn = "" logger.info(f"[*] No subdomains of {domain} found from {os_file}") else: - #remove duplicates + # remove duplicates results = list(dict.fromkeys(results)) - logger.info( - f"[*] {len(results)} subdomains of {domain} found" - ) + logger.info(f"[*] {len(results)} subdomains of {domain} found") except Exception as e: logger.error(f"Impossible to get subdomains of {domain} from {os_file}") continue diff --git a/api/hackertarget.py b/api/hackertarget.py index 6195a11..6aa4234 100644 --- a/api/hackertarget.py +++ b/api/hackertarget.py @@ -9,13 +9,8 @@ def main(domain, handler: handler, key: str): # get all the subdomain of the domain from hackertarget # the url is https://api.hackertarget.com/hostsearch/?q={domain} # key is the api key - if key : - url = ( - "https://api.hackertarget.com/hostsearch/?q=" - + domain - + "&apikey=" - + key - ) + if key: + url = "https://api.hackertarget.com/hostsearch/?q=" + domain + "&apikey=" + key else: url = "https://api.hackertarget.com/hostsearch/?q=" + domain try: diff --git a/configuration.yaml b/configuration.yaml index 8c0aad6..3ca297b 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -1,5 +1,5 @@ Proxy : - activate: False + activate: True file: null #path to file, one proxy per line links: https://raw.githubusercontent.com/mertguvencli/http-proxy-list/main/proxy-list/data.txt : "http" diff --git a/lib/generics.py b/lib/generics.py index b66e10e..29a90fa 100644 --- a/lib/generics.py +++ b/lib/generics.py @@ -35,7 +35,9 @@ def clear_screen(): os.system("cls" if os.name == "nt" else "clear") -def fqdn_scanner(main_fqdn: str, config: configuration, res: result, recursive: int = 0): +def fqdn_scanner( + main_fqdn: str, config: configuration, res: result, recursive: int = 0 +): logger.info("[*] Scanning fqdn {}".format(main_fqdn)) main_domain = domain(main_fqdn, config) if main_domain.ip == "Dead": @@ -100,7 +102,10 @@ def fqdn_scanner(main_fqdn: str, config: configuration, res: result, recursive: sub_domain_future = executor.submit(domain, fqdn, config) futures_domain_recursive[fqdn] = sub_domain_future futures_get_subs.append( - executor.submit(sub_domain_future.result().get_subs, config.ip_trough_proxy) + executor.submit( + sub_domain_future.result().get_subs, + config.ip_trough_proxy, + ) ) logger.info( "[*] Waiting for {} threads to finish to getting subs".format( @@ -115,7 +120,11 @@ def fqdn_scanner(main_fqdn: str, config: configuration, res: result, recursive: # remove duplicates subs = list(dict.fromkeys(subs)) for fqdn in tqdm(subs, desc="Processing subdomains", ncols=100): - if fqdn == "localhost" or config.is_there_scope() or fqdn not in futures_domain_recursive and not futures_scope[fqdn] : + if ( + fqdn == "localhost" + or config.is_there_scope() + or fqdn not in futures_domain_recursive + ): continue sub_domain = futures_domain_recursive[fqdn].result() if sub_domain.ip == "Dead": @@ -132,8 +141,6 @@ def fqdn_scanner(main_fqdn: str, config: configuration, res: result, recursive: res.status() - - def ip_scanner(ip: str, config: configuration, res: result, recursive: int = 0): ip_obj = ip_lib.ip(ip, config) res.add_ip(ip_obj) diff --git a/lib/handler.py b/lib/handler.py index 99aa7b3..7a8006a 100644 --- a/lib/handler.py +++ b/lib/handler.py @@ -101,7 +101,9 @@ def get(self, url, params=None, headers=None, redirect=True, until_ok=False): while True: if not self.there_is_proxy(): try: - data = http.request("GET", url, headers=headers, timeout=3.0, redirect=redirect) + data = http.request( + "GET", url, headers=headers, timeout=3.0, redirect=redirect + ) except: data = None return data @@ -131,12 +133,17 @@ def get(self, url, params=None, headers=None, redirect=True, until_ok=False): ) try: # don't use proxy - data = http.request("GET", url, headers=headers, timeout=3.0, redirect=redirect) + data = http.request( + "GET", + url, + headers=headers, + timeout=3.0, + redirect=redirect, + ) except: data = None return data - def connect(self, ip: str, port: int): """Connect to the port using a random socks proxy""" if self.socks5_proxy == []: