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

Update straight.c function parameters

This commit is contained in:
jsteube 2016-10-06 10:21:39 +02:00
parent 1610a3565c
commit 077a94600d
3 changed files with 33 additions and 28 deletions

View File

@ -10,9 +10,7 @@
#define INCR_DICTS 1000
int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig);
void straight_ctx_destroy (straight_ctx_t *straight_ctx);
void straight_append_dict (straight_ctx_t *straight_ctx, const char *dict);
int straight_ctx_init (hashcat_ctx_t *hashcat_ctx);
void straight_ctx_destroy (hashcat_ctx_t *hashcat_ctx);
#endif // _STRAIGHT_H

View File

@ -925,7 +925,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* straight mode init
*/
const int rc_straight_init = straight_ctx_init (straight_ctx, user_options, user_options_extra, hashconfig);
const int rc_straight_init = straight_ctx_init (hashcat_ctx);
if (rc_straight_init == -1) return -1;
@ -1224,7 +1224,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
combinator_ctx_destroy (hashcat_ctx);
straight_ctx_destroy (straight_ctx);
straight_ctx_destroy (hashcat_ctx);
hashes_destroy (hashes);

View File

@ -18,8 +18,27 @@
#include "rp_cpu.h"
#include "straight.h"
int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig)
static void straight_ctx_add_wl (straight_ctx_t *straight_ctx, const char *dict)
{
if (straight_ctx->dicts_avail == straight_ctx->dicts_cnt)
{
straight_ctx->dicts = (char **) myrealloc (straight_ctx->dicts, straight_ctx->dicts_avail * sizeof (char *), INCR_DICTS * sizeof (char *));
straight_ctx->dicts_avail += INCR_DICTS;
}
straight_ctx->dicts[straight_ctx->dicts_cnt] = mystrdup (dict);
straight_ctx->dicts_cnt++;
}
int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options;
straight_ctx->enabled = false;
if (user_options->left == true) return 0;
@ -144,7 +163,7 @@ int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_
if (S_ISREG (l1_stat.st_mode))
{
straight_append_dict (straight_ctx, l1_filename);
straight_ctx_add_wl (straight_ctx, l1_filename);
}
}
}
@ -153,7 +172,7 @@ int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_
}
else
{
straight_append_dict (straight_ctx, l0_filename);
straight_ctx_add_wl (straight_ctx, l0_filename);
}
}
@ -213,7 +232,7 @@ int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_
if (S_ISREG (l1_stat.st_mode))
{
straight_append_dict (straight_ctx, l1_filename);
straight_ctx_add_wl (straight_ctx, l1_filename);
}
}
}
@ -222,7 +241,7 @@ int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_
}
else
{
straight_append_dict (straight_ctx, l0_filename);
straight_ctx_add_wl (straight_ctx, l0_filename);
}
}
@ -273,7 +292,7 @@ int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_
if (S_ISREG (l1_stat.st_mode))
{
straight_append_dict (straight_ctx, l1_filename);
straight_ctx_add_wl (straight_ctx, l1_filename);
}
}
}
@ -282,7 +301,7 @@ int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_
}
else
{
straight_append_dict (straight_ctx, l0_filename);
straight_ctx_add_wl (straight_ctx, l0_filename);
}
}
@ -297,8 +316,10 @@ int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_
return 0;
}
void straight_ctx_destroy (straight_ctx_t *straight_ctx)
void straight_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
{
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
if (straight_ctx->enabled == false) return;
for (u32 dict_pos = 0; dict_pos < straight_ctx->dicts_cnt; dict_pos++)
@ -312,17 +333,3 @@ void straight_ctx_destroy (straight_ctx_t *straight_ctx)
memset (straight_ctx, 0, sizeof (straight_ctx_t));
}
void straight_append_dict (straight_ctx_t *straight_ctx, const char *dict)
{
if (straight_ctx->dicts_avail == straight_ctx->dicts_cnt)
{
straight_ctx->dicts = (char **) myrealloc (straight_ctx->dicts, straight_ctx->dicts_avail * sizeof (char *), INCR_DICTS * sizeof (char *));
straight_ctx->dicts_avail += INCR_DICTS;
}
straight_ctx->dicts[straight_ctx->dicts_cnt] = mystrdup (dict);
straight_ctx->dicts_cnt++;
}