Agent: Move assignment outside of try/except

This commit is contained in:
Mike Salvatore 2022-10-05 12:17:16 -04:00 committed by Ilija Lazoroski
parent 3bca02af59
commit 39bada5bb1
1 changed files with 1 additions and 1 deletions

View File

@ -82,13 +82,13 @@ class PowerShellExploiter(HostExploiter):
try: try:
self._execute_monkey_agent_on_victim() self._execute_monkey_agent_on_victim()
self.exploit_result.propagation_success = True
except Exception as ex: except Exception as ex:
self._publish_propagation_event(self.host.ip_addr, False, PROPAGATION_TAGS, str(ex)) self._publish_propagation_event(self.host.ip_addr, False, PROPAGATION_TAGS, str(ex))
logger.error(f"Failed to propagate to the remote host: {ex}") logger.error(f"Failed to propagate to the remote host: {ex}")
self.exploit_result.error_message = str(ex) self.exploit_result.error_message = str(ex)
return self.exploit_result return self.exploit_result
self.exploit_result.propagation_success = True
self._publish_propagation_event(self.host.ip_addr, True, PROPAGATION_TAGS) self._publish_propagation_event(self.host.ip_addr, True, PROPAGATION_TAGS)
return self.exploit_result return self.exploit_result