diff --git a/monkey/infection_monkey/exploit/HostExploiter.py b/monkey/infection_monkey/exploit/HostExploiter.py index a6d53a02f..c584cf828 100644 --- a/monkey/infection_monkey/exploit/HostExploiter.py +++ b/monkey/infection_monkey/exploit/HostExploiter.py @@ -3,6 +3,7 @@ import threading from abc import abstractmethod from datetime import datetime from ipaddress import IPv4Address +from time import time from typing import Dict, Sequence, Tuple from common.agent_events import ExploitationEvent, PropagationEvent @@ -140,32 +141,36 @@ class HostExploiter: def _publish_exploitation_event( self, - exploitation_success: bool, + time: float = time(), + success: bool = False, tags: Tuple[str, ...] = tuple(), error_message: str = "", ): exploitation_event = ExploitationEvent( source=get_agent_id(), target=IPv4Address(self.host.ip_addr), - success=exploitation_success, + success=success, exploiter_name=self.__class__.__name__, error_message=error_message, + timestamp=time, tags=frozenset(tags or self._exploiter_tags), ) self.agent_event_queue.publish(exploitation_event) def _publish_propagation_event( self, - propagation_success: bool, + time: float = time(), + success: bool = False, tags: Tuple[str, ...] = tuple(), error_message: str = "", ): propagation_event = PropagationEvent( source=get_agent_id(), target=IPv4Address(self.host.ip_addr), - success=propagation_success, + success=success, exploiter_name=self.__class__.__name__, error_message=error_message, + timestamp=time, tags=frozenset(tags or self._propagation_tags), ) self.agent_event_queue.publish(propagation_event)