From c322446aee84a9b6f5b7664402e3cfd657d04c3d Mon Sep 17 00:00:00 2001 From: vakarisz Date: Mon, 7 Mar 2022 16:42:57 +0200 Subject: [PATCH] Agent: use exploit_results in zerologon --- monkey/infection_monkey/exploit/zerologon.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/monkey/infection_monkey/exploit/zerologon.py b/monkey/infection_monkey/exploit/zerologon.py index 2ad1b0a36..0590326f3 100644 --- a/monkey/infection_monkey/exploit/zerologon.py +++ b/monkey/infection_monkey/exploit/zerologon.py @@ -22,6 +22,7 @@ from infection_monkey.exploit.zerologon_utils.dump_secrets import DumpSecrets from infection_monkey.exploit.zerologon_utils.options import OptionsForSecretsdump from infection_monkey.exploit.zerologon_utils.vuln_assessment import get_dc_details, is_exploitable from infection_monkey.exploit.zerologon_utils.wmiexec import Wmiexec +from infection_monkey.i_puppet import ExploiterResultData from infection_monkey.i_puppet.credential_collection import Credentials from infection_monkey.telemetry.credentials_telem import CredentialsTelem from infection_monkey.utils.capture_output import StdoutCapture @@ -46,11 +47,12 @@ class ZerologonExploiter(HostExploiter): def __del__(self): self._secrets_dir.cleanup() - def _exploit_host(self) -> bool: + def _exploit_host(self) -> ExploiterResultData: self.dc_ip, self.dc_name, self.dc_handle = get_dc_details(self.host) can_exploit, rpc_con = is_exploitable(self) if can_exploit: + self.exploit_result.exploitation_success = True logger.info("Target vulnerable, changing account password to empty string.") # Start exploiting attempts. @@ -64,10 +66,11 @@ class ZerologonExploiter(HostExploiter): "Exploit not attempted. Target is most likely patched, or an error was " "encountered." ) - return False + return self.exploit_result # Restore DC's original password. if _exploited: + self.exploit_result.propagation_success = True if self.restore_password(): self.exploit_info["password_restored"] = True self.store_extracted_creds_for_exploitation() @@ -78,7 +81,7 @@ class ZerologonExploiter(HostExploiter): else: logger.info("System was not exploited.") - return _exploited + return self.exploit_result @staticmethod def connect_to_dc(dc_ip) -> object: