mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-22 21:51:07 +00:00
Clean up some code
This commit is contained in:
parent
0186f025d3
commit
54edd16746
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
static const u32 MODULE_VERSION_MINIMUM = 520;
|
static const u32 MODULE_VERSION_MINIMUM = 520;
|
||||||
|
|
||||||
|
static const int MODULE_HASH_MODES_MAXIMUM = 100000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* zero hashes shutcut
|
* zero hashes shutcut
|
||||||
*/
|
*/
|
||||||
@ -281,8 +283,6 @@ bool initialize_keyboard_layout_mapping (hashcat_ctx_t *hashcat_ctx, const char
|
|||||||
|
|
||||||
int hashconfig_init (hashcat_ctx_t *hashcat_ctx);
|
int hashconfig_init (hashcat_ctx_t *hashcat_ctx);
|
||||||
void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx);
|
void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx);
|
||||||
int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx);
|
|
||||||
void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt, void *hook_salt);
|
|
||||||
|
|
||||||
u32 default_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
u32 default_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||||
void *default_benchmark_esalt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
void *default_benchmark_esalt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||||
|
@ -903,7 +903,7 @@ struct hashconfig
|
|||||||
{
|
{
|
||||||
char separator;
|
char separator;
|
||||||
|
|
||||||
u32 hash_mode;
|
int hash_mode;
|
||||||
u32 hash_type;
|
u32 hash_type;
|
||||||
u32 salt_type;
|
u32 salt_type;
|
||||||
u32 attack_exec;
|
u32 attack_exec;
|
||||||
@ -1835,7 +1835,7 @@ typedef struct user_options
|
|||||||
#endif
|
#endif
|
||||||
u32 debug_mode;
|
u32 debug_mode;
|
||||||
u32 hwmon_temp_abort;
|
u32 hwmon_temp_abort;
|
||||||
u32 hash_mode;
|
int hash_mode;
|
||||||
u32 hccapx_message_pair;
|
u32 hccapx_message_pair;
|
||||||
u32 increment_max;
|
u32 increment_max;
|
||||||
u32 increment_min;
|
u32 increment_min;
|
||||||
@ -2267,7 +2267,7 @@ typedef struct module_ctx
|
|||||||
u32 (*module_forced_outfile_format) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
u32 (*module_forced_outfile_format) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
u32 (*module_hash_category) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
u32 (*module_hash_category) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
const char *(*module_hash_name) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
const char *(*module_hash_name) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
u32 (*module_hash_mode) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
int (*module_hash_mode) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
u32 (*module_hash_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
u32 (*module_hash_type) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
bool (*module_hlfmt_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
bool (*module_hlfmt_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
u64 (*module_hook_salt_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
u64 (*module_hook_salt_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||||
|
@ -61,7 +61,7 @@ int benchmark_next (hashcat_ctx_t *hashcat_ctx)
|
|||||||
{
|
{
|
||||||
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||||
|
|
||||||
for (int i = cur; i < 100000; i++)
|
for (int i = cur; i < MODULE_HASH_MODES_MAXIMUM; i++)
|
||||||
{
|
{
|
||||||
#if defined (_WIN)
|
#if defined (_WIN)
|
||||||
snprintf (modulefile, HCBUFSIZ_TINY, "%s/modules/module_%05d.dll", folder_config->shared_dir, i);
|
snprintf (modulefile, HCBUFSIZ_TINY, "%s/modules/module_%05d.dll", folder_config->shared_dir, i);
|
||||||
@ -79,7 +79,7 @@ int benchmark_next (hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free (modulefile);
|
hcfree (modulefile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
142
src/hashes.c
142
src/hashes.c
@ -26,11 +26,144 @@
|
|||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "locking.h"
|
#include "locking.h"
|
||||||
|
#include "cpu_crc32.h"
|
||||||
|
|
||||||
#ifdef WITH_BRAIN
|
#ifdef WITH_BRAIN
|
||||||
#include "brain.h"
|
#include "brain.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// get rid of this!
|
||||||
|
static int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
|
// truecrypt and veracrypt only
|
||||||
|
if (((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299))
|
||||||
|
|| ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode == 13799)))
|
||||||
|
{
|
||||||
|
hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
|
||||||
|
tc_t *tc = (tc_t *) hashes->esalts_buf;
|
||||||
|
|
||||||
|
char *optional_param1 = NULL;
|
||||||
|
|
||||||
|
if (user_options->truecrypt_keyfiles) optional_param1 = user_options->truecrypt_keyfiles;
|
||||||
|
if (user_options->veracrypt_keyfiles) optional_param1 = user_options->veracrypt_keyfiles;
|
||||||
|
|
||||||
|
if (optional_param1)
|
||||||
|
{
|
||||||
|
char *tcvc_keyfiles = optional_param1;
|
||||||
|
|
||||||
|
char *keyfiles = hcstrdup (tcvc_keyfiles);
|
||||||
|
|
||||||
|
if (keyfiles == NULL) return -1;
|
||||||
|
|
||||||
|
char *saveptr = NULL;
|
||||||
|
|
||||||
|
char *keyfile = strtok_r (keyfiles, ",", &saveptr);
|
||||||
|
|
||||||
|
if (keyfile == NULL)
|
||||||
|
{
|
||||||
|
free (keyfiles);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
const int rc_crc32 = cpu_crc32 (hashcat_ctx, keyfile, (u8 *) tc->keyfile_buf);
|
||||||
|
|
||||||
|
if (rc_crc32 == -1)
|
||||||
|
{
|
||||||
|
free (keyfiles);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} while ((keyfile = strtok_r ((char *) NULL, ",", &saveptr)) != NULL);
|
||||||
|
|
||||||
|
free (keyfiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
// truecrypt and veracrypt boot only
|
||||||
|
if (hashconfig->opts_type & OPTS_TYPE_KEYBOARD_MAPPING)
|
||||||
|
{
|
||||||
|
if (user_options->keyboard_layout_mapping)
|
||||||
|
{
|
||||||
|
const bool rc = initialize_keyboard_layout_mapping (hashcat_ctx, user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt);
|
||||||
|
|
||||||
|
if (rc == false) return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// veracrypt only
|
||||||
|
if ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode == 13799))
|
||||||
|
{
|
||||||
|
if (user_options->veracrypt_pim)
|
||||||
|
{
|
||||||
|
// we can access salt directly here because in VC it's always just one salt not many
|
||||||
|
|
||||||
|
hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
|
|
||||||
|
salt_t *salts_buf = hashes->salts_buf;
|
||||||
|
|
||||||
|
salt_t *salt = &salts_buf[0];
|
||||||
|
|
||||||
|
switch (hashconfig->hash_mode)
|
||||||
|
{
|
||||||
|
case 13711: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13712: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13713: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13721: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13722: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13723: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13731: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13732: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13733: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13741: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
||||||
|
break;
|
||||||
|
case 13742: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
||||||
|
break;
|
||||||
|
case 13743: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
||||||
|
break;
|
||||||
|
case 13751: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13752: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13753: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13761: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
||||||
|
break;
|
||||||
|
case 13762: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
||||||
|
break;
|
||||||
|
case 13763: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
||||||
|
break;
|
||||||
|
case 13771: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13772: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
case 13773: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
salt->salt_iter -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int sort_by_string (const void *p1, const void *p2)
|
int sort_by_string (const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const char *s1 = (const char *) p1;
|
const char *s1 = (const char *) p1;
|
||||||
@ -748,7 +881,14 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (user_options->benchmark == true)
|
if (user_options->benchmark == true)
|
||||||
{
|
{
|
||||||
hashconfig_benchmark_defaults (hashcat_ctx, hashes_buf[0].salt, hashes_buf[0].esalt, hashes_buf[0].hook_salt);
|
if (hashconfig->is_salted == true)
|
||||||
|
{
|
||||||
|
memcpy (hashes_buf[0].salt, hashconfig->benchmark_salt, sizeof (salt_t));
|
||||||
|
|
||||||
|
memcpy (hashes_buf[0].esalt, hashconfig->benchmark_esalt, hashconfig->esalt_size);
|
||||||
|
|
||||||
|
memcpy (hashes_buf[0].hook_salt, hashconfig->benchmark_hook_salt, hashconfig->hook_salt_size);
|
||||||
|
}
|
||||||
|
|
||||||
hashes->hashfile = "-";
|
hashes->hashfile = "-";
|
||||||
|
|
||||||
|
147
src/interface.c
147
src/interface.c
@ -13,10 +13,8 @@
|
|||||||
#include "opencl.h"
|
#include "opencl.h"
|
||||||
#include "interface.h"
|
#include "interface.h"
|
||||||
#include "filehandling.h"
|
#include "filehandling.h"
|
||||||
#include "ext_lzma.h"
|
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "dynloader.h"
|
#include "dynloader.h"
|
||||||
#include "cpu_crc32.h"
|
|
||||||
|
|
||||||
static const char *ST_PASS_HASHCAT_PLAIN = "hashcat";
|
static const char *ST_PASS_HASHCAT_PLAIN = "hashcat";
|
||||||
static const char *ST_PASS_HASHCAT_EXCL = "hashcat!";
|
static const char *ST_PASS_HASHCAT_EXCL = "hashcat!";
|
||||||
@ -953,151 +951,6 @@ void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx)
|
|||||||
memset (hashconfig, 0, sizeof (hashconfig_t));
|
memset (hashconfig, 0, sizeof (hashconfig_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx)
|
|
||||||
{
|
|
||||||
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
|
||||||
user_options_t *user_options = hashcat_ctx->user_options;
|
|
||||||
|
|
||||||
// truecrypt and veracrypt only
|
|
||||||
if (((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299))
|
|
||||||
|| ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode == 13799)))
|
|
||||||
{
|
|
||||||
hashes_t *hashes = hashcat_ctx->hashes;
|
|
||||||
|
|
||||||
tc_t *tc = (tc_t *) hashes->esalts_buf;
|
|
||||||
|
|
||||||
char *optional_param1 = NULL;
|
|
||||||
|
|
||||||
if (user_options->truecrypt_keyfiles) optional_param1 = user_options->truecrypt_keyfiles;
|
|
||||||
if (user_options->veracrypt_keyfiles) optional_param1 = user_options->veracrypt_keyfiles;
|
|
||||||
|
|
||||||
if (optional_param1)
|
|
||||||
{
|
|
||||||
char *tcvc_keyfiles = optional_param1;
|
|
||||||
|
|
||||||
char *keyfiles = hcstrdup (tcvc_keyfiles);
|
|
||||||
|
|
||||||
if (keyfiles == NULL) return -1;
|
|
||||||
|
|
||||||
char *saveptr = NULL;
|
|
||||||
|
|
||||||
char *keyfile = strtok_r (keyfiles, ",", &saveptr);
|
|
||||||
|
|
||||||
if (keyfile == NULL)
|
|
||||||
{
|
|
||||||
free (keyfiles);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
const int rc_crc32 = cpu_crc32 (hashcat_ctx, keyfile, (u8 *) tc->keyfile_buf);
|
|
||||||
|
|
||||||
if (rc_crc32 == -1)
|
|
||||||
{
|
|
||||||
free (keyfiles);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
} while ((keyfile = strtok_r ((char *) NULL, ",", &saveptr)) != NULL);
|
|
||||||
|
|
||||||
free (keyfiles);
|
|
||||||
}
|
|
||||||
|
|
||||||
// truecrypt and veracrypt boot only
|
|
||||||
if (hashconfig->opts_type & OPTS_TYPE_KEYBOARD_MAPPING)
|
|
||||||
{
|
|
||||||
if (user_options->keyboard_layout_mapping)
|
|
||||||
{
|
|
||||||
const bool rc = initialize_keyboard_layout_mapping (hashcat_ctx, user_options->keyboard_layout_mapping, tc->keyboard_layout_mapping_buf, &tc->keyboard_layout_mapping_cnt);
|
|
||||||
|
|
||||||
if (rc == false) return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// veracrypt only
|
|
||||||
if ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode == 13799))
|
|
||||||
{
|
|
||||||
if (user_options->veracrypt_pim)
|
|
||||||
{
|
|
||||||
// we can access salt directly here because in VC it's always just one salt not many
|
|
||||||
|
|
||||||
hashes_t *hashes = hashcat_ctx->hashes;
|
|
||||||
|
|
||||||
salt_t *salts_buf = hashes->salts_buf;
|
|
||||||
|
|
||||||
salt_t *salt = &salts_buf[0];
|
|
||||||
|
|
||||||
switch (hashconfig->hash_mode)
|
|
||||||
{
|
|
||||||
case 13711: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13712: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13713: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13721: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13722: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13723: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13731: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13732: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13733: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13741: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
|
||||||
break;
|
|
||||||
case 13742: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
|
||||||
break;
|
|
||||||
case 13743: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
|
||||||
break;
|
|
||||||
case 13751: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13752: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13753: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13761: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
|
||||||
break;
|
|
||||||
case 13762: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
|
||||||
break;
|
|
||||||
case 13763: salt->salt_iter = user_options->veracrypt_pim * 2048;
|
|
||||||
break;
|
|
||||||
case 13771: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13772: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
case 13773: salt->salt_iter = 15000 + (user_options->veracrypt_pim * 1000);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
salt->salt_iter -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void hashconfig_benchmark_defaults (hashcat_ctx_t *hashcat_ctx, salt_t *salt, void *esalt, void *hook_salt)
|
|
||||||
{
|
|
||||||
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
|
||||||
|
|
||||||
if (hashconfig->is_salted == true)
|
|
||||||
{
|
|
||||||
memcpy (salt, hashconfig->benchmark_salt, sizeof (salt_t));
|
|
||||||
|
|
||||||
memcpy (esalt, hashconfig->benchmark_esalt, hashconfig->esalt_size);
|
|
||||||
|
|
||||||
memcpy (hook_salt, hashconfig->benchmark_hook_salt, hashconfig->hook_salt_size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 default_hash_mode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
u32 default_hash_mode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||||
{
|
{
|
||||||
const u32 hash_mode = user_options->hash_mode;
|
const u32 hash_mode = user_options->hash_mode;
|
||||||
|
@ -29338,4 +29338,3 @@ int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,10 +535,9 @@ void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginn
|
|||||||
|
|
||||||
void example_hashes (hashcat_ctx_t *hashcat_ctx)
|
void example_hashes (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
folder_config_t *folder_config = hashcat_ctx->folder_config;
|
||||||
user_options_t *user_options = hashcat_ctx->user_options;
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
fclose (stderr); // a bit harsh
|
|
||||||
|
|
||||||
if (user_options->hash_mode_chgd == true)
|
if (user_options->hash_mode_chgd == true)
|
||||||
{
|
{
|
||||||
const int rc = hashconfig_init (hashcat_ctx);
|
const int rc = hashconfig_init (hashcat_ctx);
|
||||||
@ -593,10 +592,20 @@ void example_hashes (hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 100000; i++)
|
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||||
|
|
||||||
|
for (int i = 0; i < MODULE_HASH_MODES_MAXIMUM; i++)
|
||||||
{
|
{
|
||||||
user_options->hash_mode = i;
|
user_options->hash_mode = i;
|
||||||
|
|
||||||
|
#if defined (_WIN)
|
||||||
|
snprintf (modulefile, HCBUFSIZ_TINY, "%s/modules/module_%05d.dll", folder_config->shared_dir, i);
|
||||||
|
#else
|
||||||
|
snprintf (modulefile, HCBUFSIZ_TINY, "%s/modules/module_%05d.so", folder_config->shared_dir, i);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (hc_path_exist (modulefile) == false) continue;
|
||||||
|
|
||||||
const int rc = hashconfig_init (hashcat_ctx);
|
const int rc = hashconfig_init (hashcat_ctx);
|
||||||
|
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
@ -647,6 +656,8 @@ void example_hashes (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
hashconfig_destroy (hashcat_ctx);
|
hashconfig_destroy (hashcat_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hcfree (modulefile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
40
src/usage.c
40
src/usage.c
@ -269,30 +269,29 @@ void usage_mini_print (const char *progname)
|
|||||||
|
|
||||||
void usage_big_print (hashcat_ctx_t *hashcat_ctx)
|
void usage_big_print (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
folder_config_t *folder_config = hashcat_ctx->folder_config;
|
||||||
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
user_options_t *user_options = hashcat_ctx->user_options;
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
fclose (stderr); // a bit harsh
|
|
||||||
|
|
||||||
for (int i = 0; USAGE_BIG_PRE_HASHMODES[i] != NULL; i++)
|
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||||
{
|
|
||||||
printf ("%s", USAGE_BIG_PRE_HASHMODES[i]);
|
|
||||||
|
|
||||||
hc_fwrite (EOL, strlen (EOL), 1, stdout);
|
usage_sort_t *usage_sort_buf = (usage_sort_t *) hccalloc (MODULE_HASH_MODES_MAXIMUM, sizeof (usage_sort_t));
|
||||||
}
|
|
||||||
|
|
||||||
//hc_fwrite (EOL, strlen (EOL), 1, stdout);
|
|
||||||
|
|
||||||
#define MAX_HASH_MODES 100000
|
|
||||||
|
|
||||||
usage_sort_t *usage_sort_buf = (usage_sort_t *) hccalloc (MAX_HASH_MODES, sizeof (usage_sort_t));
|
|
||||||
|
|
||||||
int usage_sort_cnt = 0;
|
int usage_sort_cnt = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 100000; i++)
|
for (int i = 0; i < MODULE_HASH_MODES_MAXIMUM; i++)
|
||||||
{
|
{
|
||||||
user_options->hash_mode = i;
|
user_options->hash_mode = i;
|
||||||
|
|
||||||
|
#if defined (_WIN)
|
||||||
|
snprintf (modulefile, HCBUFSIZ_TINY, "%s/modules/module_%05d.dll", folder_config->shared_dir, i);
|
||||||
|
#else
|
||||||
|
snprintf (modulefile, HCBUFSIZ_TINY, "%s/modules/module_%05d.so", folder_config->shared_dir, i);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (hc_path_exist (modulefile) == false) continue;
|
||||||
|
|
||||||
const int rc = hashconfig_init (hashcat_ctx);
|
const int rc = hashconfig_init (hashcat_ctx);
|
||||||
|
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
@ -307,8 +306,19 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
|
|||||||
hashconfig_destroy (hashcat_ctx);
|
hashconfig_destroy (hashcat_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hcfree (modulefile);
|
||||||
|
|
||||||
qsort (usage_sort_buf, usage_sort_cnt, sizeof (usage_sort_t), sort_by_usage);
|
qsort (usage_sort_buf, usage_sort_cnt, sizeof (usage_sort_t), sort_by_usage);
|
||||||
|
|
||||||
|
for (int i = 0; USAGE_BIG_PRE_HASHMODES[i] != NULL; i++)
|
||||||
|
{
|
||||||
|
printf ("%s", USAGE_BIG_PRE_HASHMODES[i]);
|
||||||
|
|
||||||
|
hc_fwrite (EOL, strlen (EOL), 1, stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
//hc_fwrite (EOL, strlen (EOL), 1, stdout);
|
||||||
|
|
||||||
for (int i = 0; i < usage_sort_cnt; i++)
|
for (int i = 0; i < usage_sort_cnt; i++)
|
||||||
{
|
{
|
||||||
printf ("%7d | %-48s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category));
|
printf ("%7d | %-48s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category));
|
||||||
@ -316,6 +326,8 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
|
|||||||
hc_fwrite (EOL, strlen (EOL), 1, stdout);
|
hc_fwrite (EOL, strlen (EOL), 1, stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hc_fwrite (EOL, strlen (EOL), 1, stdout);
|
||||||
|
|
||||||
for (int i = 0; i < usage_sort_cnt; i++)
|
for (int i = 0; i < usage_sort_cnt; i++)
|
||||||
{
|
{
|
||||||
hcfree (usage_sort_buf[i].hash_name);
|
hcfree (usage_sort_buf[i].hash_name);
|
||||||
@ -323,8 +335,6 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
hcfree (usage_sort_buf);
|
hcfree (usage_sort_buf);
|
||||||
|
|
||||||
hc_fwrite (EOL, strlen (EOL), 1, stdout);
|
|
||||||
|
|
||||||
for (int i = 0; USAGE_BIG_POST_HASHMODES[i] != NULL; i++)
|
for (int i = 0; USAGE_BIG_POST_HASHMODES[i] != NULL; i++)
|
||||||
{
|
{
|
||||||
printf ("%s", USAGE_BIG_POST_HASHMODES[i]);
|
printf ("%s", USAGE_BIG_POST_HASHMODES[i]);
|
||||||
|
@ -614,7 +614,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user_options->hash_mode > 99999)
|
if (user_options->hash_mode >= MODULE_HASH_MODES_MAXIMUM)
|
||||||
{
|
{
|
||||||
event_log_error (hashcat_ctx, "Invalid -m (hash type) value specified.");
|
event_log_error (hashcat_ctx, "Invalid -m (hash type) value specified.");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user