1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-16 03:38:19 +00:00

Add some more returncode checks

This commit is contained in:
jsteube 2016-10-15 19:30:57 +02:00
parent e10c41c831
commit 7383bb14f5
4 changed files with 542 additions and 540 deletions

View File

@ -10,9 +10,9 @@
#include <time.h> #include <time.h>
#include <inttypes.h> #include <inttypes.h>
void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u32 *plain_buf, int *out_len); int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u32 *plain_buf, int *out_len);
void build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u64 *out_pos); int build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u64 *out_pos);
void build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u8 *debug_rule_buf, int *debug_rule_len, u8 *debug_plain_ptr, int *debug_plain_len); int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u8 *debug_rule_buf, int *debug_rule_len, u8 *debug_plain_ptr, int *debug_plain_len);
int outfile_init (hashcat_ctx_t *hashcat_ctx); int outfile_init (hashcat_ctx_t *hashcat_ctx);
void outfile_destroy (hashcat_ctx_t *hashcat_ctx); void outfile_destroy (hashcat_ctx_t *hashcat_ctx);

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@
#include "opencl.h" #include "opencl.h"
#include "outfile.h" #include "outfile.h"
void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u32 *plain_buf, int *out_len) int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u32 *plain_buf, int *out_len)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig; hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -36,7 +36,9 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
{ {
pw_t pw; pw_t pw;
gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw); const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
@ -55,7 +57,9 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
{ {
pw_t pw; pw_t pw;
gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw); const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
@ -105,7 +109,9 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
{ {
pw_t pw; pw_t pw;
gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw); const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
@ -132,7 +138,9 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
{ {
pw_t pw; pw_t pw;
gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw); const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
@ -183,9 +191,11 @@ void build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, p
} }
*out_len = plain_len; *out_len = plain_len;
return 0;
} }
void build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u64 *out_pos) int build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u64 *out_pos)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
@ -217,9 +227,11 @@ void build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
} }
*out_pos = crackpos; *out_pos = crackpos;
return 0;
} }
void build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u8 *debug_rule_buf, int *debug_rule_len, u8 *debug_plain_ptr, int *debug_plain_len) int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain, u8 *debug_rule_buf, int *debug_rule_len, u8 *debug_plain_ptr, int *debug_plain_len)
{ {
debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx; debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
@ -228,15 +240,17 @@ void build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
const u32 gidvid = plain->gidvid; const u32 gidvid = plain->gidvid;
const u32 il_pos = plain->il_pos; const u32 il_pos = plain->il_pos;
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT) return; if (user_options->attack_mode != ATTACK_MODE_STRAIGHT) return 0;
const u32 debug_mode = debugfile_ctx->mode; const u32 debug_mode = debugfile_ctx->mode;
if (debug_mode == 0) return; if (debug_mode == 0) return 0;
pw_t pw; pw_t pw;
gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw); const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
int plain_len = (int) pw.pw_len; int plain_len = (int) pw.pw_len;
@ -255,6 +269,8 @@ void build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
*debug_plain_len = plain_len; *debug_plain_len = plain_len;
} }
return 0;
} }
int outfile_init (hashcat_ctx_t *hashcat_ctx) int outfile_init (hashcat_ctx_t *hashcat_ctx)

View File

@ -84,7 +84,9 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++) for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
{ {
gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw); const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
const u32 pos = device_param->innerloop_pos; const u32 pos = device_param->innerloop_pos;
@ -111,7 +113,9 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++) for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
{ {
gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw); const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{ {
@ -177,7 +181,9 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++) for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
{ {
gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw); const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{ {
@ -207,7 +213,9 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++) for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
{ {
gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw); const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{ {