Now suppressing exceptions in cloud info collection as well

This commit is contained in:
Shay Nehmad 2019-10-13 10:55:55 +03:00
parent 74dbb053a6
commit 177e1ea990
1 changed files with 32 additions and 22 deletions

View File

@ -113,7 +113,7 @@ class InfoCollector(object):
:return: None. Updates class information
"""
LOG.debug("Reading subnets")
self.info['network_info'] =\
self.info['network_info'] = \
{
'networks': get_host_subnets(),
'netstat': NetstatCollector.get_netstat_info()
@ -122,9 +122,11 @@ class InfoCollector(object):
def get_azure_info(self):
"""
Adds credentials possibly stolen from an Azure VM instance (if we're on one)
Updates the credentials structure, creating it if neccesary (compat with mimikatz)
Updates the credentials structure, creating it if necessary (compat with mimikatz)
:return: None. Updates class information
"""
# noinspection PyBroadException
try:
from infection_monkey.config import WormConfiguration
if not WormConfiguration.extract_azure_creds:
return
@ -144,6 +146,14 @@ class InfoCollector(object):
if len(azure_creds) != 0:
self.info["Azure"] = {}
self.info["Azure"]['usernames'] = [cred[0] for cred in azure_creds]
except Exception:
# If we failed to collect azure info, no reason to fail all the collection. Log and continue.
LOG.error("Failed collecting Azure info.", exc_info=True)
def get_aws_info(self):
# noinspection PyBroadException
try:
self.info['aws'] = AwsCollector().get_aws_info()
except Exception:
# If we failed to collect aws info, no reason to fail all the collection. Log and continue.
LOG.error("Failed collecting AWS info.", exc_info=True)