1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-26 08:28:20 +00:00

Add module_deep_comp_kernel()

This commit is contained in:
jsteube 2019-01-05 18:44:43 +01:00
parent 6cbb5e4992
commit e0deb3f825
6 changed files with 60 additions and 54 deletions

View File

@ -57,6 +57,8 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *ha
u64 module_extra_buffer_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, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param);
char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param);
u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos);
void module_hook12 (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt);
void module_hook23 (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt);

View File

@ -938,7 +938,7 @@ struct hashconfig
u32 salt_min;
u32 salt_max;
int (*parse_func) (u8 *, u32, hash_t *, struct hashconfig *);
// int (*parse_func) (u8 *, u32, hash_t *, struct hashconfig *);
const char *st_hash;
const char *st_pass;
@ -2302,6 +2302,8 @@ typedef struct module_ctx
u64 (*module_extra_buffer_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *, const hashes_t *, const hc_device_param_t *);
char *(*module_jit_build_options) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *, const hashes_t *, const hc_device_param_t *);
u32 (*module_deep_comp_kernel) (const hashes_t *, const u32, const u32);
void (*module_hook12) (hc_device_param_t *, const void *, const u32, const u64);
void (*module_hook23) (hc_device_param_t *, const void *, const u32, const u64);

View File

@ -115,13 +115,13 @@ void module_init (module_ctx_t *module_ctx)
{
// undefined functions automatically call corresponding default functions
module_ctx->module_attack_exec = module_attack_exec;
module_ctx->module_benchmark_esalt = NULL;
module_ctx->module_benchmark_hook_salt = NULL;
module_ctx->module_benchmark_mask = NULL;
module_ctx->module_benchmark_salt = NULL;
module_ctx->module_build_plain_postprocess = NULL;
module_ctx->module_deep_comp_kernel = NULL;
module_ctx->module_dgst_pos0 = module_dgst_pos0;
module_ctx->module_dgst_pos1 = module_dgst_pos1;
module_ctx->module_dgst_pos2 = module_dgst_pos2;

View File

@ -28960,3 +28960,39 @@ bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
return false;
}
u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const u32 salt_pos, MAYBE_UNUSED const u32 digest_pos)
{
if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501))
{
const u32 digests_offset = hashes->salts_buf[salt_pos].digests_offset;
wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) hashes->esalts_buf;
wpa_eapol_t *wpa_eapol = &wpa_eapols[digests_offset + digest_pos];
if (wpa_eapol->keyver == 1)
{
return KERN_RUN_AUX1;
}
else if (wpa_eapol->keyver == 2)
{
return KERN_RUN_AUX2;
}
else if (wpa_eapol->keyver == 3)
{
return KERN_RUN_AUX3;
}
}
else if (hashconfig->hash_mode == 9600)
{
return KERN_RUN_3;
}
else if ((hashconfig->hash_mode == 16800) || (hashconfig->hash_mode == 16801))
{
return KERN_RUN_AUX1;
}
}

View File

@ -1442,45 +1442,11 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
device_param->kernel_params_buf32[28] = loops_pos;
device_param->kernel_params_buf32[29] = loops_cnt;
if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501))
{
const u32 digests_offset = hashes->salts_buf[salt_pos].digests_offset;
const u32 deep_comp_kernel = module_ctx->module_deep_comp_kernel (hashes, salt_pos, loops_pos);
wpa_eapol_t *wpa_eapols = (wpa_eapol_t *) hashes->esalts_buf;
CL_rc = run_kernel (hashcat_ctx, device_param, deep_comp_kernel, pws_cnt, false, 0);
wpa_eapol_t *wpa_eapol = &wpa_eapols[digests_offset + loops_pos];
if (wpa_eapol->keyver == 1)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, pws_cnt, false, 0);
if (CL_rc == -1) return -1;
}
else if (wpa_eapol->keyver == 2)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX2, pws_cnt, false, 0);
if (CL_rc == -1) return -1;
}
else if (wpa_eapol->keyver == 3)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX3, pws_cnt, false, 0);
if (CL_rc == -1) return -1;
}
}
else if (hashconfig->hash_mode == 9600)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_3, pws_cnt, false, 0);
if (CL_rc == -1) return -1;
}
else if ((hashconfig->hash_mode == 16800) || (hashconfig->hash_mode == 16801))
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, pws_cnt, false, 0);
if (CL_rc == -1) return -1;
}
if (CL_rc == -1) return -1;
if (status_ctx->run_thread_level2 == false) break;
}

View File

@ -449,25 +449,25 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
{
device_param->kernel_params_buf32[28] = 0;
device_param->kernel_params_buf32[29] = 1;
}
if (hashconfig->opts_type & OPTS_TYPE_AUX1)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, 1, false, 0);
if (hashconfig->opts_type & OPTS_TYPE_AUX1)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX1, 1, false, 0);
if (CL_rc == -1) return -1;
}
else if (hashconfig->opts_type & OPTS_TYPE_AUX2)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX2, 1, false, 0);
if (CL_rc == -1) return -1;
}
else if (hashconfig->opts_type & OPTS_TYPE_AUX2)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX2, 1, false, 0);
if (CL_rc == -1) return -1;
}
else if (hashconfig->opts_type & OPTS_TYPE_AUX3)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX3, 1, false, 0);
if (CL_rc == -1) return -1;
}
else if (hashconfig->opts_type & OPTS_TYPE_AUX3)
{
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_AUX3, 1, false, 0);
if (CL_rc == -1) return -1;
if (CL_rc == -1) return -1;
}
}
else
{