mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-23 00:28:11 +00:00
Centralize hashcat_ctx memory allocation and deallocation
This commit is contained in:
parent
d0e3b858c8
commit
9413ed8f56
23
src/bitmap.c
23
src/bitmap.c
@ -133,17 +133,7 @@ void bitmap_ctx_init (bitmap_ctx_t *bitmap_ctx, const user_options_t *user_optio
|
|||||||
|
|
||||||
void bitmap_ctx_destroy (bitmap_ctx_t *bitmap_ctx)
|
void bitmap_ctx_destroy (bitmap_ctx_t *bitmap_ctx)
|
||||||
{
|
{
|
||||||
if (bitmap_ctx->enabled == false)
|
if (bitmap_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (bitmap_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bitmap_ctx->bitmap_size = 0;
|
|
||||||
bitmap_ctx->bitmap_mask = 0;
|
|
||||||
bitmap_ctx->bitmap_shift1 = 0;
|
|
||||||
bitmap_ctx->bitmap_shift2 = 0;
|
|
||||||
|
|
||||||
myfree (bitmap_ctx->bitmap_s1_a);
|
myfree (bitmap_ctx->bitmap_s1_a);
|
||||||
myfree (bitmap_ctx->bitmap_s1_b);
|
myfree (bitmap_ctx->bitmap_s1_b);
|
||||||
@ -154,14 +144,5 @@ void bitmap_ctx_destroy (bitmap_ctx_t *bitmap_ctx)
|
|||||||
myfree (bitmap_ctx->bitmap_s2_c);
|
myfree (bitmap_ctx->bitmap_s2_c);
|
||||||
myfree (bitmap_ctx->bitmap_s2_d);
|
myfree (bitmap_ctx->bitmap_s2_d);
|
||||||
|
|
||||||
bitmap_ctx->bitmap_s1_a = NULL;
|
memset (bitmap_ctx, 0, sizeof (bitmap_ctx_t));
|
||||||
bitmap_ctx->bitmap_s1_b = NULL;
|
|
||||||
bitmap_ctx->bitmap_s1_c = NULL;
|
|
||||||
bitmap_ctx->bitmap_s1_d = NULL;
|
|
||||||
bitmap_ctx->bitmap_s2_a = NULL;
|
|
||||||
bitmap_ctx->bitmap_s2_b = NULL;
|
|
||||||
bitmap_ctx->bitmap_s2_c = NULL;
|
|
||||||
bitmap_ctx->bitmap_s2_d = NULL;
|
|
||||||
|
|
||||||
myfree (bitmap_ctx);
|
|
||||||
}
|
}
|
||||||
|
@ -31,13 +31,7 @@ int combinator_ctx_init (combinator_ctx_t *combinator_ctx, const user_options_t
|
|||||||
|
|
||||||
void combinator_ctx_destroy (combinator_ctx_t *combinator_ctx)
|
void combinator_ctx_destroy (combinator_ctx_t *combinator_ctx)
|
||||||
{
|
{
|
||||||
if (combinator_ctx->enabled == false)
|
if (combinator_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (combinator_ctx);
|
|
||||||
|
|
||||||
return;
|
memset (combinator_ctx, 0, sizeof (combinator_ctx_t));
|
||||||
}
|
|
||||||
|
|
||||||
myfree (combinator_ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,16 +34,11 @@ int cpt_ctx_init (cpt_ctx_t *cpt_ctx, const user_options_t *user_options)
|
|||||||
|
|
||||||
void cpt_ctx_destroy (cpt_ctx_t *cpt_ctx)
|
void cpt_ctx_destroy (cpt_ctx_t *cpt_ctx)
|
||||||
{
|
{
|
||||||
if (cpt_ctx->enabled == false)
|
if (cpt_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (cpt_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
myfree (cpt_ctx->cpt_buf);
|
myfree (cpt_ctx->cpt_buf);
|
||||||
|
|
||||||
myfree (cpt_ctx);
|
memset (cpt_ctx, 0, sizeof (cpt_ctx_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpt_ctx_reset (cpt_ctx_t *cpt_ctx)
|
void cpt_ctx_reset (cpt_ctx_t *cpt_ctx)
|
||||||
|
@ -50,19 +50,14 @@ int debugfile_init (debugfile_ctx_t *debugfile_ctx, const user_options_t *user_o
|
|||||||
|
|
||||||
void debugfile_destroy (debugfile_ctx_t *debugfile_ctx)
|
void debugfile_destroy (debugfile_ctx_t *debugfile_ctx)
|
||||||
{
|
{
|
||||||
if (debugfile_ctx->enabled == false)
|
if (debugfile_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (debugfile_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (debugfile_ctx->filename)
|
if (debugfile_ctx->filename)
|
||||||
{
|
{
|
||||||
fclose (debugfile_ctx->fp);
|
fclose (debugfile_ctx->fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
myfree (debugfile_ctx);
|
memset (debugfile_ctx, 0, sizeof (debugfile_ctx_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
void debugfile_format_plain (debugfile_ctx_t *debugfile_ctx, const u8 *plain_ptr, const u32 plain_len)
|
void debugfile_format_plain (debugfile_ctx_t *debugfile_ctx, const u8 *plain_ptr, const u32 plain_len)
|
||||||
|
@ -48,17 +48,12 @@ void dictstat_init (dictstat_ctx_t *dictstat_ctx, const user_options_t *user_opt
|
|||||||
|
|
||||||
void dictstat_destroy (dictstat_ctx_t *dictstat_ctx)
|
void dictstat_destroy (dictstat_ctx_t *dictstat_ctx)
|
||||||
{
|
{
|
||||||
if (dictstat_ctx->enabled == false)
|
if (dictstat_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (dictstat_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
myfree (dictstat_ctx->filename);
|
myfree (dictstat_ctx->filename);
|
||||||
myfree (dictstat_ctx->base);
|
myfree (dictstat_ctx->base);
|
||||||
|
|
||||||
myfree (dictstat_ctx);
|
memset (dictstat_ctx, 0, sizeof (dictstat_ctx_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dictstat_read (dictstat_ctx_t *dictstat_ctx, const int comptime)
|
void dictstat_read (dictstat_ctx_t *dictstat_ctx, const int comptime)
|
||||||
|
@ -415,14 +415,7 @@ void folder_config_destroy (folder_config_t *folder_config)
|
|||||||
myfree (folder_config->cwd);
|
myfree (folder_config->cwd);
|
||||||
myfree (folder_config->install_dir);
|
myfree (folder_config->install_dir);
|
||||||
|
|
||||||
folder_config->cpath_real = NULL;
|
memset (folder_config, 0, sizeof (folder_config_t));
|
||||||
folder_config->cwd = NULL;
|
|
||||||
folder_config->install_dir = NULL;
|
|
||||||
folder_config->profile_dir = NULL;
|
|
||||||
folder_config->session_dir = NULL;
|
|
||||||
folder_config->shared_dir = NULL;
|
|
||||||
|
|
||||||
myfree (folder_config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int hc_mkdir (const char *name, int mode)
|
int hc_mkdir (const char *name, int mode)
|
||||||
|
183
src/hashcat.c
183
src/hashcat.c
@ -56,6 +56,62 @@
|
|||||||
extern const u32 DEFAULT_BENCHMARK_ALGORITHMS_CNT;
|
extern const u32 DEFAULT_BENCHMARK_ALGORITHMS_CNT;
|
||||||
extern const u32 DEFAULT_BENCHMARK_ALGORITHMS_BUF[];
|
extern const u32 DEFAULT_BENCHMARK_ALGORITHMS_BUF[];
|
||||||
|
|
||||||
|
static void hashcat_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
hashcat_ctx->bitmap_ctx = (bitmap_ctx_t *) mymalloc (sizeof (bitmap_ctx_t));
|
||||||
|
hashcat_ctx->combinator_ctx = (combinator_ctx_t *) mymalloc (sizeof (combinator_ctx_t));
|
||||||
|
hashcat_ctx->cpt_ctx = (cpt_ctx_t *) mymalloc (sizeof (cpt_ctx_t));
|
||||||
|
hashcat_ctx->debugfile_ctx = (debugfile_ctx_t *) mymalloc (sizeof (debugfile_ctx_t));
|
||||||
|
hashcat_ctx->dictstat_ctx = (dictstat_ctx_t *) mymalloc (sizeof (dictstat_ctx_t));
|
||||||
|
hashcat_ctx->folder_config = (folder_config_t *) mymalloc (sizeof (folder_config_t));
|
||||||
|
hashcat_ctx->hashconfig = (hashconfig_t *) mymalloc (sizeof (hashconfig_t));
|
||||||
|
hashcat_ctx->hashes = (hashes_t *) mymalloc (sizeof (hashes_t));
|
||||||
|
hashcat_ctx->hwmon_ctx = (hwmon_ctx_t *) mymalloc (sizeof (hwmon_ctx_t));
|
||||||
|
hashcat_ctx->induct_ctx = (induct_ctx_t *) mymalloc (sizeof (induct_ctx_t));
|
||||||
|
hashcat_ctx->logfile_ctx = (logfile_ctx_t *) mymalloc (sizeof (logfile_ctx_t));
|
||||||
|
hashcat_ctx->loopback_ctx = (loopback_ctx_t *) mymalloc (sizeof (loopback_ctx_t));
|
||||||
|
hashcat_ctx->mask_ctx = (mask_ctx_t *) mymalloc (sizeof (mask_ctx_t));
|
||||||
|
hashcat_ctx->opencl_ctx = (opencl_ctx_t *) mymalloc (sizeof (opencl_ctx_t));
|
||||||
|
hashcat_ctx->outcheck_ctx = (outcheck_ctx_t *) mymalloc (sizeof (outcheck_ctx_t));
|
||||||
|
hashcat_ctx->outfile_ctx = (outfile_ctx_t *) mymalloc (sizeof (outfile_ctx_t));
|
||||||
|
hashcat_ctx->potfile_ctx = (potfile_ctx_t *) mymalloc (sizeof (potfile_ctx_t));
|
||||||
|
hashcat_ctx->restore_ctx = (restore_ctx_t *) mymalloc (sizeof (restore_ctx_t));
|
||||||
|
hashcat_ctx->status_ctx = (status_ctx_t *) mymalloc (sizeof (status_ctx_t));
|
||||||
|
hashcat_ctx->straight_ctx = (straight_ctx_t *) mymalloc (sizeof (straight_ctx_t));
|
||||||
|
hashcat_ctx->tuning_db = (tuning_db_t *) mymalloc (sizeof (tuning_db_t));
|
||||||
|
hashcat_ctx->user_options_extra = (user_options_extra_t *) mymalloc (sizeof (user_options_extra_t));
|
||||||
|
hashcat_ctx->user_options = (user_options_t *) mymalloc (sizeof (user_options_t));
|
||||||
|
hashcat_ctx->wl_data = (wl_data_t *) mymalloc (sizeof (wl_data_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hashcat_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
myfree (hashcat_ctx->bitmap_ctx);
|
||||||
|
myfree (hashcat_ctx->combinator_ctx);
|
||||||
|
myfree (hashcat_ctx->cpt_ctx);
|
||||||
|
myfree (hashcat_ctx->debugfile_ctx);
|
||||||
|
myfree (hashcat_ctx->dictstat_ctx);
|
||||||
|
myfree (hashcat_ctx->folder_config);
|
||||||
|
myfree (hashcat_ctx->hashconfig);
|
||||||
|
myfree (hashcat_ctx->hashes);
|
||||||
|
myfree (hashcat_ctx->hwmon_ctx);
|
||||||
|
myfree (hashcat_ctx->induct_ctx);
|
||||||
|
myfree (hashcat_ctx->logfile_ctx);
|
||||||
|
myfree (hashcat_ctx->loopback_ctx);
|
||||||
|
myfree (hashcat_ctx->mask_ctx);
|
||||||
|
myfree (hashcat_ctx->opencl_ctx);
|
||||||
|
myfree (hashcat_ctx->outcheck_ctx);
|
||||||
|
myfree (hashcat_ctx->outfile_ctx);
|
||||||
|
myfree (hashcat_ctx->potfile_ctx);
|
||||||
|
myfree (hashcat_ctx->restore_ctx);
|
||||||
|
myfree (hashcat_ctx->status_ctx);
|
||||||
|
myfree (hashcat_ctx->straight_ctx);
|
||||||
|
myfree (hashcat_ctx->tuning_db);
|
||||||
|
myfree (hashcat_ctx->user_options_extra);
|
||||||
|
myfree (hashcat_ctx->user_options);
|
||||||
|
myfree (hashcat_ctx->wl_data);
|
||||||
|
}
|
||||||
|
|
||||||
// inner2_loop iterates through wordlists, then calls kernel execution
|
// inner2_loop iterates through wordlists, then calls kernel execution
|
||||||
|
|
||||||
static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
||||||
@ -1210,18 +1266,26 @@ static int inner1_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
static int outer_loop (hashcat_ctx_t *hashcat_ctx)
|
static int outer_loop (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
bitmap_ctx_t *bitmap_ctx = hashcat_ctx->bitmap_ctx;
|
||||||
|
cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
||||||
|
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
||||||
folder_config_t *folder_config = hashcat_ctx->folder_config;
|
folder_config_t *folder_config = hashcat_ctx->folder_config;
|
||||||
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
|
hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
|
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
|
||||||
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
|
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
|
||||||
|
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||||
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
|
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
|
||||||
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
||||||
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
|
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
|
||||||
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||||
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
|
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
|
||||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
user_options_t *user_options = hashcat_ctx->user_options;
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
wl_data_t *wl_data = hashcat_ctx->wl_data;
|
||||||
|
|
||||||
status_ctx->devices_status = STATUS_INIT;
|
status_ctx->devices_status = STATUS_INIT;
|
||||||
|
|
||||||
@ -1241,10 +1305,6 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
* setup variables and buffers depending on hash_mode
|
* setup variables and buffers depending on hash_mode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hashconfig_t *hashconfig = (hashconfig_t *) mymalloc (sizeof (hashconfig_t));
|
|
||||||
|
|
||||||
hashcat_ctx->hashconfig = hashconfig;
|
|
||||||
|
|
||||||
const int rc_hashconfig = hashconfig_init (hashconfig, user_options);
|
const int rc_hashconfig = hashconfig_init (hashconfig, user_options);
|
||||||
|
|
||||||
if (rc_hashconfig == -1) return -1;
|
if (rc_hashconfig == -1) return -1;
|
||||||
@ -1268,10 +1328,6 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
* load hashes, stage 1
|
* load hashes, stage 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hashes_t *hashes = (hashes_t *) mymalloc (sizeof (hashes_t));
|
|
||||||
|
|
||||||
hashcat_ctx->hashes = hashes;
|
|
||||||
|
|
||||||
const int rc_hashes_init_stage1 = hashes_init_stage1 (hashes, hashconfig, potfile_ctx, outfile_ctx, user_options, restore_ctx->argv[user_options_extra->optind]);
|
const int rc_hashes_init_stage1 = hashes_init_stage1 (hashes, hashconfig, potfile_ctx, outfile_ctx, user_options, restore_ctx->argv[user_options_extra->optind]);
|
||||||
|
|
||||||
if (rc_hashes_init_stage1 == -1) return -1;
|
if (rc_hashes_init_stage1 == -1) return -1;
|
||||||
@ -1336,40 +1392,24 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
* bitmaps
|
* bitmaps
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bitmap_ctx_t *bitmap_ctx = (bitmap_ctx_t *) mymalloc (sizeof (bitmap_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->bitmap_ctx = bitmap_ctx;
|
|
||||||
|
|
||||||
bitmap_ctx_init (bitmap_ctx, user_options, hashconfig, hashes);
|
bitmap_ctx_init (bitmap_ctx, user_options, hashconfig, hashes);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cracks-per-time allocate buffer
|
* cracks-per-time allocate buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cpt_ctx_t *cpt_ctx = (cpt_ctx_t *) mymalloc (sizeof (cpt_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->cpt_ctx = cpt_ctx;
|
|
||||||
|
|
||||||
cpt_ctx_init (cpt_ctx, user_options);
|
cpt_ctx_init (cpt_ctx, user_options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wordlist allocate buffer
|
* Wordlist allocate buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wl_data_t *wl_data = (wl_data_t *) mymalloc (sizeof (wl_data_t));
|
|
||||||
|
|
||||||
hashcat_ctx->wl_data = wl_data;
|
|
||||||
|
|
||||||
wl_data_init (wl_data, user_options, hashconfig);
|
wl_data_init (wl_data, user_options, hashconfig);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* straight mode init
|
* straight mode init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
straight_ctx_t *straight_ctx = (straight_ctx_t *) mymalloc (sizeof (straight_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->straight_ctx = straight_ctx;
|
|
||||||
|
|
||||||
const int rc_straight_init = straight_ctx_init (straight_ctx, user_options);
|
const int rc_straight_init = straight_ctx_init (straight_ctx, user_options);
|
||||||
|
|
||||||
if (rc_straight_init == -1) return -1;
|
if (rc_straight_init == -1) return -1;
|
||||||
@ -1378,10 +1418,6 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
* straight mode init
|
* straight mode init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
combinator_ctx_t *combinator_ctx = (combinator_ctx_t *) mymalloc (sizeof (combinator_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->combinator_ctx = combinator_ctx;
|
|
||||||
|
|
||||||
const int rc_combinator_init = combinator_ctx_init (combinator_ctx, user_options);
|
const int rc_combinator_init = combinator_ctx_init (combinator_ctx, user_options);
|
||||||
|
|
||||||
if (rc_combinator_init == -1) return -1;
|
if (rc_combinator_init == -1) return -1;
|
||||||
@ -1390,10 +1426,6 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
* charsets : keep them together for more easy maintainnce
|
* charsets : keep them together for more easy maintainnce
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mask_ctx_t *mask_ctx = (mask_ctx_t *) mymalloc (sizeof (mask_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->mask_ctx = mask_ctx;
|
|
||||||
|
|
||||||
const int rc_mask_init = mask_ctx_init (mask_ctx, user_options, user_options_extra, folder_config, restore_ctx, hashconfig);
|
const int rc_mask_init = mask_ctx_init (mask_ctx, user_options, user_options_extra, folder_config, restore_ctx, hashconfig);
|
||||||
|
|
||||||
if (rc_mask_init == -1) return -1;
|
if (rc_mask_init == -1) return -1;
|
||||||
@ -1702,12 +1734,31 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
setup_umask ();
|
setup_umask ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* status init
|
* main init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
status_ctx_t *status_ctx = (status_ctx_t *) mymalloc (sizeof (status_ctx_t));
|
hashcat_ctx_init (hashcat_ctx);
|
||||||
|
|
||||||
hashcat_ctx->status_ctx = status_ctx;
|
debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx;
|
||||||
|
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
||||||
|
folder_config_t *folder_config = hashcat_ctx->folder_config;
|
||||||
|
hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
|
||||||
|
induct_ctx_t *induct_ctx = hashcat_ctx->induct_ctx;
|
||||||
|
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
|
||||||
|
loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx;
|
||||||
|
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
|
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
|
||||||
|
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
||||||
|
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
|
||||||
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* status init
|
||||||
|
*/
|
||||||
|
|
||||||
const int rc_status_init = status_ctx_init (status_ctx);
|
const int rc_status_init = status_ctx_init (status_ctx);
|
||||||
|
|
||||||
@ -1728,20 +1779,12 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
shared_folder = SHARED_FOLDER;
|
shared_folder = SHARED_FOLDER;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
folder_config_t *folder_config = (folder_config_t *) mymalloc (sizeof (folder_config_t));
|
|
||||||
|
|
||||||
hashcat_ctx->folder_config = folder_config;
|
|
||||||
|
|
||||||
folder_config_init (folder_config, install_folder, shared_folder);
|
folder_config_init (folder_config, install_folder, shared_folder);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* commandline parameters
|
* commandline parameters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
user_options_t *user_options = (user_options_t *) mymalloc (sizeof (user_options_t));
|
|
||||||
|
|
||||||
hashcat_ctx->user_options = user_options;
|
|
||||||
|
|
||||||
user_options_init (user_options);
|
user_options_init (user_options);
|
||||||
|
|
||||||
const int rc_user_options_parse = user_options_parse (user_options, argc, argv);
|
const int rc_user_options_parse = user_options_parse (user_options, argc, argv);
|
||||||
@ -1770,10 +1813,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* restore
|
* restore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
restore_ctx_t *restore_ctx = (restore_ctx_t *) mymalloc (sizeof (restore_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->restore_ctx = restore_ctx;
|
|
||||||
|
|
||||||
const int rc_restore_init = restore_ctx_init (restore_ctx, user_options, folder_config, argc, argv);
|
const int rc_restore_init = restore_ctx_init (restore_ctx, user_options, folder_config, argc, argv);
|
||||||
|
|
||||||
if (rc_restore_init == -1) return -1;
|
if (rc_restore_init == -1) return -1;
|
||||||
@ -1782,10 +1821,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* process user input
|
* process user input
|
||||||
*/
|
*/
|
||||||
|
|
||||||
user_options_extra_t *user_options_extra = (user_options_extra_t *) mymalloc (sizeof (user_options_extra_t));
|
|
||||||
|
|
||||||
hashcat_ctx->user_options_extra = user_options_extra;
|
|
||||||
|
|
||||||
const int rc_user_options_extra_init = user_options_extra_init (user_options, restore_ctx, user_options_extra);
|
const int rc_user_options_extra_init = user_options_extra_init (user_options, restore_ctx, user_options_extra);
|
||||||
|
|
||||||
if (rc_user_options_extra_init == -1) return -1;
|
if (rc_user_options_extra_init == -1) return -1;
|
||||||
@ -1811,10 +1846,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* logfile init
|
* logfile init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
logfile_ctx_t *logfile_ctx = (logfile_ctx_t *) mymalloc (sizeof (logfile_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->logfile_ctx = logfile_ctx;
|
|
||||||
|
|
||||||
logfile_init (logfile_ctx, user_options, folder_config);
|
logfile_init (logfile_ctx, user_options, folder_config);
|
||||||
|
|
||||||
logfile_generate_topid (logfile_ctx);
|
logfile_generate_topid (logfile_ctx);
|
||||||
@ -1827,10 +1858,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* tuning db
|
* tuning db
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tuning_db_t *tuning_db = (tuning_db_t *) mymalloc (sizeof (tuning_db_t));
|
|
||||||
|
|
||||||
hashcat_ctx->tuning_db = tuning_db;
|
|
||||||
|
|
||||||
const int rc_tuning_db = tuning_db_init (tuning_db, user_options, folder_config);
|
const int rc_tuning_db = tuning_db_init (tuning_db, user_options, folder_config);
|
||||||
|
|
||||||
if (rc_tuning_db == -1) return -1;
|
if (rc_tuning_db == -1) return -1;
|
||||||
@ -1839,10 +1866,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* induction directory
|
* induction directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
induct_ctx_t *induct_ctx = (induct_ctx_t *) mymalloc (sizeof (induct_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->induct_ctx = induct_ctx;
|
|
||||||
|
|
||||||
const int rc_induct_ctx_init = induct_ctx_init (induct_ctx, user_options, folder_config, status_ctx);
|
const int rc_induct_ctx_init = induct_ctx_init (induct_ctx, user_options, folder_config, status_ctx);
|
||||||
|
|
||||||
if (rc_induct_ctx_init == -1) return -1;
|
if (rc_induct_ctx_init == -1) return -1;
|
||||||
@ -1851,10 +1874,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* outfile-check directory
|
* outfile-check directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
outcheck_ctx_t *outcheck_ctx = (outcheck_ctx_t *) mymalloc (sizeof (outcheck_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->outcheck_ctx = outcheck_ctx;
|
|
||||||
|
|
||||||
const int rc_outcheck_ctx_init = outcheck_ctx_init (outcheck_ctx, user_options, folder_config);
|
const int rc_outcheck_ctx_init = outcheck_ctx_init (outcheck_ctx, user_options, folder_config);
|
||||||
|
|
||||||
if (rc_outcheck_ctx_init == -1) return -1;
|
if (rc_outcheck_ctx_init == -1) return -1;
|
||||||
@ -1863,10 +1882,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* outfile itself
|
* outfile itself
|
||||||
*/
|
*/
|
||||||
|
|
||||||
outfile_ctx_t *outfile_ctx = mymalloc (sizeof (outfile_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->outfile_ctx = outfile_ctx;
|
|
||||||
|
|
||||||
outfile_init (outfile_ctx, user_options);
|
outfile_init (outfile_ctx, user_options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1883,40 +1898,24 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* plus it depends on hash_mode, so we continue using it in outer_loop
|
* plus it depends on hash_mode, so we continue using it in outer_loop
|
||||||
*/
|
*/
|
||||||
|
|
||||||
potfile_ctx_t *potfile_ctx = mymalloc (sizeof (potfile_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->potfile_ctx = potfile_ctx;
|
|
||||||
|
|
||||||
potfile_init (potfile_ctx, user_options, folder_config);
|
potfile_init (potfile_ctx, user_options, folder_config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dictstat init
|
* dictstat init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dictstat_ctx_t *dictstat_ctx = mymalloc (sizeof (dictstat_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->dictstat_ctx = dictstat_ctx;
|
|
||||||
|
|
||||||
dictstat_init (dictstat_ctx, user_options, folder_config);
|
dictstat_init (dictstat_ctx, user_options, folder_config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* loopback init
|
* loopback init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
loopback_ctx_t *loopback_ctx = mymalloc (sizeof (loopback_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->loopback_ctx = loopback_ctx;
|
|
||||||
|
|
||||||
loopback_init (loopback_ctx, user_options);
|
loopback_init (loopback_ctx, user_options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* debugfile init
|
* debugfile init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
debugfile_ctx_t *debugfile_ctx = mymalloc (sizeof (debugfile_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->debugfile_ctx = debugfile_ctx;
|
|
||||||
|
|
||||||
debugfile_init (debugfile_ctx, user_options);
|
debugfile_init (debugfile_ctx, user_options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1932,10 +1931,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* Init OpenCL library loader
|
* Init OpenCL library loader
|
||||||
*/
|
*/
|
||||||
|
|
||||||
opencl_ctx_t *opencl_ctx = (opencl_ctx_t *) mymalloc (sizeof (opencl_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->opencl_ctx = opencl_ctx;
|
|
||||||
|
|
||||||
const int rc_opencl_init = opencl_ctx_init (opencl_ctx, user_options);
|
const int rc_opencl_init = opencl_ctx_init (opencl_ctx, user_options);
|
||||||
|
|
||||||
if (rc_opencl_init == -1)
|
if (rc_opencl_init == -1)
|
||||||
@ -1962,10 +1957,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
* HM devices: init
|
* HM devices: init
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hwmon_ctx_t *hwmon_ctx = (hwmon_ctx_t *) mymalloc (sizeof (hwmon_ctx_t));
|
|
||||||
|
|
||||||
hashcat_ctx->hwmon_ctx = hwmon_ctx;
|
|
||||||
|
|
||||||
const int rc_hwmon_init = hwmon_ctx_init (hwmon_ctx, user_options, opencl_ctx);
|
const int rc_hwmon_init = hwmon_ctx_init (hwmon_ctx, user_options, opencl_ctx);
|
||||||
|
|
||||||
if (rc_hwmon_init == -1)
|
if (rc_hwmon_init == -1)
|
||||||
@ -2098,5 +2089,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
|
|
||||||
status_ctx_destroy (status_ctx);
|
status_ctx_destroy (status_ctx);
|
||||||
|
|
||||||
|
hashcat_ctx_destroy (hashcat_ctx);
|
||||||
|
|
||||||
return rc_final;
|
return rc_final;
|
||||||
}
|
}
|
||||||
|
26
src/hashes.c
26
src/hashes.c
@ -1512,31 +1512,7 @@ void hashes_destroy (hashes_t *hashes)
|
|||||||
|
|
||||||
myfree (hashes->hash_info);
|
myfree (hashes->hash_info);
|
||||||
|
|
||||||
hashes->hashfile = NULL;
|
memset (hashes, 0, sizeof (hashes_t));
|
||||||
|
|
||||||
hashes->hashlist_mode = 0;
|
|
||||||
hashes->hashlist_format = 0;
|
|
||||||
|
|
||||||
hashes->digests_cnt = 0;
|
|
||||||
hashes->digests_done = 0;
|
|
||||||
hashes->digests_saved = 0;
|
|
||||||
hashes->digests_buf = NULL;
|
|
||||||
hashes->digests_shown = NULL;
|
|
||||||
hashes->digests_shown_tmp = NULL;
|
|
||||||
|
|
||||||
hashes->salts_cnt = 0;
|
|
||||||
hashes->salts_done = 0;
|
|
||||||
hashes->salts_buf = NULL;
|
|
||||||
hashes->salts_shown = NULL;
|
|
||||||
|
|
||||||
hashes->esalts_buf = NULL;
|
|
||||||
|
|
||||||
hashes->hashes_cnt = 0;
|
|
||||||
hashes->hashes_buf = NULL;
|
|
||||||
|
|
||||||
hashes->hash_info = NULL;
|
|
||||||
|
|
||||||
myfree (hashes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void hashes_logger (const hashes_t *hashes, const logfile_ctx_t *logfile_ctx)
|
void hashes_logger (const hashes_t *hashes, const logfile_ctx_t *logfile_ctx)
|
||||||
|
20
src/hwmon.c
20
src/hwmon.c
@ -1269,12 +1269,7 @@ int hwmon_ctx_init (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options,
|
|||||||
|
|
||||||
void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options, const opencl_ctx_t *opencl_ctx)
|
void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_options, const opencl_ctx_t *opencl_ctx)
|
||||||
{
|
{
|
||||||
if (hwmon_ctx->enabled == false)
|
if (hwmon_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (hwmon_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reset default fan speed
|
// reset default fan speed
|
||||||
|
|
||||||
@ -1416,16 +1411,5 @@ void hwmon_ctx_destroy (hwmon_ctx_t *hwmon_ctx, const user_options_t *user_optio
|
|||||||
|
|
||||||
myfree (hwmon_ctx->hm_device);
|
myfree (hwmon_ctx->hm_device);
|
||||||
|
|
||||||
hwmon_ctx->nvml_power_limit = NULL;
|
memset (hwmon_ctx, 0, sizeof (hwmon_ctx_t));
|
||||||
hwmon_ctx->od_power_control_status = NULL;
|
|
||||||
hwmon_ctx->od_clock_mem_status = NULL;
|
|
||||||
|
|
||||||
hwmon_ctx->hm_device = NULL;
|
|
||||||
|
|
||||||
hwmon_ctx->hm_adl = NULL;
|
|
||||||
hwmon_ctx->hm_nvml = NULL;
|
|
||||||
hwmon_ctx->hm_nvapi = NULL;
|
|
||||||
hwmon_ctx->hm_xnvctrl = NULL;
|
|
||||||
|
|
||||||
myfree (hwmon_ctx);
|
|
||||||
}
|
}
|
||||||
|
@ -117,12 +117,7 @@ void induct_ctx_cleanup (induct_ctx_t *induct_ctx)
|
|||||||
|
|
||||||
void induct_ctx_destroy (induct_ctx_t *induct_ctx)
|
void induct_ctx_destroy (induct_ctx_t *induct_ctx)
|
||||||
{
|
{
|
||||||
if (induct_ctx->enabled == false)
|
if (induct_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (induct_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rmdir (induct_ctx->root_directory) == -1)
|
if (rmdir (induct_ctx->root_directory) == -1)
|
||||||
{
|
{
|
||||||
@ -144,5 +139,5 @@ void induct_ctx_destroy (induct_ctx_t *induct_ctx)
|
|||||||
|
|
||||||
myfree (induct_ctx->root_directory);
|
myfree (induct_ctx->root_directory);
|
||||||
|
|
||||||
myfree (induct_ctx);
|
memset (induct_ctx, 0, sizeof (induct_ctx_t));
|
||||||
}
|
}
|
||||||
|
@ -20008,7 +20008,7 @@ int hashconfig_init (hashconfig_t *hashconfig, const user_options_t *user_option
|
|||||||
|
|
||||||
void hashconfig_destroy (hashconfig_t *hashconfig)
|
void hashconfig_destroy (hashconfig_t *hashconfig)
|
||||||
{
|
{
|
||||||
myfree (hashconfig);
|
memset (hashconfig, 0, sizeof (hashconfig_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 hashconfig_enforce_kernel_threads (const hashconfig_t *hashconfig, const hc_device_param_t *device_param)
|
u32 hashconfig_enforce_kernel_threads (const hashconfig_t *hashconfig, const hc_device_param_t *device_param)
|
||||||
|
@ -78,16 +78,11 @@ void logfile_init (logfile_ctx_t *logfile_ctx, const user_options_t *user_option
|
|||||||
|
|
||||||
void logfile_destroy (logfile_ctx_t *logfile_ctx)
|
void logfile_destroy (logfile_ctx_t *logfile_ctx)
|
||||||
{
|
{
|
||||||
if (logfile_ctx->enabled == false)
|
if (logfile_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (logfile_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
myfree (logfile_ctx->logfile);
|
myfree (logfile_ctx->logfile);
|
||||||
myfree (logfile_ctx->topid);
|
myfree (logfile_ctx->topid);
|
||||||
myfree (logfile_ctx->subid);
|
myfree (logfile_ctx->subid);
|
||||||
|
|
||||||
myfree (logfile_ctx);
|
memset (logfile_ctx, 0, sizeof (logfile_ctx_t));
|
||||||
}
|
}
|
||||||
|
@ -32,16 +32,9 @@ void loopback_init (loopback_ctx_t *loopback_ctx, const user_options_t *user_opt
|
|||||||
|
|
||||||
void loopback_destroy (loopback_ctx_t *loopback_ctx)
|
void loopback_destroy (loopback_ctx_t *loopback_ctx)
|
||||||
{
|
{
|
||||||
if (loopback_ctx->enabled == false)
|
if (loopback_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (loopback_ctx);
|
|
||||||
|
|
||||||
return;
|
memset (loopback_ctx, 0, sizeof (loopback_ctx_t));
|
||||||
}
|
|
||||||
|
|
||||||
myfree (loopback_ctx->filename);
|
|
||||||
|
|
||||||
myfree (loopback_ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int loopback_write_open (loopback_ctx_t *loopback_ctx, const induct_ctx_t *induct_ctx)
|
int loopback_write_open (loopback_ctx_t *loopback_ctx, const induct_ctx_t *induct_ctx)
|
||||||
|
@ -1119,7 +1119,7 @@ void mask_ctx_destroy (mask_ctx_t *mask_ctx)
|
|||||||
|
|
||||||
myfree (mask_ctx->mfs);
|
myfree (mask_ctx->mfs);
|
||||||
|
|
||||||
myfree (mask_ctx);
|
memset (mask_ctx, 0, sizeof (mask_ctx_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
int mask_ctx_parse_maskfile (mask_ctx_t *mask_ctx, user_options_t *user_options, const hashconfig_t *hashconfig)
|
int mask_ctx_parse_maskfile (mask_ctx_t *mask_ctx, user_options_t *user_options, const hashconfig_t *hashconfig)
|
||||||
|
@ -1512,12 +1512,7 @@ int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_option
|
|||||||
|
|
||||||
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx)
|
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx)
|
||||||
{
|
{
|
||||||
if (opencl_ctx->enabled == false)
|
if (opencl_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (opencl_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
myfree (opencl_ctx->devices_param);
|
myfree (opencl_ctx->devices_param);
|
||||||
|
|
||||||
@ -1529,7 +1524,7 @@ void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx)
|
|||||||
|
|
||||||
myfree (opencl_ctx->platform_devices);
|
myfree (opencl_ctx->platform_devices);
|
||||||
|
|
||||||
myfree (opencl_ctx);
|
memset (opencl_ctx, 0, sizeof (opencl_ctx_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options, const int comptime)
|
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options, const int comptime)
|
||||||
|
@ -30,12 +30,7 @@ void outfile_init (outfile_ctx_t *outfile_ctx, const user_options_t *user_option
|
|||||||
|
|
||||||
void outfile_destroy (outfile_ctx_t *outfile_ctx)
|
void outfile_destroy (outfile_ctx_t *outfile_ctx)
|
||||||
{
|
{
|
||||||
outfile_ctx->fp = NULL;
|
memset (outfile_ctx, 0, sizeof (outfile_ctx_t));
|
||||||
outfile_ctx->filename = NULL;
|
|
||||||
outfile_ctx->outfile_format = 0;
|
|
||||||
outfile_ctx->outfile_autohex = 0;
|
|
||||||
|
|
||||||
myfree (outfile_ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void outfile_format_plain (outfile_ctx_t *outfile_ctx, const unsigned char *plain_ptr, const uint plain_len)
|
void outfile_format_plain (outfile_ctx_t *outfile_ctx, const unsigned char *plain_ptr, const uint plain_len)
|
||||||
|
@ -374,12 +374,7 @@ int outcheck_ctx_init (outcheck_ctx_t *outcheck_ctx, const user_options_t *user_
|
|||||||
|
|
||||||
void outcheck_ctx_destroy (outcheck_ctx_t *outcheck_ctx)
|
void outcheck_ctx_destroy (outcheck_ctx_t *outcheck_ctx)
|
||||||
{
|
{
|
||||||
if (outcheck_ctx->enabled == false)
|
if (outcheck_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (outcheck_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rmdir (outcheck_ctx->root_directory) == -1)
|
if (rmdir (outcheck_ctx->root_directory) == -1)
|
||||||
{
|
{
|
||||||
@ -401,5 +396,5 @@ void outcheck_ctx_destroy (outcheck_ctx_t *outcheck_ctx)
|
|||||||
|
|
||||||
myfree (outcheck_ctx->root_directory);
|
myfree (outcheck_ctx->root_directory);
|
||||||
|
|
||||||
myfree (outcheck_ctx);
|
memset (outcheck_ctx, 0, sizeof (outcheck_ctx_t));
|
||||||
}
|
}
|
||||||
|
@ -181,16 +181,9 @@ void potfile_init (potfile_ctx_t *potfile_ctx, const user_options_t *user_option
|
|||||||
|
|
||||||
void potfile_destroy (potfile_ctx_t *potfile_ctx)
|
void potfile_destroy (potfile_ctx_t *potfile_ctx)
|
||||||
{
|
{
|
||||||
if (potfile_ctx->enabled == false)
|
if (potfile_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (potfile_ctx);
|
|
||||||
|
|
||||||
return;
|
memset (potfile_ctx, 0, sizeof (potfile_ctx_t));
|
||||||
}
|
|
||||||
|
|
||||||
myfree (potfile_ctx->filename);
|
|
||||||
|
|
||||||
myfree (potfile_ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void potfile_format_plain (potfile_ctx_t *potfile_ctx, const unsigned char *plain_ptr, const uint plain_len)
|
void potfile_format_plain (potfile_ctx_t *potfile_ctx, const unsigned char *plain_ptr, const uint plain_len)
|
||||||
|
@ -408,15 +408,7 @@ void restore_ctx_destroy (restore_ctx_t *restore_ctx)
|
|||||||
|
|
||||||
myfree (restore_ctx->rd);
|
myfree (restore_ctx->rd);
|
||||||
|
|
||||||
if (restore_ctx->enabled == false)
|
if (restore_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (restore_ctx);
|
|
||||||
|
|
||||||
return;
|
memset (restore_ctx, 0, sizeof (restore_ctx_t));
|
||||||
}
|
|
||||||
|
|
||||||
restore_ctx->argc = 0;
|
|
||||||
restore_ctx->argv = NULL;
|
|
||||||
|
|
||||||
myfree (restore_ctx);
|
|
||||||
}
|
}
|
||||||
|
@ -15,22 +15,22 @@
|
|||||||
#define NEXT_RULEPOS(rp) if (++(rp) == rule_len) return (RULE_RC_SYNTAX_ERROR)
|
#define NEXT_RULEPOS(rp) if (++(rp) == rule_len) return (RULE_RC_SYNTAX_ERROR)
|
||||||
#define NEXT_RPTOI(r,rp,up) if (((up) = conv_ctoi ((r)[(rp)])) == -1) return (RULE_RC_SYNTAX_ERROR)
|
#define NEXT_RPTOI(r,rp,up) if (((up) = conv_ctoi ((r)[(rp)])) == -1) return (RULE_RC_SYNTAX_ERROR)
|
||||||
|
|
||||||
inline void MANGLE_TOGGLE_AT (char *arr, const int pos)
|
static void MANGLE_TOGGLE_AT (char *arr, const int pos)
|
||||||
{
|
{
|
||||||
if (class_alpha (arr[pos])) arr[pos] ^= 0x20;
|
if (class_alpha (arr[pos])) arr[pos] ^= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MANGLE_LOWER_AT (char *arr, const int pos)
|
static void MANGLE_LOWER_AT (char *arr, const int pos)
|
||||||
{
|
{
|
||||||
if (class_upper (arr[pos])) arr[pos] ^= 0x20;
|
if (class_upper (arr[pos])) arr[pos] ^= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MANGLE_UPPER_AT (char *arr, const int pos)
|
static void MANGLE_UPPER_AT (char *arr, const int pos)
|
||||||
{
|
{
|
||||||
if (class_lower (arr[pos])) arr[pos] ^= 0x20;
|
if (class_lower (arr[pos])) arr[pos] ^= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MANGLE_SWITCH (char *arr, const int l, const int r)
|
static void MANGLE_SWITCH (char *arr, const int l, const int r)
|
||||||
{
|
{
|
||||||
char c = arr[r];
|
char c = arr[r];
|
||||||
arr[r] = arr[l];
|
arr[r] = arr[l];
|
||||||
|
@ -1237,6 +1237,10 @@ void status_progress_destroy (status_ctx_t *status_ctx)
|
|||||||
myfree (status_ctx->words_progress_done);
|
myfree (status_ctx->words_progress_done);
|
||||||
myfree (status_ctx->words_progress_rejected);
|
myfree (status_ctx->words_progress_rejected);
|
||||||
myfree (status_ctx->words_progress_restored);
|
myfree (status_ctx->words_progress_restored);
|
||||||
|
|
||||||
|
status_ctx->words_progress_done = NULL;
|
||||||
|
status_ctx->words_progress_rejected = NULL;
|
||||||
|
status_ctx->words_progress_restored = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void status_progress_reset (status_ctx_t *status_ctx, const hashes_t *hashes)
|
void status_progress_reset (status_ctx_t *status_ctx, const hashes_t *hashes)
|
||||||
@ -1273,5 +1277,5 @@ void status_ctx_destroy (status_ctx_t *status_ctx)
|
|||||||
hc_thread_mutex_delete (status_ctx->mux_display);
|
hc_thread_mutex_delete (status_ctx->mux_display);
|
||||||
hc_thread_mutex_delete (status_ctx->mux_hwmon);
|
hc_thread_mutex_delete (status_ctx->mux_hwmon);
|
||||||
|
|
||||||
myfree (status_ctx);
|
memset (status_ctx, 0, sizeof (status_ctx_t));
|
||||||
}
|
}
|
||||||
|
@ -65,12 +65,7 @@ int straight_ctx_init (straight_ctx_t *straight_ctx, const user_options_t *user_
|
|||||||
|
|
||||||
void straight_ctx_destroy (straight_ctx_t *straight_ctx)
|
void straight_ctx_destroy (straight_ctx_t *straight_ctx)
|
||||||
{
|
{
|
||||||
if (straight_ctx->enabled == false)
|
if (straight_ctx->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (straight_ctx);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u32 dict_pos = 0; dict_pos < straight_ctx->dicts_cnt; dict_pos++)
|
for (u32 dict_pos = 0; dict_pos < straight_ctx->dicts_cnt; dict_pos++)
|
||||||
{
|
{
|
||||||
@ -81,10 +76,7 @@ void straight_ctx_destroy (straight_ctx_t *straight_ctx)
|
|||||||
|
|
||||||
myfree (straight_ctx->kernel_rules_buf);
|
myfree (straight_ctx->kernel_rules_buf);
|
||||||
|
|
||||||
straight_ctx->kernel_rules_buf = NULL;
|
memset (straight_ctx, 0, sizeof (straight_ctx_t));
|
||||||
straight_ctx->kernel_rules_cnt = 0;
|
|
||||||
|
|
||||||
myfree (straight_ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void straight_append_dict (straight_ctx_t *straight_ctx, const char *dict)
|
void straight_append_dict (straight_ctx_t *straight_ctx, const char *dict)
|
||||||
|
@ -241,12 +241,7 @@ int tuning_db_init (tuning_db_t *tuning_db, const user_options_t *user_options,
|
|||||||
|
|
||||||
void tuning_db_destroy (tuning_db_t *tuning_db)
|
void tuning_db_destroy (tuning_db_t *tuning_db)
|
||||||
{
|
{
|
||||||
if (tuning_db->enabled == false)
|
if (tuning_db->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (tuning_db);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -268,7 +263,7 @@ void tuning_db_destroy (tuning_db_t *tuning_db)
|
|||||||
myfree (tuning_db->alias_buf);
|
myfree (tuning_db->alias_buf);
|
||||||
myfree (tuning_db->entry_buf);
|
myfree (tuning_db->entry_buf);
|
||||||
|
|
||||||
myfree (tuning_db);
|
memset (tuning_db, 0, sizeof (tuning_db_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
tuning_db_entry_t *tuning_db_search (const tuning_db_t *tuning_db, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_type)
|
tuning_db_entry_t *tuning_db_search (const tuning_db_t *tuning_db, const char *device_name, const cl_device_type device_type, int attack_mode, const int hash_type)
|
||||||
|
@ -193,7 +193,7 @@ void user_options_destroy (user_options_t *user_options)
|
|||||||
{
|
{
|
||||||
myfree (user_options->rp_files);
|
myfree (user_options->rp_files);
|
||||||
|
|
||||||
myfree (user_options);
|
memset (user_options, 0, sizeof (user_options_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
int user_options_parse (user_options_t *user_options, int argc, char **argv)
|
int user_options_parse (user_options_t *user_options, int argc, char **argv)
|
||||||
@ -986,7 +986,7 @@ int user_options_extra_init (user_options_t *user_options, restore_ctx_t *restor
|
|||||||
|
|
||||||
void user_options_extra_destroy (user_options_extra_t *user_options_extra)
|
void user_options_extra_destroy (user_options_extra_t *user_options_extra)
|
||||||
{
|
{
|
||||||
myfree (user_options_extra);
|
memset (user_options_extra, 0, sizeof (user_options_extra_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
void user_options_logger (const user_options_t *user_options, const logfile_ctx_t *logfile_ctx)
|
void user_options_logger (const user_options_t *user_options, const logfile_ctx_t *logfile_ctx)
|
||||||
|
@ -439,21 +439,9 @@ void wl_data_init (wl_data_t *wl_data, const user_options_t *user_options, const
|
|||||||
|
|
||||||
void wl_data_destroy (wl_data_t *wl_data)
|
void wl_data_destroy (wl_data_t *wl_data)
|
||||||
{
|
{
|
||||||
if (wl_data->enabled == false)
|
if (wl_data->enabled == false) return;
|
||||||
{
|
|
||||||
myfree (wl_data);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
myfree (wl_data->buf);
|
myfree (wl_data->buf);
|
||||||
|
|
||||||
wl_data->func = NULL;
|
memset (wl_data, 0, sizeof (wl_data_t));
|
||||||
wl_data->buf = NULL;
|
|
||||||
wl_data->avail = 0;
|
|
||||||
wl_data->incr = 0;
|
|
||||||
wl_data->cnt = 0;
|
|
||||||
wl_data->pos = 0;
|
|
||||||
|
|
||||||
myfree (wl_data);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user