Have Shodan resolutions keep going if one of the IPs is not in the database.
This commit is contained in:
@@ -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']
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user