Skip to content

Commit 211b728

Browse files
authored
Merge pull request #54 from hashtopolis/healthcheck
Refactored healthcheck
2 parents 54c853b + 9adfb5e commit 211b728

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def run_health_check():
7070
if len(states) > 0:
7171
num_gpus = len(states[0].get_temps())
7272
else:
73-
errors.append("Faild to retrieve one successful cracker state, most likely due to failing.")
73+
errors.append("Failed to retrieve one successful cracker state, most likely due to failing.")
7474
num_gpus = 0
7575
query = copy_and_set_token(dict_sendHealthCheck, CONFIG.get_value('token'))
7676
query['checkId'] = check_id

htpclient/hashcat_cracker.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,26 @@ def agent_stopped(self):
720720
return self.wasStopped
721721

722722
def run_health_check(self, attack, hashlist_alias):
723-
args = " --machine-readable --quiet"
724-
args += " --restore-disable --potfile-disable --session=health "
725-
args += update_files(attack).replace(hashlist_alias, "'" + self.config.get_value('hashlists-path') + "/health_check.txt'")
726-
args += " -o '" + self.config.get_value('hashlists-path') + "/health_check.out'"
727-
full_cmd = f"{self.callPath}" + args
723+
args = []
724+
args.append('--machine-readable')
725+
args.append('--quiet')
726+
args.append('--restore-disable')
727+
args.append('--potfile-disable')
728+
args.append('--session=health')
729+
attackcmd = update_files(attack)
730+
hashlist_path = Path(self.config.get_value('hashlists-path'), "health_check.txt")
731+
hashlist_out_path = Path(self.config.get_value('hashlists-path'), "health_check.out")
732+
733+
# Replace #HL# with the real hashlist
734+
attackcmd = attackcmd.replace(hashlist_alias, f'"{hashlist_path}"')
735+
736+
args.append(attackcmd)
737+
args.append('-o')
738+
args.append(f'"{hashlist_out_path}"')
739+
740+
full_cmd = ' '.join(args)
741+
full_cmd = f"{self.callPath} {full_cmd}"
742+
728743
if Initialize.get_os() == 1:
729744
full_cmd = full_cmd.replace("/", '\\')
730745
logging.debug(f"CALL: {''.join(full_cmd)}")

0 commit comments

Comments
 (0)