mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-27 00:48:13 +00:00
Support loading hash from command line in -m 22000 and -m 22001
Fixes #2742
This commit is contained in:
parent
6daea9c7c1
commit
1323ef3a82
@ -423,6 +423,8 @@ typedef enum opts_type
|
|||||||
OPTS_TYPE_AUX3 = (1ULL << 37),
|
OPTS_TYPE_AUX3 = (1ULL << 37),
|
||||||
OPTS_TYPE_AUX4 = (1ULL << 38),
|
OPTS_TYPE_AUX4 = (1ULL << 38),
|
||||||
OPTS_TYPE_BINARY_HASHFILE = (1ULL << 39),
|
OPTS_TYPE_BINARY_HASHFILE = (1ULL << 39),
|
||||||
|
OPTS_TYPE_BINARY_HASHFILE_OPTIONAL
|
||||||
|
= (1ULL << 40), // this allows us to not enforce the use of a binary file. requires OPTS_TYPE_BINARY_HASHFILE set to be effective.
|
||||||
OPTS_TYPE_PT_ADD06 = (1ULL << 41),
|
OPTS_TYPE_PT_ADD06 = (1ULL << 41),
|
||||||
OPTS_TYPE_KEYBOARD_MAPPING = (1ULL << 42),
|
OPTS_TYPE_KEYBOARD_MAPPING = (1ULL << 42),
|
||||||
OPTS_TYPE_DEEP_COMP_KERNEL = (1ULL << 43), // if we have to iterate through each hash inside the comp kernel, for example if each hash has to be decrypted separately
|
OPTS_TYPE_DEEP_COMP_KERNEL = (1ULL << 43), // if we have to iterate through each hash inside the comp kernel, for example if each hash has to be decrypted separately
|
||||||
|
22
src/hashes.c
22
src/hashes.c
@ -632,6 +632,20 @@ int hashes_init_filename (hashcat_ctx_t *hashcat_ctx)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
||||||
|
{
|
||||||
|
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE_OPTIONAL)
|
||||||
|
{
|
||||||
|
if ((user_options->benchmark == false) && (user_options->keyspace == false))
|
||||||
|
{
|
||||||
|
hashes->hashlist_mode = (hc_path_exist (user_options_extra->hc_hash) == true) ? HL_MODE_FILE_PLAIN : HL_MODE_ARG;
|
||||||
|
|
||||||
|
if (hashes->hashlist_mode == HL_MODE_FILE_PLAIN)
|
||||||
|
{
|
||||||
|
hashes->hashfile = user_options_extra->hc_hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
hashes->hashlist_mode = HL_MODE_FILE_BINARY;
|
hashes->hashlist_mode = HL_MODE_FILE_BINARY;
|
||||||
|
|
||||||
@ -647,6 +661,7 @@ int hashes_init_filename (hashcat_ctx_t *hashcat_ctx)
|
|||||||
hashes->hashfile = user_options_extra->hc_hash;
|
hashes->hashfile = user_options_extra->hc_hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hashes->hashlist_mode = (hc_path_exist (user_options_extra->hc_hash) == true) ? HL_MODE_FILE_PLAIN : HL_MODE_ARG;
|
hashes->hashlist_mode = (hc_path_exist (user_options_extra->hc_hash) == true) ? HL_MODE_FILE_PLAIN : HL_MODE_ARG;
|
||||||
@ -1857,6 +1872,12 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
||||||
|
{
|
||||||
|
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE_OPTIONAL)
|
||||||
|
{
|
||||||
|
parser_status = module_ctx->module_hash_decode (hashconfig, hash.digest, hash.salt, hash.esalt, hash.hook_salt, hash.hash_info, hashconfig->st_hash, strlen (hashconfig->st_hash));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
char *tmpfile_bin;
|
char *tmpfile_bin;
|
||||||
|
|
||||||
@ -1883,6 +1904,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
hcfree (tmpfile_bin);
|
hcfree (tmpfile_bin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hashconfig_t *hashconfig_st = (hashconfig_t *) hcmalloc (sizeof (hashconfig_t));
|
hashconfig_t *hashconfig_st = (hashconfig_t *) hcmalloc (sizeof (hashconfig_t));
|
||||||
|
@ -35,6 +35,7 @@ static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE
|
|||||||
| OPTS_TYPE_AUX3
|
| OPTS_TYPE_AUX3
|
||||||
| OPTS_TYPE_AUX4
|
| OPTS_TYPE_AUX4
|
||||||
| OPTS_TYPE_BINARY_HASHFILE
|
| OPTS_TYPE_BINARY_HASHFILE
|
||||||
|
| OPTS_TYPE_BINARY_HASHFILE_OPTIONAL
|
||||||
| OPTS_TYPE_DEEP_COMP_KERNEL
|
| OPTS_TYPE_DEEP_COMP_KERNEL
|
||||||
| OPTS_TYPE_COPY_TMPS;
|
| OPTS_TYPE_COPY_TMPS;
|
||||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||||
|
@ -35,6 +35,7 @@ static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE
|
|||||||
| OPTS_TYPE_AUX3
|
| OPTS_TYPE_AUX3
|
||||||
| OPTS_TYPE_AUX4
|
| OPTS_TYPE_AUX4
|
||||||
| OPTS_TYPE_BINARY_HASHFILE
|
| OPTS_TYPE_BINARY_HASHFILE
|
||||||
|
| OPTS_TYPE_BINARY_HASHFILE_OPTIONAL
|
||||||
| OPTS_TYPE_DEEP_COMP_KERNEL
|
| OPTS_TYPE_DEEP_COMP_KERNEL
|
||||||
| OPTS_TYPE_COPY_TMPS
|
| OPTS_TYPE_COPY_TMPS
|
||||||
| OPTS_TYPE_POTFILE_NOPASS;
|
| OPTS_TYPE_POTFILE_NOPASS;
|
||||||
|
10
src/status.c
10
src/status.c
@ -329,9 +329,19 @@ char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
||||||
|
{
|
||||||
|
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE_OPTIONAL)
|
||||||
|
{
|
||||||
|
if (hashes->hashfile)
|
||||||
{
|
{
|
||||||
return hcstrdup (hashes->hashfile);
|
return hcstrdup (hashes->hashfile);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return hcstrdup (hashes->hashfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user