From 9adfb5e02b5247845673c10b73f87ab3f59c8664 Mon Sep 17 00:00:00 2001 From: jessevz Date: Thu, 15 May 2025 17:11:01 +0200 Subject: [PATCH] Refactored healthcheck --- __main__.py | 2 +- htpclient/hashcat_cracker.py | 25 ++++++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/__main__.py b/__main__.py index b8dce22..b1be0fd 100644 --- a/__main__.py +++ b/__main__.py @@ -70,7 +70,7 @@ def run_health_check(): if len(states) > 0: num_gpus = len(states[0].get_temps()) else: - errors.append("Faild to retrieve one successful cracker state, most likely due to failing.") + errors.append("Failed to retrieve one successful cracker state, most likely due to failing.") num_gpus = 0 query = copy_and_set_token(dict_sendHealthCheck, CONFIG.get_value('token')) query['checkId'] = check_id diff --git a/htpclient/hashcat_cracker.py b/htpclient/hashcat_cracker.py index a5eca75..06f900b 100644 --- a/htpclient/hashcat_cracker.py +++ b/htpclient/hashcat_cracker.py @@ -720,11 +720,26 @@ def agent_stopped(self): return self.wasStopped def run_health_check(self, attack, hashlist_alias): - args = " --machine-readable --quiet" - args += " --restore-disable --potfile-disable --session=health " - args += update_files(attack).replace(hashlist_alias, "'" + self.config.get_value('hashlists-path') + "/health_check.txt'") - args += " -o '" + self.config.get_value('hashlists-path') + "/health_check.out'" - full_cmd = f"{self.callPath}" + args + args = [] + args.append('--machine-readable') + args.append('--quiet') + args.append('--restore-disable') + args.append('--potfile-disable') + args.append('--session=health') + attackcmd = update_files(attack) + hashlist_path = Path(self.config.get_value('hashlists-path'), "health_check.txt") + hashlist_out_path = Path(self.config.get_value('hashlists-path'), "health_check.out") + + # Replace #HL# with the real hashlist + attackcmd = attackcmd.replace(hashlist_alias, f'"{hashlist_path}"') + + args.append(attackcmd) + args.append('-o') + args.append(f'"{hashlist_out_path}"') + + full_cmd = ' '.join(args) + full_cmd = f"{self.callPath} {full_cmd}" + if Initialize.get_os() == 1: full_cmd = full_cmd.replace("/", '\\') logging.debug(f"CALL: {''.join(full_cmd)}")