forked from p15670423/monkey
agent: Rename TelemetryMessengerWrapper
The term "wrapper" is sometimes used as synonym for the decorator pattern, whereas this class is a textbook adapter. Use the term "adapter" instead of "wrapper" and rename "TelemetryMessengerWrapper" to "LegacyTelemetryMessengerAdapter", as this class servers as an adapter between the new ITelemetryMessenger interface and the (soon to be) legacy way of sending telemetry.
This commit is contained in:
parent
a0b43a17a2
commit
e549a4f8f4
|
@ -25,8 +25,8 @@ from infection_monkey.system_singleton import SystemSingleton
|
|||
from infection_monkey.telemetry.attack.t1106_telem import T1106Telem
|
||||
from infection_monkey.telemetry.attack.t1107_telem import T1107Telem
|
||||
from infection_monkey.telemetry.attack.victim_host_telem import VictimHostTelem
|
||||
from infection_monkey.telemetry.messengers.telemetry_messenger_wrapper import (
|
||||
TelemetryMessengerWrapper,
|
||||
from infection_monkey.telemetry.messengers.legacy_telemetry_messenger_adapter import (
|
||||
LegacyTelemetryMessengerAdapter,
|
||||
)
|
||||
from infection_monkey.telemetry.scan_telem import ScanTelem
|
||||
from infection_monkey.telemetry.state_telem import StateTelem
|
||||
|
@ -470,7 +470,7 @@ class InfectionMonkey(object):
|
|||
@staticmethod
|
||||
def run_ransomware():
|
||||
try:
|
||||
telemetry_messenger = TelemetryMessengerWrapper()
|
||||
telemetry_messenger = LegacyTelemetryMessengerAdapter()
|
||||
RansomewarePayload(WormConfiguration.ransomware, telemetry_messenger).run_payload()
|
||||
except Exception as ex:
|
||||
LOG.error(f"An unexpected error occurred while running the ransomware payload: {ex}")
|
||||
|
|
|
@ -2,6 +2,11 @@ from infection_monkey.telemetry.i_telem import ITelem
|
|||
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
||||
|
||||
|
||||
class TelemetryMessengerWrapper(ITelemetryMessenger):
|
||||
class LegacyTelemetryMessengerAdapter(ITelemetryMessenger):
|
||||
"""
|
||||
Provides an adapter between modules that require an ITelemetryMessenger and the
|
||||
legacy method for sending telemetry.
|
||||
"""
|
||||
|
||||
def send_telemetry(self, telemetry: ITelem):
|
||||
telemetry.send()
|
Loading…
Reference in New Issue