Agent: Publish propagation events
This commit is contained in:
parent
bb6716df18
commit
3bede2f9d1
|
@ -3,6 +3,7 @@ from pathlib import Path, PurePath
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from common import OperatingSystem
|
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.HostExploiter import HostExploiter
|
||||||
from infection_monkey.exploit.powershell_utils.auth_options import AuthOptions, get_auth_options
|
from infection_monkey.exploit.powershell_utils.auth_options import AuthOptions, get_auth_options
|
||||||
from infection_monkey.exploit.powershell_utils.credentials import (
|
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
|
from infection_monkey.utils.threading import interruptible_iter
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
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):
|
class RemoteAgentCopyError(Exception):
|
||||||
|
@ -72,8 +79,12 @@ class PowerShellExploiter(HostExploiter):
|
||||||
self._execute_monkey_agent_on_victim()
|
self._execute_monkey_agent_on_victim()
|
||||||
self.exploit_result.propagation_success = True
|
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))
|
||||||
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
|
||||||
|
|
||||||
|
self._publish_propagation_event(self.host.ip_addr, True, PROPAGATION_TAGS)
|
||||||
|
|
||||||
return self.exploit_result
|
return self.exploit_result
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue