Have Shodan resolutions keep going if one of the IPs is not in the database.

This commit is contained in:
AccentuSoft
2022-07-01 13:10:14 +03:00
parent 2efa051220
commit d5df8a795a
3 changed files with 15 additions and 0 deletions

View File

@@ -29,6 +29,11 @@ class ShodanDomainScan:
results = api.dns.domain_info(
domain=primary_field, history=False, page=1)
except shodan.exception.APIError as err:
if 'No information available' in str(err):
return_result.append([{'Phrase': 'No information in Shodan database.',
'Entity Type': 'Phrase'},
{uid: {'Resolution': 'Shodan 404', 'Notes': ''}}])
continue
return "Error: " + str(err)
for subdomain_dict in results['data']:
value = subdomain_dict['value']

View File

@@ -116,6 +116,11 @@ class ShodanIPScan:
try:
host = api.host(primary_field)
except shodan.exception.APIError as err:
if 'No information available' in str(err):
return_result.append([{'Phrase': 'No information in Shodan database.',
'Entity Type': 'Phrase'},
{uid: {'Resolution': 'Shodan 404', 'Notes': ''}}])
continue
return "Error: " + str(err)
self.parsing(host, return_result, uid)

View File

@@ -38,6 +38,11 @@ class ShodanSearch:
try:
search = api.search(primary_field)
except shodan.exception.APIError as err:
if 'No information available' in str(err):
return_result.append([{'Phrase': 'No information in Shodan database.',
'Entity Type': 'Phrase'},
{uid: {'Resolution': 'Shodan 404', 'Notes': ''}}])
continue
return "Error: " + str(err)
for match in search['matches'][:max_results]:
ipMatch = str(match['ip_str'])