From 125412ee189d23de60f4bd7f773c78137416a642 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Mon, 21 Feb 2022 14:50:33 +0530 Subject: [PATCH] Agent: Rename variables to make more sense --- monkey/infection_monkey/i_puppet/i_puppet.py | 2 +- monkey/infection_monkey/master/mock_master.py | 8 ++++---- monkey/infection_monkey/master/propagator.py | 4 ++-- monkey/infection_monkey/telemetry/exploit_telem.py | 12 +++++++----- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/monkey/infection_monkey/i_puppet/i_puppet.py b/monkey/infection_monkey/i_puppet/i_puppet.py index 0372b2910..79bd3b4fe 100644 --- a/monkey/infection_monkey/i_puppet/i_puppet.py +++ b/monkey/infection_monkey/i_puppet/i_puppet.py @@ -18,7 +18,7 @@ class UnknownPluginError(Exception): ExploiterResultData = namedtuple( "ExploiterResultData", - ["exploit_success", "propagation_success", "os", "info", "attempts", "error_message"], + ["exploitation_success", "propagation_success", "os", "info", "attempts", "error_message"], ) PingScanData = namedtuple("PingScanData", ["response_received", "os"]) PortScanData = namedtuple("PortScanData", ["port", "status", "banner", "service"]) diff --git a/monkey/infection_monkey/master/mock_master.py b/monkey/infection_monkey/master/mock_master.py index e75f3caf2..a7b62b1fd 100644 --- a/monkey/infection_monkey/master/mock_master.py +++ b/monkey/infection_monkey/master/mock_master.py @@ -102,7 +102,7 @@ class MockMaster(IMaster): def _exploit(self): logger.info("Exploiting victims") ( - exploit_result, + exploitation_result, propagation_result, os, info, @@ -114,7 +114,7 @@ class MockMaster(IMaster): ExploitTelem( "PowerShellExploiter", self._hosts["10.0.0.1"], - exploit_result, + exploitation_result, propagation_result, info, attempts, @@ -122,7 +122,7 @@ class MockMaster(IMaster): ) ( - exploit_result, + exploitation_result, propagation_result, os, info, @@ -134,7 +134,7 @@ class MockMaster(IMaster): ExploitTelem( "SSHExploiter", self._hosts["10.0.0.3"], - exploit_result, + exploitation_result, propagation_result, info, attempts, diff --git a/monkey/infection_monkey/master/propagator.py b/monkey/infection_monkey/master/propagator.py index 870d47d8e..e093c259c 100644 --- a/monkey/infection_monkey/master/propagator.py +++ b/monkey/infection_monkey/master/propagator.py @@ -155,7 +155,7 @@ class Propagator: ): if result.propagation_success: logger.info(f"Successfully propagated to {host} using {exploiter_name}") - elif result.exploit_success: + elif result.exploitation_success: logger.info( f"Successfully exploited (but did not propagate to) {host} using {exploiter_name}" ) @@ -169,7 +169,7 @@ class Propagator: ExploitTelem( exploiter_name, host, - result.exploit_success, + result.exploitation_success, result.propagation_success, result.info, result.attempts, diff --git a/monkey/infection_monkey/telemetry/exploit_telem.py b/monkey/infection_monkey/telemetry/exploit_telem.py index 898df4b3e..312a34592 100644 --- a/monkey/infection_monkey/telemetry/exploit_telem.py +++ b/monkey/infection_monkey/telemetry/exploit_telem.py @@ -10,7 +10,7 @@ class ExploitTelem(BaseTelem): self, name: str, host: VictimHost, - exploit_result: bool, + exploitation_result: bool, propagation_result: bool, info: Dict, attempts: List, @@ -19,8 +19,10 @@ class ExploitTelem(BaseTelem): Default exploit telemetry constructor :param name: The name of exploiter used :param host: The host machine - :param exploit_result: The result of exploitation from the 'exploit_host' method - :param propagation_result: The result of propagation from the 'exploit_host' method + :param exploitation_result: The result of the exploitation attempt from the 'exploit_host' + method + :param propagation_result: The result of the propagation attempt from the 'exploit_host' + method :param info: Information about the exploiter :param attempts: Information about the exploiter's attempts """ @@ -28,7 +30,7 @@ class ExploitTelem(BaseTelem): self.name = name self.host = host.__dict__ - self.exploit_result = exploit_result + self.exploitation_result = exploitation_result self.propagation_result = propagation_result self.info = info self.attempts = attempts @@ -37,7 +39,7 @@ class ExploitTelem(BaseTelem): def get_data(self) -> Dict: return { - "exploit_result": self.exploit_result, + "exploitation_result": self.exploitation_result, "propagation_result": self.propagation_result, "machine": self.host, "exploiter": self.name,