Agent: Re-raise exceptions in HostExploiter

The AutomatedMaster can't process the exceptions if the HostExploiter
swallows them. The HostExploiter can log and re-raise the exceptions so
they can be processed by the AutomatedMaster.
This commit is contained in:
Mike Salvatore 2022-03-07 10:24:22 -05:00
parent 00829ac094
commit fd2143a4df
1 changed files with 4 additions and 4 deletions

View File

@ -82,16 +82,16 @@ class HostExploiter:
self.options = options
self.pre_exploit()
result = None
try:
result = self._exploit_host()
return self._exploit_host()
except FailedExploitationError as e:
logger.debug(f"Exploiter failed: {e}.")
except Exception:
raise e
except Exception as e:
logger.error("Exception in exploit_host", exc_info=True)
raise e
finally:
self.post_exploit()
return result
def pre_exploit(self):
self.exploit_result = ExploiterResultData(