Merge branch 'master' of https://github.com/hashcat/hashcat
This commit is contained in:
@@ -22,7 +22,8 @@ static const u64 KERN_TYPE = 7100;
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_USES_BITS_64
|
||||
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_HASH_COPY;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$ml$1024$2484380731132131624506271467162123576077004878124365203837706482$89a3a979ee186c0c837ca4551f32e951e6564c7ac6798aa35baf4427fbf6bd1d630642c12cfd5c236c7b0104782237db95e895f7c0e372cd81d58f0448daf958";
|
||||
@@ -120,7 +121,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.len_min[3] = 128;
|
||||
token.len_max[3] = 128;
|
||||
token.len_max[3] = 256;
|
||||
token.attr[3] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
@@ -128,6 +129,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
const int hash_len = token.len[3];
|
||||
|
||||
if ((hash_len != 128) && (hash_len != 256)) return (PARSER_HASH_LENGTH);
|
||||
|
||||
const u8 *hash_pos = token.buf[3];
|
||||
|
||||
digest[0] = hex_to_u64 (hash_pos + 0);
|
||||
@@ -177,6 +182,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
return (PARSER_OK);
|
||||
}
|
||||
|
||||
/* replaced with OPTS_TYPE_HASH_COPY version
|
||||
|
||||
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
|
||||
{
|
||||
const u32 *digest = (const u32 *) digest_buf;
|
||||
@@ -215,6 +222,14 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
return line_len;
|
||||
}
|
||||
*/
|
||||
|
||||
int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size)
|
||||
{
|
||||
const int line_len = snprintf (line_buf, line_size, "%s", hash_info->orighash);
|
||||
|
||||
return line_len;
|
||||
}
|
||||
|
||||
void module_init (module_ctx_t *module_ctx)
|
||||
{
|
||||
|
||||
@@ -49,6 +49,8 @@ typedef struct oldoffice34
|
||||
u32 version;
|
||||
u32 encryptedVerifier[4];
|
||||
u32 encryptedVerifierHash[5];
|
||||
u32 secondBlockData[8];
|
||||
u32 secondBlockLen;
|
||||
u32 rc4key[2];
|
||||
|
||||
} oldoffice34_t;
|
||||
@@ -137,7 +139,22 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
|
||||
// alternative format (with second block data):
|
||||
|
||||
if (rc_tokenizer == PARSER_TOKEN_LENGTH) // or just rc_tokenizer != PARSER_OK
|
||||
{
|
||||
token.token_cnt = 6;
|
||||
|
||||
token.len_min[5] = 64;
|
||||
token.len_max[5] = 64;
|
||||
token.sep[5] = '*';
|
||||
token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
}
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
@@ -165,6 +182,24 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
oldoffice34->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24);
|
||||
oldoffice34->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32);
|
||||
|
||||
// second block (if needed)
|
||||
|
||||
oldoffice34->secondBlockLen = 0;
|
||||
|
||||
if (token.token_cnt == 6)
|
||||
{
|
||||
oldoffice34->secondBlockData[0] = 0;
|
||||
|
||||
const u8 *second_block_data = token.buf[5];
|
||||
|
||||
for (int i = 0, j = 0; i < 8; i += 1, j += 8)
|
||||
{
|
||||
oldoffice34->secondBlockData[i] = hex_to_u32 (second_block_data + j);
|
||||
}
|
||||
|
||||
oldoffice34->secondBlockLen = 64;
|
||||
}
|
||||
|
||||
// salt
|
||||
|
||||
salt->salt_len = 16;
|
||||
@@ -208,7 +243,23 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
{
|
||||
const oldoffice34_t *oldoffice34 = (const oldoffice34_t *) esalt_buf;
|
||||
|
||||
const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x",
|
||||
u8 secondBlockData[64 + 1 + 1];
|
||||
|
||||
memset (secondBlockData, 0, sizeof (secondBlockData));
|
||||
|
||||
if (oldoffice34->secondBlockLen != 0)
|
||||
{
|
||||
secondBlockData[0] = '*';
|
||||
|
||||
u8 *ptr = (u8 *) oldoffice34->secondBlockData;
|
||||
|
||||
for (int i = 0, j = 1; i < 32; i += 1, j += 2)
|
||||
{
|
||||
u8_to_hex (ptr[i], secondBlockData + j);
|
||||
}
|
||||
}
|
||||
|
||||
const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%s",
|
||||
SIGNATURE_OLDOFFICE,
|
||||
oldoffice34->version,
|
||||
salt->salt_buf[0],
|
||||
@@ -223,7 +274,8 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[1]),
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[2]),
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[3]),
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[4]));
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[4]),
|
||||
secondBlockData);
|
||||
|
||||
return line_len;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,8 @@ typedef struct oldoffice34
|
||||
u32 version;
|
||||
u32 encryptedVerifier[4];
|
||||
u32 encryptedVerifierHash[5];
|
||||
u32 secondBlockData[8];
|
||||
u32 secondBlockLen;
|
||||
u32 rc4key[2];
|
||||
|
||||
} oldoffice34_t;
|
||||
@@ -144,7 +146,22 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
|
||||
// alternative format (with second block data):
|
||||
|
||||
if (rc_tokenizer == PARSER_TOKEN_LENGTH) // or just rc_tokenizer != PARSER_OK
|
||||
{
|
||||
token.token_cnt = 6;
|
||||
|
||||
token.len_min[5] = 64;
|
||||
token.len_max[5] = 64;
|
||||
token.sep[5] = '*';
|
||||
token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
}
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
@@ -172,6 +189,24 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
oldoffice34->encryptedVerifierHash[3] = hex_to_u32 (encryptedVerifierHash_pos + 24);
|
||||
oldoffice34->encryptedVerifierHash[4] = hex_to_u32 (encryptedVerifierHash_pos + 32);
|
||||
|
||||
// second block (if needed)
|
||||
|
||||
oldoffice34->secondBlockLen = 0;
|
||||
|
||||
if (token.token_cnt == 6)
|
||||
{
|
||||
oldoffice34->secondBlockData[0] = 0;
|
||||
|
||||
const u8 *second_block_data = token.buf[5];
|
||||
|
||||
for (int i = 0, j = 0; i < 8; i += 1, j += 8)
|
||||
{
|
||||
oldoffice34->secondBlockData[i] = hex_to_u32 (second_block_data + j);
|
||||
}
|
||||
|
||||
oldoffice34->secondBlockLen = 64;
|
||||
}
|
||||
|
||||
// salt
|
||||
|
||||
salt->salt_len = 16;
|
||||
@@ -215,7 +250,23 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
{
|
||||
const oldoffice34_t *oldoffice34 = (const oldoffice34_t *) esalt_buf;
|
||||
|
||||
const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x",
|
||||
u8 secondBlockData[64 + 1 + 1];
|
||||
|
||||
memset (secondBlockData, 0, sizeof (secondBlockData));
|
||||
|
||||
if (oldoffice34->secondBlockLen != 0)
|
||||
{
|
||||
secondBlockData[0] = '*';
|
||||
|
||||
u8 *ptr = (u8 *) oldoffice34->secondBlockData;
|
||||
|
||||
for (int i = 0, j = 1; i < 32; i += 1, j += 2)
|
||||
{
|
||||
u8_to_hex (ptr[i], secondBlockData + j);
|
||||
}
|
||||
}
|
||||
|
||||
const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%s",
|
||||
SIGNATURE_OLDOFFICE,
|
||||
oldoffice34->version,
|
||||
salt->salt_buf[0],
|
||||
@@ -230,7 +281,8 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[1]),
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[2]),
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[3]),
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[4]));
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[4]),
|
||||
secondBlockData);
|
||||
|
||||
return line_len;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ typedef struct oldoffice34
|
||||
u32 version;
|
||||
u32 encryptedVerifier[4];
|
||||
u32 encryptedVerifierHash[5];
|
||||
u32 secondBlockData[8];
|
||||
u32 secondBlockLen;
|
||||
u32 rc4key[2];
|
||||
|
||||
} oldoffice34_t;
|
||||
@@ -117,7 +119,29 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
|
||||
// alternative format (with second block data):
|
||||
|
||||
if (rc_tokenizer == PARSER_TOKEN_LENGTH) // or just rc_tokenizer != PARSER_OK
|
||||
{
|
||||
token.token_cnt = 7;
|
||||
|
||||
token.sep[4] = '*';
|
||||
|
||||
token.len_min[5] = 64;
|
||||
token.len_max[5] = 64;
|
||||
token.sep[5] = ':';
|
||||
token.attr[5] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
token.len_min[6] = 10;
|
||||
token.len_max[6] = 10;
|
||||
token.attr[6] = TOKEN_ATTR_VERIFY_LENGTH
|
||||
| TOKEN_ATTR_VERIFY_HEX;
|
||||
|
||||
rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token);
|
||||
}
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
@@ -125,7 +149,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
const u8 *osalt_pos = token.buf[2];
|
||||
const u8 *encryptedVerifier_pos = token.buf[3];
|
||||
const u8 *encryptedVerifierHash_pos = token.buf[4];
|
||||
const u8 *rc4key_pos = token.buf[5];
|
||||
|
||||
const u8 rc4_idx = token.token_cnt - 1;
|
||||
|
||||
const u8 *rc4key_pos = token.buf[rc4_idx];
|
||||
|
||||
// esalt
|
||||
|
||||
@@ -163,6 +190,24 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
oldoffice34->rc4key[0] = byte_swap_32 (oldoffice34->rc4key[0]);
|
||||
oldoffice34->rc4key[1] = byte_swap_32 (oldoffice34->rc4key[1]);
|
||||
|
||||
// second block (if needed)
|
||||
|
||||
oldoffice34->secondBlockLen = 0;
|
||||
|
||||
if (token.token_cnt == 7)
|
||||
{
|
||||
oldoffice34->secondBlockData[0] = 0;
|
||||
|
||||
const u8 *second_block_data = token.buf[5];
|
||||
|
||||
for (int i = 0, j = 0; i < 8; i += 1, j += 8)
|
||||
{
|
||||
oldoffice34->secondBlockData[i] = hex_to_u32 (second_block_data + j);
|
||||
}
|
||||
|
||||
oldoffice34->secondBlockLen = 64;
|
||||
}
|
||||
|
||||
// salt
|
||||
|
||||
salt->salt_len = 16;
|
||||
@@ -208,7 +253,23 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
const u8 *rc4key = (const u8 *) oldoffice34->rc4key;
|
||||
|
||||
const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x:%02x%02x%02x%02x%02x",
|
||||
u8 secondBlockData[64 + 1 + 1];
|
||||
|
||||
memset (secondBlockData, 0, sizeof (secondBlockData));
|
||||
|
||||
if (oldoffice34->secondBlockLen != 0)
|
||||
{
|
||||
secondBlockData[0] = '*';
|
||||
|
||||
u8 *ptr = (u8 *) oldoffice34->secondBlockData;
|
||||
|
||||
for (int i = 0, j = 1; i < 32; i += 1, j += 2)
|
||||
{
|
||||
u8_to_hex (ptr[i], secondBlockData + j);
|
||||
}
|
||||
}
|
||||
|
||||
const int line_len = snprintf (line_buf, line_size, "%s%u*%08x%08x%08x%08x*%08x%08x%08x%08x*%08x%08x%08x%08x%08x%s:%02x%02x%02x%02x%02x",
|
||||
SIGNATURE_OLDOFFICE,
|
||||
oldoffice34->version,
|
||||
salt->salt_buf[0],
|
||||
@@ -224,6 +285,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[2]),
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[3]),
|
||||
byte_swap_32 (oldoffice34->encryptedVerifierHash[4]),
|
||||
secondBlockData,
|
||||
rc4key[0],
|
||||
rc4key[1],
|
||||
rc4key[2],
|
||||
|
||||
Reference in New Issue
Block a user