1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-22 05:31:11 +00:00

Add OPTS_TYPE_PT_ALWAYS_HEXIFY

This commit is contained in:
jsteube 2018-12-20 16:12:29 +01:00
parent 0ce01b8836
commit 0421cc6782
4 changed files with 50 additions and 44 deletions

View File

@ -382,38 +382,39 @@ typedef enum opts_type
OPTS_TYPE_PT_NEVERCRACK = (1ULL << 11), // if we want all possible results
OPTS_TYPE_PT_BITSLICE = (1ULL << 12),
OPTS_TYPE_PT_ALWAYS_ASCII = (1ULL << 13),
OPTS_TYPE_PT_LM = (1ULL << 14), // special handling: all lower, 7 max, ...
OPTS_TYPE_ST_UTF16LE = (1ULL << 15),
OPTS_TYPE_ST_UTF16BE = (1ULL << 16),
OPTS_TYPE_ST_UPPER = (1ULL << 17),
OPTS_TYPE_ST_LOWER = (1ULL << 18),
OPTS_TYPE_ST_ADD01 = (1ULL << 19),
OPTS_TYPE_ST_ADD02 = (1ULL << 20),
OPTS_TYPE_ST_ADD80 = (1ULL << 21),
OPTS_TYPE_ST_ADDBITS14 = (1ULL << 22),
OPTS_TYPE_ST_ADDBITS15 = (1ULL << 23),
OPTS_TYPE_ST_GENERATE_LE = (1ULL << 24),
OPTS_TYPE_ST_GENERATE_BE = (1ULL << 25),
OPTS_TYPE_ST_HEX = (1ULL << 26),
OPTS_TYPE_ST_BASE64 = (1ULL << 27),
OPTS_TYPE_ST_HASH_MD5 = (1ULL << 28),
OPTS_TYPE_HASH_COPY = (1ULL << 29),
OPTS_TYPE_HASH_SPLIT = (1ULL << 30),
OPTS_TYPE_HOOK12 = (1ULL << 31),
OPTS_TYPE_HOOK23 = (1ULL << 32),
OPTS_TYPE_INIT2 = (1ULL << 33),
OPTS_TYPE_LOOP2 = (1ULL << 34),
OPTS_TYPE_AUX1 = (1ULL << 35),
OPTS_TYPE_AUX2 = (1ULL << 36),
OPTS_TYPE_AUX3 = (1ULL << 37),
OPTS_TYPE_AUX4 = (1ULL << 38),
OPTS_TYPE_BINARY_HASHFILE = (1ULL << 39),
OPTS_TYPE_PREFERED_THREAD = (1ULL << 40), // some algorithms (complicated ones with many branches) benefit from this
OPTS_TYPE_PT_ADD06 = (1ULL << 41),
OPTS_TYPE_KEYBOARD_MAPPING = (1ULL << 42),
OPTS_TYPE_STATE_BUFFER_LE = (1ULL << 43),
OPTS_TYPE_STATE_BUFFER_BE = (1ULL << 44),
OPTS_TYPE_DEEP_COMP_KERNEL = (1ULL << 45), // if we have to iterate through each hash inside the comp kernel, for example if each hash has to be decrypted separately
OPTS_TYPE_PT_ALWAYS_HEXIFY = (1ULL << 14),
OPTS_TYPE_PT_LM = (1ULL << 15), // special handling: all lower, 7 max, ...
OPTS_TYPE_ST_UTF16LE = (1ULL << 16),
OPTS_TYPE_ST_UTF16BE = (1ULL << 17),
OPTS_TYPE_ST_UPPER = (1ULL << 18),
OPTS_TYPE_ST_LOWER = (1ULL << 19),
OPTS_TYPE_ST_ADD01 = (1ULL << 20),
OPTS_TYPE_ST_ADD02 = (1ULL << 21),
OPTS_TYPE_ST_ADD80 = (1ULL << 22),
OPTS_TYPE_ST_ADDBITS14 = (1ULL << 23),
OPTS_TYPE_ST_ADDBITS15 = (1ULL << 24),
OPTS_TYPE_ST_GENERATE_LE = (1ULL << 25),
OPTS_TYPE_ST_GENERATE_BE = (1ULL << 26),
OPTS_TYPE_ST_HEX = (1ULL << 27),
OPTS_TYPE_ST_BASE64 = (1ULL << 28),
OPTS_TYPE_ST_HASH_MD5 = (1ULL << 29),
OPTS_TYPE_HASH_COPY = (1ULL << 30),
OPTS_TYPE_HASH_SPLIT = (1ULL << 31),
OPTS_TYPE_HOOK12 = (1ULL << 32),
OPTS_TYPE_HOOK23 = (1ULL << 33),
OPTS_TYPE_INIT2 = (1ULL << 34),
OPTS_TYPE_LOOP2 = (1ULL << 35),
OPTS_TYPE_AUX1 = (1ULL << 36),
OPTS_TYPE_AUX2 = (1ULL << 37),
OPTS_TYPE_AUX3 = (1ULL << 38),
OPTS_TYPE_AUX4 = (1ULL << 39),
OPTS_TYPE_BINARY_HASHFILE = (1ULL << 40),
OPTS_TYPE_PREFERED_THREAD = (1ULL << 41), // some algorithms (complicated ones with many branches) benefit from this
OPTS_TYPE_PT_ADD06 = (1ULL << 42),
OPTS_TYPE_KEYBOARD_MAPPING = (1ULL << 43),
OPTS_TYPE_STATE_BUFFER_LE = (1ULL << 44),
OPTS_TYPE_STATE_BUFFER_BE = (1ULL << 45),
OPTS_TYPE_DEEP_COMP_KERNEL = (1ULL << 46), // if we have to iterate through each hash inside the comp kernel, for example if each hash has to be decrypted separately
} opts_type_t;

