mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-25 17:38:23 +00:00
Get rid of hash_mode depending branches in status.c
This commit is contained in:
parent
e0deb3f825
commit
888da50aad
@ -52,6 +52,7 @@ bool module_warmup_disable (MAYBE_UNUSED const hashconfig_t *ha
|
||||
int module_hash_decode_outfile (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, const char *line_buf, MAYBE_UNUSED const int line_len);
|
||||
int module_hash_decode_zero_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf);
|
||||
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, const char *line_buf, MAYBE_UNUSED const int line_len);
|
||||
int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, char *line_buf, MAYBE_UNUSED const int line_size);
|
||||
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, char *line_buf, MAYBE_UNUSED const int line_size);
|
||||
|
||||
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);
|
||||
|
@ -2297,6 +2297,7 @@ typedef struct module_ctx
|
||||
int (*module_hash_decode_outfile) (const hashconfig_t *, void *, salt_t *, void *, const char *, const int);
|
||||
int (*module_hash_decode_zero_hash) (const hashconfig_t *, void *, salt_t *, void *);
|
||||
int (*module_hash_decode) (const hashconfig_t *, void *, salt_t *, void *, const char *, const int);
|
||||
int (*module_hash_encode_status) (const hashconfig_t *, const void *, const salt_t *, const void *, char *, int);
|
||||
int (*module_hash_encode) (const hashconfig_t *, const void *, const salt_t *, const void *, char *, int);
|
||||
|
||||
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 *);
|
||||
|
@ -131,9 +131,10 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_esalt_size = NULL;
|
||||
module_ctx->module_extra_buffer_size = NULL;
|
||||
module_ctx->module_forced_outfile_format = NULL;
|
||||
module_ctx->module_hash_decode = module_hash_decode;
|
||||
module_ctx->module_hash_decode_outfile = NULL;
|
||||
module_ctx->module_hash_decode_zero_hash = NULL;
|
||||
module_ctx->module_hash_decode = module_hash_decode;
|
||||
module_ctx->module_hash_encode_status = NULL;
|
||||
module_ctx->module_hash_encode = module_hash_encode;
|
||||
module_ctx->module_hash_mode = NULL;
|
||||
module_ctx->module_hash_name = module_hash_name;
|
||||
|
@ -592,7 +592,6 @@ int ascii_digest (const hashconfig_t *hashconfig, const hashes_t *hashes, const
|
||||
|
||||
return out_len;
|
||||
|
||||
|
||||
/*
|
||||
if (salt_type == SALT_TYPE_GENERIC)
|
||||
{
|
||||
|
@ -28994,5 +28994,66 @@ u32 module_deep_comp_kernel (MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED c
|
||||
}
|
||||
}
|
||||
|
||||
int module_hash_encode_status (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, char *line_buf, MAYBE_UNUSED const int line_size)
|
||||
{
|
||||
if (hashes->digests_cnt == 1)
|
||||
{
|
||||
if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501))
|
||||
{
|
||||
char *tmp_buf;
|
||||
|
||||
wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hashes->esalts_buf;
|
||||
|
||||
hc_asprintf (&tmp_buf, "%s (AP:%02x:%02x:%02x:%02x:%02x:%02x STA:%02x:%02x:%02x:%02x:%02x:%02x)",
|
||||
(char *) hashes->salts_buf[0].salt_buf,
|
||||
wpa_eapol->orig_mac_ap[0],
|
||||
wpa_eapol->orig_mac_ap[1],
|
||||
wpa_eapol->orig_mac_ap[2],
|
||||
wpa_eapol->orig_mac_ap[3],
|
||||
wpa_eapol->orig_mac_ap[4],
|
||||
wpa_eapol->orig_mac_ap[5],
|
||||
wpa_eapol->orig_mac_sta[0],
|
||||
wpa_eapol->orig_mac_sta[1],
|
||||
wpa_eapol->orig_mac_sta[2],
|
||||
wpa_eapol->orig_mac_sta[3],
|
||||
wpa_eapol->orig_mac_sta[4],
|
||||
wpa_eapol->orig_mac_sta[5]);
|
||||
|
||||
return tmp_buf;
|
||||
}
|
||||
else if (hashconfig->hash_mode == 5200)
|
||||
{
|
||||
return hashes->hashfile;
|
||||
}
|
||||
else if (hashconfig->hash_mode == 9000)
|
||||
{
|
||||
return hashes->hashfile;
|
||||
}
|
||||
else if ((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299))
|
||||
{
|
||||
return hashes->hashfile;
|
||||
}
|
||||
else if ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode <= 13799))
|
||||
{
|
||||
return hashes->hashfile;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hashconfig->hash_mode == 3000)
|
||||
{
|
||||
char *tmp_buf;
|
||||
|
||||
char out_buf1[64] = { 0 };
|
||||
char out_buf2[64] = { 0 };
|
||||
|
||||
ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, out_buf1, sizeof (out_buf1), 0, 0);
|
||||
ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, out_buf2, sizeof (out_buf2), 0, 1);
|
||||
|
||||
hc_asprintf (&tmp_buf, "%s, %s", out_buf1, out_buf2);
|
||||
|
||||
return tmp_buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
71
src/status.c
71
src/status.c
@ -300,49 +300,27 @@ const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||
const module_ctx_t *module_ctx = hashcat_ctx->module_ctx;
|
||||
|
||||
if (hashes->digests_cnt == 1)
|
||||
if (module_ctx->module_hash_encode_status)
|
||||
{
|
||||
if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501))
|
||||
{
|
||||
char *tmp_buf;
|
||||
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hashes->esalts_buf;
|
||||
const int tmp_len = module_ctx->module_hash_encode_status (hashconfig, hashes->digests_buf, hashes->salts_buf, hashes->esalts_buf, tmp_buf, HCBUFSIZ_LARGE);
|
||||
|
||||
hc_asprintf (&tmp_buf, "%s (AP:%02x:%02x:%02x:%02x:%02x:%02x STA:%02x:%02x:%02x:%02x:%02x:%02x)",
|
||||
(char *) hashes->salts_buf[0].salt_buf,
|
||||
wpa_eapol->orig_mac_ap[0],
|
||||
wpa_eapol->orig_mac_ap[1],
|
||||
wpa_eapol->orig_mac_ap[2],
|
||||
wpa_eapol->orig_mac_ap[3],
|
||||
wpa_eapol->orig_mac_ap[4],
|
||||
wpa_eapol->orig_mac_ap[5],
|
||||
wpa_eapol->orig_mac_sta[0],
|
||||
wpa_eapol->orig_mac_sta[1],
|
||||
wpa_eapol->orig_mac_sta[2],
|
||||
wpa_eapol->orig_mac_sta[3],
|
||||
wpa_eapol->orig_mac_sta[4],
|
||||
wpa_eapol->orig_mac_sta[5]);
|
||||
char *tmp_buf2 = (char *) hcmalloc (tmp_len + 1);
|
||||
|
||||
return tmp_buf;
|
||||
}
|
||||
else if (hashconfig->hash_mode == 5200)
|
||||
{
|
||||
return hashes->hashfile;
|
||||
}
|
||||
else if (hashconfig->hash_mode == 9000)
|
||||
{
|
||||
return hashes->hashfile;
|
||||
}
|
||||
else if ((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299))
|
||||
{
|
||||
return hashes->hashfile;
|
||||
}
|
||||
else if ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode <= 13799))
|
||||
{
|
||||
return hashes->hashfile;
|
||||
}
|
||||
else
|
||||
memcpy (tmp_buf2, tmp_buf, tmp_len);
|
||||
|
||||
free (tmp_buf);
|
||||
|
||||
tmp_buf2[tmp_len] = 0;
|
||||
|
||||
return tmp_buf2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hashes->digests_cnt == 1)
|
||||
{
|
||||
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
@ -358,23 +336,6 @@ const char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return tmp_buf2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hashconfig->hash_mode == 3000)
|
||||
{
|
||||
char *tmp_buf;
|
||||
|
||||
char out_buf1[64] = { 0 };
|
||||
char out_buf2[64] = { 0 };
|
||||
|
||||
ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, out_buf1, sizeof (out_buf1), 0, 0);
|
||||
ascii_digest (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, out_buf2, sizeof (out_buf2), 0, 1);
|
||||
|
||||
hc_asprintf (&tmp_buf, "%s, %s", out_buf1, out_buf2);
|
||||
|
||||
return tmp_buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
return hashes->hashfile;
|
||||
|
Loading…
Reference in New Issue
Block a user