From b958e8fb74f2c12249011e4623a923d6369a2f15 Mon Sep 17 00:00:00 2001 From: "Ali ." Date: Thu, 21 Aug 2025 17:55:09 -0400 Subject: [PATCH] Fix: Handle error when VirusTotal blocks or returns unexpected response --- sublist3r.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sublist3r.py b/sublist3r.py index c5d9a79..1e8f0ce 100755 --- a/sublist3r.py +++ b/sublist3r.py @@ -685,7 +685,31 @@ class Virustotal(enumratorBaseThreaded): self.q = q super(Virustotal, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) self.url = self.base_url.format(domain=self.domain) - return + + def enumerate(self): + try: + headers = { + 'User-Agent': 'Mozilla/5.0', + 'Accept': 'application/json', + } + response = requests.get(self.url, headers=headers, timeout=10) + + if response.status_code != 200: + print(f"[-] Virustotal error: HTTP {response.status_code}. Skipping...") + return [] + + data = response.json() + subdomains = [entry['id'] for entry in data.get('data', [])] + + if self.verbose: + print(f"[+] {self.engine_name} found {len(subdomains)} subdomains.") + + return subdomains + + except Exception as e: + print(f"[-] Virustotal exception: {str(e)}. Skipping...") + return [] + # the main send_req need to be rewritten def send_req(self, url):