diff --git a/monkey/infection_monkey/exploit/powershell.py b/monkey/infection_monkey/exploit/powershell.py index ff0f0db4e..de3797a1d 100644 --- a/monkey/infection_monkey/exploit/powershell.py +++ b/monkey/infection_monkey/exploit/powershell.py @@ -3,6 +3,7 @@ from pathlib import Path, PurePath from typing import List, Optional from common import OperatingSystem +from common.tags import T1059_ATTACK_TECHNIQUE_TAG, T1105_ATTACK_TECHNIQUE_TAG from infection_monkey.exploit.HostExploiter import HostExploiter from infection_monkey.exploit.powershell_utils.auth_options import AuthOptions, get_auth_options from infection_monkey.exploit.powershell_utils.credentials import ( @@ -21,6 +22,12 @@ from infection_monkey.utils.environment import is_windows_os from infection_monkey.utils.threading import interruptible_iter logger = logging.getLogger(__name__) +POWERSHELL_EXPLOITER_TAG = "powershell-exploiter" +PROPAGATION_TAGS = ( + POWERSHELL_EXPLOITER_TAG, + T1059_ATTACK_TECHNIQUE_TAG, + T1105_ATTACK_TECHNIQUE_TAG, +) class RemoteAgentCopyError(Exception): @@ -72,8 +79,12 @@ class PowerShellExploiter(HostExploiter): self._execute_monkey_agent_on_victim() self.exploit_result.propagation_success = True except Exception as 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}") self.exploit_result.error_message = str(ex) + return self.exploit_result + + self._publish_propagation_event(self.host.ip_addr, True, PROPAGATION_TAGS) return self.exploit_result