agent: Add telemetry messenger interface
The telemetry classes have too many responsibilities. At the moment, one such responsibility is to send themselves to the island. As our plugin interfaces develop, the need may arise to send telemetry using different mechanisms. To isolate the RansomwarePayload from these changes, the ITelemetryMessenger interface is introduced in this commit. It provides a send_telemetry() method that handles the specific details of how telemetry is sent to the Island. At the present time, the TelemetryMessengerWrapper class is introduced to handle sending telemetry. It simply wraps the existing send() method on the telemetry class.
This commit is contained in:
parent
cec8341b17
commit
77e3c8a257
|
@ -0,0 +1,9 @@
|
|||
import abc
|
||||
|
||||
from infection_monkey.telemetry.base_telem import BaseTelem
|
||||
|
||||
|
||||
class ITelemetryMessenger(metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def send_telemetry(self, telemetry: BaseTelem):
|
||||
pass
|
|
@ -0,0 +1,7 @@
|
|||
from infection_monkey.telemetry.base_telem import BaseTelem
|
||||
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
||||
|
||||
|
||||
class TelemetryMessengerWrapper(ITelemetryMessenger):
|
||||
def send_telemetry(self, telemetry: BaseTelem):
|
||||
telemetry.send()
|
Loading…
Reference in New Issue