Agent: Add abstract properties for exploiter tags

This commit is contained in:
Kekoa Kaaikala 2022-10-05 17:32:48 +00:00
parent 95b1d9c62d
commit 12e9aaf42e
1 changed files with 12 additions and 2 deletions

View File

@ -24,6 +24,16 @@ class HostExploiter:
def _EXPLOITED_SERVICE(self): def _EXPLOITED_SERVICE(self):
pass pass
@property
@abstractmethod
def _exploiter_tags(self) -> Tuple[str, ...]:
pass
@property
@abstractmethod
def _propagation_tags(self) -> Tuple[str, ...]:
pass
def __init__(self): def __init__(self):
self.exploit_info = { self.exploit_info = {
"display_name": self._EXPLOITED_SERVICE, "display_name": self._EXPLOITED_SERVICE,
@ -140,7 +150,7 @@ class HostExploiter:
success=exploitation_success, success=exploitation_success,
exploiter_name=self.__class__.__name__, exploiter_name=self.__class__.__name__,
error_message=error_message, error_message=error_message,
tags=frozenset(tags), tags=frozenset(tags or self._exploiter_tags),
) )
self.agent_event_queue.publish(exploitation_event) self.agent_event_queue.publish(exploitation_event)
@ -156,6 +166,6 @@ class HostExploiter:
success=propagation_success, success=propagation_success,
exploiter_name=self.__class__.__name__, exploiter_name=self.__class__.__name__,
error_message=error_message, error_message=error_message,
tags=frozenset(tags), tags=frozenset(tags or self._propagation_tags),
) )
self.agent_event_queue.publish(propagation_event) self.agent_event_queue.publish(propagation_event)