From 3d22e49ccc178166ba955144ee8d8abbd9846cb2 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Mon, 3 Oct 2022 13:51:39 +0200 Subject: [PATCH] Common: Add PropagationEvent to agent_events --- monkey/common/agent_events/__init__.py | 1 + .../common/agent_events/propagation_event.py | 21 +++++++++++++++++++ vulture_allowlist.py | 8 +++---- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 monkey/common/agent_events/propagation_event.py diff --git a/monkey/common/agent_events/__init__.py b/monkey/common/agent_events/__init__.py index 3ac5a343d..e185de1fa 100644 --- a/monkey/common/agent_events/__init__.py +++ b/monkey/common/agent_events/__init__.py @@ -2,3 +2,4 @@ from .abstract_agent_event import AbstractAgentEvent from .credentials_stolen_events import CredentialsStolenEvent from .ping_scan_event import PingScanEvent from .tcp_scan_event import TCPScanEvent +from .propagation_event import PropagationEvent diff --git a/monkey/common/agent_events/propagation_event.py b/monkey/common/agent_events/propagation_event.py new file mode 100644 index 000000000..8d1bb07af --- /dev/null +++ b/monkey/common/agent_events/propagation_event.py @@ -0,0 +1,21 @@ +from ipaddress import IPv4Address + +from pydantic import Field + +from . import AbstractAgentEvent + + +class PropagationEvent(AbstractAgentEvent): + """ + An event that occurs when the Agent propagates on a host + + Attributes: + :param success: Status of the propagation + :param exploiter_name: Name of the exploiter that propagated + :param error_message: Message if an error occurs during propagation + """ + + target: IPv4Address + success: bool + exploiter_name: str + error_message: str = Field(default="") diff --git a/vulture_allowlist.py b/vulture_allowlist.py index 48a50e8cc..45c700094 100644 --- a/vulture_allowlist.py +++ b/vulture_allowlist.py @@ -7,7 +7,7 @@ from common.agent_configuration.agent_sub_configurations import ( CustomPBAConfiguration, ScanTargetConfiguration, ) -from common.agent_events import PingScanEvent, TCPScanEvent +from common.agent_events import PingScanEvent, PropagationEvent, TCPScanEvent from common.credentials import Credentials, LMHash, NTHash from common.types import NetworkPort from infection_monkey.exploit.log4shell_utils.ldap_server import LDAPServerFactory @@ -311,13 +311,13 @@ IAgentLogRepository IAgentLogRepository.upsert_agent_log IAgentLogRepository.get_agent_log -# TODO: Remove once #2268 is closed -PingScanEvent - # TODO: Remove once #2267 is closed TCPScanEvent TCPScanEvent.port_status +# TODO: Remove once #2269 is close +PropagationEvent + # pydantic base models underscore_attrs_are_private extra