View File

@ -25500,7 +25500,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
| OPTS_TYPE_PT_ADD80;
| OPTS_TYPE_PT_ADD80
| OPTS_TYPE_PT_ALWAYS_HEXIFY;
hashconfig->kern_type = KERN_TYPE_OLDOFFICE01CM1;
hashconfig->dgst_size = DGST_SIZE_4_4;
hashconfig->parse_func = oldoffice01cm1_parse_hash;
@ -25559,7 +25560,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
case 9810: hashconfig->hash_type = HASH_TYPE_OLDOFFICE34;
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE;
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
| OPTS_TYPE_PT_ALWAYS_HEXIFY;
hashconfig->kern_type = KERN_TYPE_OLDOFFICE34CM1;
hashconfig->dgst_size = DGST_SIZE_4_4;
hashconfig->parse_func = oldoffice34cm1_parse_hash;
@ -25705,7 +25707,8 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
case 10410: hashconfig->hash_type = HASH_TYPE_PDFU16;
hashconfig->salt_type = SALT_TYPE_EMBEDDED;
hashconfig->attack_exec = ATTACK_EXEC_INSIDE_KERNEL;
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE;
hashconfig->opts_type = OPTS_TYPE_PT_GENERATE_LE
| OPTS_TYPE_PT_ALWAYS_HEXIFY;
hashconfig->kern_type = KERN_TYPE_PDF11CM1;
hashconfig->dgst_size = DGST_SIZE_4_4;
hashconfig->parse_func = pdf11cm1_parse_hash;

View File

@ -561,6 +561,8 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign
const outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
const user_options_t *user_options = hashcat_ctx->user_options;
const u32 outfile_format = (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_HEXIFY) ? 5 : outfile_ctx->outfile_format;
int tmp_len = 0;
if (user_len > 0)
@ -571,7 +573,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign
tmp_len += user_len;
if (outfile_ctx->outfile_format & (OUTFILE_FMT_HASH | OUTFILE_FMT_PLAIN | OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS))
if (outfile_format & (OUTFILE_FMT_HASH | OUTFILE_FMT_PLAIN | OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS))
{
tmp_buf[tmp_len] = hashconfig->separator;
@ -580,7 +582,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign
}
}
if (outfile_ctx->outfile_format & OUTFILE_FMT_HASH)
if (outfile_format & OUTFILE_FMT_HASH)
{
const size_t out_len = strlen (out_buf);
@ -588,7 +590,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign
tmp_len += out_len;
if (outfile_ctx->outfile_format & (OUTFILE_FMT_PLAIN | OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS))
if (outfile_format & (OUTFILE_FMT_PLAIN | OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS))
{
tmp_buf[tmp_len] = hashconfig->separator;
@ -596,7 +598,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign
}
}
if (outfile_ctx->outfile_format & OUTFILE_FMT_PLAIN)
if (outfile_format & OUTFILE_FMT_PLAIN)
{
bool convert_to_hex = false;
@ -631,7 +633,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign
tmp_len += plain_len;
}
if (outfile_ctx->outfile_format & (OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS))
if (outfile_format & (OUTFILE_FMT_HEXPLAIN | OUTFILE_FMT_CRACKPOS))
{
tmp_buf[tmp_len] = hashconfig->separator;
@ -639,13 +641,13 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign
}
}
if (outfile_ctx->outfile_format & OUTFILE_FMT_HEXPLAIN)
if (outfile_format & OUTFILE_FMT_HEXPLAIN)
{
exec_hexify (plain_ptr, plain_len, (u8 *) tmp_buf + tmp_len);
tmp_len += plain_len * 2;
if (outfile_ctx->outfile_format & (OUTFILE_FMT_CRACKPOS))
if (outfile_format & (OUTFILE_FMT_CRACKPOS))
{
tmp_buf[tmp_len] = hashconfig->separator;
@ -653,7 +655,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign
}
}
if (outfile_ctx->outfile_format & OUTFILE_FMT_CRACKPOS)
if (outfile_format & OUTFILE_FMT_CRACKPOS)
{
tmp_len += snprintf (tmp_buf + tmp_len, HCBUFSIZ_LARGE - tmp_len, "%" PRIu64, crackpos);
}

View File

@ -780,7 +780,7 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx)
bool is_collider_hex_password = false;
if ((hashconfig->hash_mode == 9710) || (hashconfig->hash_mode == 9810) || (hashconfig->hash_mode == 10410))
if (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_HEXIFY)
{
if (is_hexify ((u8 *) hash->pw_buf, hash->pw_len) == true)
{