From 944c13fa528d5503f46cc5753ab3bb89ed50923f Mon Sep 17 00:00:00 2001 From: Vasilyy Balyasnyy Date: Sun, 10 Jan 2021 00:53:29 +0300 Subject: [PATCH 1/6] remove zap check in generic cracker Signed-off-by: Vasilyy Balyasnyy --- htpclient/generic_cracker.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htpclient/generic_cracker.py b/htpclient/generic_cracker.py index 81ea9d8..cb43f0e 100644 --- a/htpclient/generic_cracker.py +++ b/htpclient/generic_cracker.py @@ -96,14 +96,10 @@ def run_loop(self, process, chunk, task): elif ans['response'] != 'SUCCESS': logging.error("Error from server on solve: " + str(ans)) else: - if ans['zaps']: - with open("files/zap", "wb") as zapfile: # need to check if we are in the main dir here - zapfile.write('\n'.join(ans['zaps']).encode()) - zapfile.close() cracks = cracks_backup logging.info( "Progress: " + str(progress / 100) + "% Cracks: " + str(len(cracks)) + - " Accepted: " + str(ans['cracked']) + " Skips: " + str(ans['skipped']) + " Zaps: " + str(len(ans['zaps']))) + " Accepted: " + str(ans['cracked']) + " Skips: " + str(ans['skipped'])) else: line = line.decode() if ":" in line: From c58dd9e7b739bb5a1c56676054bb0603846dd55d Mon Sep 17 00:00:00 2001 From: Vasilyy Balyasnyy Date: Sun, 10 Jan 2021 00:54:00 +0300 Subject: [PATCH 2/6] add command line flag for attacked-hashlist Signed-off-by: Vasilyy Balyasnyy --- htpclient/generic_cracker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htpclient/generic_cracker.py b/htpclient/generic_cracker.py index cb43f0e..51ccf73 100644 --- a/htpclient/generic_cracker.py +++ b/htpclient/generic_cracker.py @@ -23,7 +23,7 @@ def __init__(self, cracker_id, binary_download): def run_chunk(self, task, chunk, preprocessor): args = " crack -s " + str(chunk['skip']) args += " -l " + str(chunk['length']) - args += " " + task['attackcmd'].replace(task['hashlistAlias'], "../hashlists/" + str(task['hashlistId'])) + args += " " + task['attackcmd'].replace(task['hashlistAlias'], "-a ../hashlists/" + str(task['hashlistId'])) full_cmd = self.callPath + args if Initialize.get_os() == 1: full_cmd = full_cmd.replace("/", '\\') @@ -136,7 +136,7 @@ def run_benchmark(self, task): ksp = self.keyspace if ksp == 0: ksp = task['keyspace'] - args = task['attackcmd'].replace(task['hashlistAlias'], "../hashlists/" + str(task['hashlistId'])) + args = task['attackcmd'].replace(task['hashlistAlias'], "-a ../hashlists/" + str(task['hashlistId'])) full_cmd = self.callPath + " crack " + args + " -s 0 -l " + str(ksp) + " --timeout=" + str(task['bench']) if Initialize.get_os() == 1: full_cmd = full_cmd.replace("/", '\\') From 684ddd996c0645ce561f2199c6c86c349be12617 Mon Sep 17 00:00:00 2001 From: Vasilyy Balyasnyy Date: Sun, 10 Jan 2021 00:54:32 +0300 Subject: [PATCH 3/6] fix generic cracker benchmark result format Signed-off-by: Vasilyy Balyasnyy --- htpclient/generic_cracker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htpclient/generic_cracker.py b/htpclient/generic_cracker.py index 51ccf73..f6fdb7b 100644 --- a/htpclient/generic_cracker.py +++ b/htpclient/generic_cracker.py @@ -159,7 +159,10 @@ def run_benchmark(self, task): req = JsonRequest(query) req.execute() return 0 - return float(last_valid_status.get_progress()) / 10000 + if task['benchType'] == 'speed': + return str(last_valid_status.get_progress()) + ":" + str(last_valid_status.get_speed()) + else: + return float(last_valid_status.get_progress()) / 10000 else: query = copy_and_set_token(dict_clientError, self.config.get_value('token')) query['taskId'] = task['taskId'] From caeffdd042ad93765ddd9e6cf819399d2caf62a6 Mon Sep 17 00:00:00 2001 From: Vasilyy Balyasnyy Date: Wed, 20 Jan 2021 00:46:23 +0300 Subject: [PATCH 4/6] add task cmdpars in generic cracker cmd need to setup --hash-type=... parameter to generic cracker call Signed-off-by: Vasilyy Balyasnyy --- htpclient/generic_cracker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htpclient/generic_cracker.py b/htpclient/generic_cracker.py index f6fdb7b..a5cfa5b 100644 --- a/htpclient/generic_cracker.py +++ b/htpclient/generic_cracker.py @@ -24,6 +24,8 @@ def run_chunk(self, task, chunk, preprocessor): args = " crack -s " + str(chunk['skip']) args += " -l " + str(chunk['length']) args += " " + task['attackcmd'].replace(task['hashlistAlias'], "-a ../hashlists/" + str(task['hashlistId'])) + args += ' ' + task['cmdpars'] + full_cmd = self.callPath + args if Initialize.get_os() == 1: full_cmd = full_cmd.replace("/", '\\') @@ -112,7 +114,7 @@ def run_loop(self, process, chunk, task): def measure_keyspace(self, task, chunk): task = task.get_task() - full_cmd = self.callPath + " keyspace " + task['attackcmd'].replace("-a " + task['hashlistAlias'] + " ", "") + full_cmd = self.callPath + " keyspace " + task['attackcmd'].replace("-a " + task['hashlistAlias'] + " ", "") + ' ' + task['cmdpars'] if Initialize.get_os() == 1: full_cmd = full_cmd.replace("/", '\\') try: @@ -137,7 +139,7 @@ def run_benchmark(self, task): if ksp == 0: ksp = task['keyspace'] args = task['attackcmd'].replace(task['hashlistAlias'], "-a ../hashlists/" + str(task['hashlistId'])) - full_cmd = self.callPath + " crack " + args + " -s 0 -l " + str(ksp) + " --timeout=" + str(task['bench']) + full_cmd = self.callPath + " crack " + args + " -s 0 -l " + str(ksp) + " --timeout=" + str(task['bench']) + ' ' + task['cmdpars'] if Initialize.get_os() == 1: full_cmd = full_cmd.replace("/", '\\') logging.debug("CALL: " + full_cmd) From 34bea1aecaa5b3693a7be10d51873336ac3114d0 Mon Sep 17 00:00:00 2001 From: Vasilyy Balyasnyy Date: Mon, 22 Feb 2021 22:37:30 +0300 Subject: [PATCH 5/6] fix hashlistAlias replace Server send hashlistAlias string in attack command. Client need to replace it with "-a path_to_hashlist_file". For keyspace execution we need just to remove hashlistAlias string. Signed-off-by: Vasilyy Balyasnyy --- htpclient/generic_cracker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htpclient/generic_cracker.py b/htpclient/generic_cracker.py index a5cfa5b..5aa1099 100644 --- a/htpclient/generic_cracker.py +++ b/htpclient/generic_cracker.py @@ -114,7 +114,7 @@ def run_loop(self, process, chunk, task): def measure_keyspace(self, task, chunk): task = task.get_task() - full_cmd = self.callPath + " keyspace " + task['attackcmd'].replace("-a " + task['hashlistAlias'] + " ", "") + ' ' + task['cmdpars'] + full_cmd = self.callPath + " keyspace " + task['attackcmd'].replace(task['hashlistAlias'] + " ", "") + ' ' + task['cmdpars'] if Initialize.get_os() == 1: full_cmd = full_cmd.replace("/", '\\') try: From 2019f7c3f855e89e462335dd62e29d455eb462ba Mon Sep 17 00:00:00 2001 From: Vasilyy Balyasnyy Date: Tue, 23 Mar 2021 01:45:10 +0300 Subject: [PATCH 6/6] join chunk main thread Signed-off-by: Vasilyy Balyasnyy --- htpclient/generic_cracker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/htpclient/generic_cracker.py b/htpclient/generic_cracker.py index 5aa1099..622258e 100644 --- a/htpclient/generic_cracker.py +++ b/htpclient/generic_cracker.py @@ -45,6 +45,7 @@ def run_chunk(self, task, chunk, preprocessor): process.wait() out_thread.join() err_thread.join() + main_thread.join() logging.info("finished chunk") def run_loop(self, process, chunk, task):