mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
Remove OPTS_TYPE_HASH_COPY from -m 31400
This commit is contained in:
parent
7a90a3a36b
commit
04e7f84daf
@ -20,6 +20,13 @@
|
||||
#include M2S(INCLUDE_PATH/inc_cipher_aes.cl)
|
||||
#endif
|
||||
|
||||
typedef struct scrtv2
|
||||
{
|
||||
u32 ct_buf[64];
|
||||
int ct_len;
|
||||
|
||||
} scrtv2_t;
|
||||
|
||||
DECLSPEC void shift_buffer_by_offset (PRIVATE_AS u32 *w0, const u32 offset)
|
||||
{
|
||||
const int offset_switch = offset / 4;
|
||||
@ -128,7 +135,7 @@ DECLSPEC void aes256_scrt_format (PRIVATE_AS u32 *aes_ks, PRIVATE_AS u32 *pw, co
|
||||
AES256_encrypt (aes_ks, hash, out, s_te0, s_te1, s_te2, s_te3, s_te4);
|
||||
}
|
||||
|
||||
KERNEL_FQ void m31400_mxx (KERN_ATTR_RULES ())
|
||||
KERNEL_FQ void m31400_mxx (KERN_ATTR_RULES_ESALT (scrtv2_t))
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
@ -212,7 +219,7 @@ KERNEL_FQ void m31400_mxx (KERN_ATTR_RULES ())
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m31400_sxx (KERN_ATTR_RULES ())
|
||||
KERNEL_FQ void m31400_sxx (KERN_ATTR_RULES_ESALT (scrtv2_t))
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
|
@ -20,6 +20,13 @@
|
||||
#include M2S(INCLUDE_PATH/inc_cipher_aes.cl)
|
||||
#endif
|
||||
|
||||
typedef struct scrtv2
|
||||
{
|
||||
u32 ct_buf[64];
|
||||
int ct_len;
|
||||
|
||||
} scrtv2_t;
|
||||
|
||||
DECLSPEC void shift_buffer_by_offset (PRIVATE_AS u32 *w0, const u32 offset)
|
||||
{
|
||||
const int offset_switch = offset / 4;
|
||||
@ -128,7 +135,7 @@ DECLSPEC void aes256_scrt_format (PRIVATE_AS u32 *aes_ks, PRIVATE_AS u32 *pw, co
|
||||
AES256_encrypt (aes_ks, hash, out, s_te0, s_te1, s_te2, s_te3, s_te4);
|
||||
}
|
||||
|
||||
KERNEL_FQ void m31400_mxx (KERN_ATTR_BASIC ())
|
||||
KERNEL_FQ void m31400_mxx (KERN_ATTR_ESALT (scrtv2_t))
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
@ -218,7 +225,7 @@ KERNEL_FQ void m31400_mxx (KERN_ATTR_BASIC ())
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m31400_sxx (KERN_ATTR_BASIC ())
|
||||
KERNEL_FQ void m31400_sxx (KERN_ATTR_ESALT (scrtv2_t))
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
|
@ -20,6 +20,13 @@
|
||||
#include M2S(INCLUDE_PATH/inc_cipher_aes.cl)
|
||||
#endif
|
||||
|
||||
typedef struct scrtv2
|
||||
{
|
||||
u32 ct_buf[64];
|
||||
int ct_len;
|
||||
|
||||
} scrtv2_t;
|
||||
|
||||
DECLSPEC void shift_buffer_by_offset (PRIVATE_AS u32 *w0, const u32 offset)
|
||||
{
|
||||
const int offset_switch = offset / 4;
|
||||
@ -298,7 +305,7 @@ DECLSPEC void aes256_scrt_format_VV (PRIVATE_AS u32 *aes_ks, PRIVATE_AS u32x *w,
|
||||
#endif
|
||||
}
|
||||
|
||||
KERNEL_FQ void m31400_mxx (KERN_ATTR_VECTOR())
|
||||
KERNEL_FQ void m31400_mxx (KERN_ATTR_VECTOR_ESALT (scrtv2_t))
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
@ -393,7 +400,7 @@ KERNEL_FQ void m31400_mxx (KERN_ATTR_VECTOR())
|
||||
}
|
||||
}
|
||||
|
||||
KERNEL_FQ void m31400_sxx (KERN_ATTR_VECTOR())
|
||||
KERNEL_FQ void m31400_sxx (KERN_ATTR_VECTOR_ESALT (scrtv2_t))
|
||||
{
|
||||
/**
|
||||
* modifier
|
||||
|
@ -29,10 +29,9 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_NOT_SALTED
|
||||
| OPTI_TYPE_RAW_HASH;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE
|
||||
| OPTS_TYPE_HASH_COPY
|
||||
| OPTS_TYPE_PT_ADD80
|
||||
| OPTS_TYPE_PT_ADDBITS15;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_NONE;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "S:\"Config Passphrase\"=02:ded7137400e0a1004a12f1708453968ccc270908ba02ab0345c83690d1de3d9937587be66ad2a7fe8cc6cb16ecff02e61ac05e09d4f49f284efd24f6b16d6ae3";
|
||||
|
||||
@ -51,20 +50,34 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig,
|
||||
const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; }
|
||||
const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; }
|
||||
|
||||
typedef struct scrtv2
|
||||
{
|
||||
u32 ct_buf[64];
|
||||
int ct_len;
|
||||
|
||||
} scrtv2_t;
|
||||
|
||||
static const char *CONFIGPASSPHRASEV2_SIGNATURE = "S:\"Config Passphrase\"=02:"; //The whole line is part of the format to prevent confusion with other similiar tokens also prefixed with 02: in the config files
|
||||
|
||||
u64 module_esalt_size (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 u64 esalt_size = (const u64) sizeof (scrtv2_t);
|
||||
|
||||
return esalt_size;
|
||||
}
|
||||
|
||||
int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len)
|
||||
{
|
||||
static const char *CONFIGPASSPHRASEV2_SIGNATURE = "S:\"Config Passphrase\"=02:"; //The whole line is part of the format to prevent confusion with other similiar tokens also prefixed with 02: in the config files
|
||||
static const char *CONFIGPASSPHRASEV2_SIGNATURE_UNDERSCORE = "S:_Config_Passphrase_=02:"; //double quotes char messes up testing so we're also allowing underscore instead
|
||||
|
||||
u32 *digest = (u32 *) digest_buf;
|
||||
|
||||
scrtv2_t *scrtv2 = (scrtv2_t *) esalt_buf;
|
||||
|
||||
hc_token_t token;
|
||||
|
||||
token.token_cnt = 2;
|
||||
|
||||
token.signatures_cnt = 2;
|
||||
token.signatures_cnt = 1;
|
||||
token.signatures_buf[0] = CONFIGPASSPHRASEV2_SIGNATURE;
|
||||
token.signatures_buf[1] = CONFIGPASSPHRASEV2_SIGNATURE_UNDERSCORE;
|
||||
|
||||
token.len[0] = 25;
|
||||
token.attr[0] = TOKEN_ATTR_FIXED_LENGTH
|
||||
@ -79,12 +92,23 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
if (rc_tokenizer != PARSER_OK) return (rc_tokenizer);
|
||||
|
||||
const u8 *hash_pos = token.buf[1];
|
||||
// some fake salt so we can have an esalt
|
||||
|
||||
digest[0] = hex_to_u32 (hash_pos + 0);
|
||||
digest[1] = hex_to_u32 (hash_pos + 8);
|
||||
digest[2] = hex_to_u32 (hash_pos + 16);
|
||||
digest[3] = hex_to_u32 (hash_pos + 24);
|
||||
salt->salt_buf[0] = 0;
|
||||
|
||||
salt->salt_len = 4;
|
||||
|
||||
const int ct_len = token.len[1];
|
||||
const u8 *ct_pos = token.buf[1];
|
||||
|
||||
scrtv2->ct_len = hex_decode (ct_pos, ct_len, (u8 *) scrtv2->ct_buf);
|
||||
|
||||
// hash
|
||||
|
||||
digest[0] = hex_to_u32 (ct_pos + 0);
|
||||
digest[1] = hex_to_u32 (ct_pos + 8);
|
||||
digest[2] = hex_to_u32 (ct_pos + 16);
|
||||
digest[3] = hex_to_u32 (ct_pos + 24);
|
||||
|
||||
digest[0] = byte_swap_32 (digest[0]);
|
||||
digest[1] = byte_swap_32 (digest[1]);
|
||||
@ -96,8 +120,15 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
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;
|
||||
const scrtv2_t *scrtv2 = (const scrtv2_t *) esalt_buf;
|
||||
|
||||
u8 *out_buf = (u8 *) line_buf;
|
||||
|
||||
int out_len = snprintf (line_buf, line_size, "%s", CONFIGPASSPHRASEV2_SIGNATURE);
|
||||
|
||||
out_len += hex_encode ((u8 *) scrtv2->ct_buf, scrtv2->ct_len, out_buf + out_len);
|
||||
|
||||
return out_len;
|
||||
}
|
||||
|
||||
void module_init (module_ctx_t *module_ctx)
|
||||
@ -120,7 +151,7 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_dgst_pos3 = module_dgst_pos3;
|
||||
module_ctx->module_dgst_size = module_dgst_size;
|
||||
module_ctx->module_dictstat_disable = MODULE_DEFAULT;
|
||||
module_ctx->module_esalt_size = MODULE_DEFAULT;
|
||||
module_ctx->module_esalt_size = module_esalt_size;
|
||||
module_ctx->module_extra_buffer_size = MODULE_DEFAULT;
|
||||
module_ctx->module_extra_tmp_size = MODULE_DEFAULT;
|
||||
module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT;
|
||||
|
@ -55,7 +55,7 @@ sub module_generate_hash
|
||||
});
|
||||
|
||||
my $ciphertext=$aes->encrypt(pack("H*",$plaintext));
|
||||
my $hash = sprintf("S:_Config_Passphrase_=02:%s",unpack ("H*",$ciphertext));
|
||||
my $hash = sprintf("S:\"Config Passphrase\"=02:%s",unpack ("H*",$ciphertext));
|
||||
|
||||
return $hash
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user