1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 09:58:16 +00:00

Add some more returncode checks

This commit is contained in:
jsteube 2016-10-15 19:47:53 +02:00
parent bfbc4279f4
commit 7bcbbbea74
3 changed files with 21 additions and 7 deletions

View File

@ -6,6 +6,6 @@
#ifndef _WEAK_HASH_H #ifndef _WEAK_HASH_H
#define _WEAK_HASH_H #define _WEAK_HASH_H
void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 salt_pos); int weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 salt_pos);
#endif // _WEAK_HASH_H #endif // _WEAK_HASH_H

View File

@ -696,7 +696,9 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++) for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{ {
weak_hash_check (hashcat_ctx, device_param, salt_pos); const int CL_rc = weak_hash_check (hashcat_ctx, device_param, salt_pos);
if (CL_rc == -1) return -1;
} }
EVENT (EVENT_WEAK_HASH_POST); EVENT (EVENT_WEAK_HASH_POST);

View File

@ -10,7 +10,7 @@
#include "hashes.h" #include "hashes.h"
#include "weak_hash.h" #include "weak_hash.h"
void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 salt_pos) int weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 salt_pos)
{ {
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes; hashes_t *hashes = hashcat_ctx->hashes;
@ -33,13 +33,19 @@ void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
* run the kernel * run the kernel
*/ */
int CL_rc;
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{ {
run_kernel (hashcat_ctx, device_param, KERN_RUN_1, 1, false, 0); CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_1, 1, false, 0);
if (CL_rc == -1) return -1;
} }
else else
{ {
run_kernel (hashcat_ctx, device_param, KERN_RUN_1, 1, false, 0); CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_1, 1, false, 0);
if (CL_rc == -1) return -1;
u32 loop_step = 16; u32 loop_step = 16;
@ -54,10 +60,14 @@ void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
device_param->kernel_params_buf32[28] = loop_pos; device_param->kernel_params_buf32[28] = loop_pos;
device_param->kernel_params_buf32[29] = loop_left; device_param->kernel_params_buf32[29] = loop_left;
run_kernel (hashcat_ctx, device_param, KERN_RUN_2, 1, false, 0); CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_2, 1, false, 0);
if (CL_rc == -1) return -1;
} }
run_kernel (hashcat_ctx, device_param, KERN_RUN_3, 1, false, 0); CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_3, 1, false, 0);
if (CL_rc == -1) return -1;
} }
/** /**
@ -80,4 +90,6 @@ void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
device_param->kernel_params_buf32[34] = 0; device_param->kernel_params_buf32[34] = 0;
straight_ctx->kernel_rules_buf[0].cmds[0] = cmd0_rule_old; straight_ctx->kernel_rules_buf[0].cmds[0] = cmd0_rule_old;
return 0;
} }