forked from p15670423/monkey
Agent: Modify ExploitTelem to accept param of type ExploiterResultData
This commit is contained in:
parent
1cce742692
commit
afb7210179
|
@ -101,44 +101,16 @@ class MockMaster(IMaster):
|
||||||
|
|
||||||
def _exploit(self):
|
def _exploit(self):
|
||||||
logger.info("Exploiting victims")
|
logger.info("Exploiting victims")
|
||||||
(
|
result = self._puppet.exploit_host("PowerShellExploiter", "10.0.0.1", {}, None)
|
||||||
exploitation_result,
|
logger.info(f"Attempts for exploiting {result.attempts}")
|
||||||
propagation_result,
|
|
||||||
os,
|
|
||||||
info,
|
|
||||||
attempts,
|
|
||||||
error_message,
|
|
||||||
) = self._puppet.exploit_host("PowerShellExploiter", "10.0.0.1", {}, None)
|
|
||||||
logger.info(f"Attempts for exploiting {attempts}")
|
|
||||||
self._telemetry_messenger.send_telemetry(
|
self._telemetry_messenger.send_telemetry(
|
||||||
ExploitTelem(
|
ExploitTelem("PowerShellExploiter", self._hosts["10.0.0.1"], result)
|
||||||
"PowerShellExploiter",
|
|
||||||
self._hosts["10.0.0.1"],
|
|
||||||
exploitation_result,
|
|
||||||
propagation_result,
|
|
||||||
info,
|
|
||||||
attempts,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(
|
result = self._puppet.exploit_host("SSHExploiter", "10.0.0.3", {}, None)
|
||||||
exploitation_result,
|
logger.info(f"Attempts for exploiting {result.attempts}")
|
||||||
propagation_result,
|
|
||||||
os,
|
|
||||||
info,
|
|
||||||
attempts,
|
|
||||||
error_message,
|
|
||||||
) = self._puppet.exploit_host("SSHExploiter", "10.0.0.3", {}, None)
|
|
||||||
logger.info(f"Attempts for exploiting {attempts}")
|
|
||||||
self._telemetry_messenger.send_telemetry(
|
self._telemetry_messenger.send_telemetry(
|
||||||
ExploitTelem(
|
ExploitTelem("SSHExploiter", self._hosts["10.0.0.3"], result)
|
||||||
"SSHExploiter",
|
|
||||||
self._hosts["10.0.0.3"],
|
|
||||||
exploitation_result,
|
|
||||||
propagation_result,
|
|
||||||
info,
|
|
||||||
attempts,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
logger.info("Finished exploiting victims")
|
logger.info("Finished exploiting victims")
|
||||||
|
|
||||||
|
|
|
@ -165,13 +165,4 @@ class Propagator:
|
||||||
f"{result.error_message}"
|
f"{result.error_message}"
|
||||||
)
|
)
|
||||||
|
|
||||||
self._telemetry_messenger.send_telemetry(
|
self._telemetry_messenger.send_telemetry(ExploitTelem(exploiter_name, host, result))
|
||||||
ExploitTelem(
|
|
||||||
exploiter_name,
|
|
||||||
host,
|
|
||||||
result.exploitation_success,
|
|
||||||
result.propagation_success,
|
|
||||||
result.info,
|
|
||||||
result.attempts,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
from typing import Dict, List
|
from typing import Dict
|
||||||
|
|
||||||
from common.common_consts.telem_categories import TelemCategoryEnum
|
from common.common_consts.telem_categories import TelemCategoryEnum
|
||||||
from infection_monkey.model.host import VictimHost
|
from infection_monkey.model.host import VictimHost
|
||||||
from infection_monkey.telemetry.base_telem import BaseTelem
|
from infection_monkey.telemetry.base_telem import BaseTelem
|
||||||
|
from monkey.infection_monkey.i_puppet.i_puppet import ExploiterResultData
|
||||||
|
|
||||||
|
|
||||||
class ExploitTelem(BaseTelem):
|
class ExploitTelem(BaseTelem):
|
||||||
|
@ -10,30 +11,22 @@ class ExploitTelem(BaseTelem):
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
host: VictimHost,
|
host: VictimHost,
|
||||||
exploitation_result: bool,
|
result: ExploiterResultData,
|
||||||
propagation_result: bool,
|
|
||||||
info: Dict,
|
|
||||||
attempts: List,
|
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Default exploit telemetry constructor
|
Default exploit telemetry constructor
|
||||||
:param name: The name of exploiter used
|
:param name: The name of exploiter used
|
||||||
:param host: The host machine
|
:param host: The host machine
|
||||||
:param exploitation_result: The result of the exploitation attempt from the 'exploit_host'
|
:param result: Data about the exploitation attempt (success status, info, attempts, etc)
|
||||||
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
|
|
||||||
"""
|
"""
|
||||||
super(ExploitTelem, self).__init__()
|
super(ExploitTelem, self).__init__()
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.host = host.__dict__
|
self.host = host.__dict__
|
||||||
self.exploitation_result = exploitation_result
|
self.exploitation_result = result.exploitation_success
|
||||||
self.propagation_result = propagation_result
|
self.propagation_result = result.propagation_success
|
||||||
self.info = info
|
self.info = result.info
|
||||||
self.attempts = attempts
|
self.attempts = result.attempts
|
||||||
|
|
||||||
telem_category = TelemCategoryEnum.EXPLOIT
|
telem_category = TelemCategoryEnum.EXPLOIT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue