Fix: Handle error when VirusTotal blocks or returns unexpected response

This commit is contained in:
Ali . 2025-08-21 17:55:09 -04:00
parent 57710b1563
commit b958e8fb74
1 changed files with 25 additions and 1 deletions

View File

@ -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):