From 2158fd70c97d00788cac40bf2683588821b5873b Mon Sep 17 00:00:00 2001 From: jsteube Date: Sat, 30 Mar 2019 16:55:55 +0100 Subject: [PATCH] Fix use of OPTS_TYPE_COPY_TMPS in modules --- src/hashes.c | 2 +- src/modules/module_02500.c | 3 ++- src/modules/module_02501.c | 3 ++- src/modules/module_16800.c | 29 ++++++++++++++++++-- src/modules/module_16801.c | 54 ++++++++++++++++++++++++++++++++++++-- 5 files changed, 84 insertions(+), 7 deletions(-) diff --git a/src/hashes.c b/src/hashes.c index ef3fbe12a..675fb0d23 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -268,7 +268,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS) { - void *tmps = hcmalloc (hashconfig->tmp_size); + tmps = hcmalloc (hashconfig->tmp_size); hc_clEnqueueReadBuffer (hashcat_ctx, device_param->command_queue, device_param->d_tmps, CL_TRUE, plain->gidvid * hashconfig->tmp_size, hashconfig->tmp_size, tmps, 0, NULL, NULL); } diff --git a/src/modules/module_02500.c b/src/modules/module_02500.c index cf06f4069..1a7445d39 100644 --- a/src/modules/module_02500.c +++ b/src/modules/module_02500.c @@ -27,8 +27,9 @@ static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_AUX1 | OPTS_TYPE_AUX2 | OPTS_TYPE_AUX3 + | OPTS_TYPE_BINARY_HASHFILE | OPTS_TYPE_DEEP_COMP_KERNEL - | OPTS_TYPE_BINARY_HASHFILE; + | OPTS_TYPE_COPY_TMPS; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "hashcat!"; static const char *ST_HASH = "4843505804000000000235380000000000000000000000000000000000000000000000000000000000000151aecc428f182acefbd1a9e62d369a079265784da83ba4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b823a1cd402aed449cced04f552c5b5acfebf06ae96a09c96d9a01c443a17aa62258c4f651a68aa67b0001030077fe010900200000000000000001a4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b8230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018dd160050f20101000050f20201000050f20201000050f20200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; diff --git a/src/modules/module_02501.c b/src/modules/module_02501.c index 7c6d68866..17f9d5297 100644 --- a/src/modules/module_02501.c +++ b/src/modules/module_02501.c @@ -27,8 +27,9 @@ static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE | OPTS_TYPE_AUX1 | OPTS_TYPE_AUX2 | OPTS_TYPE_AUX3 + | OPTS_TYPE_BINARY_HASHFILE | OPTS_TYPE_DEEP_COMP_KERNEL - | OPTS_TYPE_BINARY_HASHFILE; + | OPTS_TYPE_COPY_TMPS; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "7f620a599c445155935a35634638fa67b4aafecb92e0bd8625388757a63c2dda"; static const char *ST_HASH = "4843505804000000000235380000000000000000000000000000000000000000000000000000000000000151aecc428f182acefbd1a9e62d369a079265784da83ba4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b823a1cd402aed449cced04f552c5b5acfebf06ae96a09c96d9a01c443a17aa62258c4f651a68aa67b0001030077fe010900200000000000000001a4cf88375c44c830e6e5aa5d6faf352aa496a9ee129fb8292f7435df5420b8230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018dd160050f20101000050f20201000050f20201000050f20200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; diff --git a/src/modules/module_16800.c b/src/modules/module_16800.c index 2d19b8275..d4788788c 100644 --- a/src/modules/module_16800.c +++ b/src/modules/module_16800.c @@ -235,9 +235,34 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { const wpa_pmkid_t *wpa_pmkid = (const wpa_pmkid_t *) esalt_buf; - exec_hexify ((const u8 *) wpa_pmkid->essid_buf, (const size_t) wpa_pmkid->essid_len, (u8 *) line_buf); + char tmp_buf[128]; - return wpa_pmkid->essid_len * 2; + exec_hexify ((const u8*) wpa_pmkid->essid_buf, wpa_pmkid->essid_len, (u8 *) tmp_buf); + + const int tmp_len = wpa_pmkid->essid_len * 2; + + tmp_buf[tmp_len] = 0; + + const int line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x*%s", + byte_swap_32 (wpa_pmkid->pmkid[0]), + byte_swap_32 (wpa_pmkid->pmkid[1]), + byte_swap_32 (wpa_pmkid->pmkid[2]), + byte_swap_32 (wpa_pmkid->pmkid[3]), + wpa_pmkid->orig_mac_ap[0], + wpa_pmkid->orig_mac_ap[1], + wpa_pmkid->orig_mac_ap[2], + wpa_pmkid->orig_mac_ap[3], + wpa_pmkid->orig_mac_ap[4], + wpa_pmkid->orig_mac_ap[5], + wpa_pmkid->orig_mac_sta[0], + wpa_pmkid->orig_mac_sta[1], + wpa_pmkid->orig_mac_sta[2], + wpa_pmkid->orig_mac_sta[3], + wpa_pmkid->orig_mac_sta[4], + wpa_pmkid->orig_mac_sta[5], + tmp_buf); + + return line_len; } void module_init (module_ctx_t *module_ctx) diff --git a/src/modules/module_16801.c b/src/modules/module_16801.c index 6aaa9f52f..c91e89384 100644 --- a/src/modules/module_16801.c +++ b/src/modules/module_16801.c @@ -266,9 +266,59 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE { const wpa_pmkid_t *wpa_pmkid = (const wpa_pmkid_t *) esalt_buf; - exec_hexify ((const u8 *) wpa_pmkid->essid_buf, (const size_t) wpa_pmkid->essid_len, (u8 *) line_buf); + int line_len = 0; - return wpa_pmkid->essid_len * 2; + if (wpa_pmkid->essid_len) + { + char tmp_buf[128]; + + exec_hexify ((const u8*) wpa_pmkid->essid_buf, wpa_pmkid->essid_len, (u8 *) tmp_buf); + + int tmp_len = wpa_pmkid->essid_len * 2; + + tmp_buf[tmp_len] = 0; + + line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x*%s", + byte_swap_32 (wpa_pmkid->pmkid[0]), + byte_swap_32 (wpa_pmkid->pmkid[1]), + byte_swap_32 (wpa_pmkid->pmkid[2]), + byte_swap_32 (wpa_pmkid->pmkid[3]), + wpa_pmkid->orig_mac_ap[0], + wpa_pmkid->orig_mac_ap[1], + wpa_pmkid->orig_mac_ap[2], + wpa_pmkid->orig_mac_ap[3], + wpa_pmkid->orig_mac_ap[4], + wpa_pmkid->orig_mac_ap[5], + wpa_pmkid->orig_mac_sta[0], + wpa_pmkid->orig_mac_sta[1], + wpa_pmkid->orig_mac_sta[2], + wpa_pmkid->orig_mac_sta[3], + wpa_pmkid->orig_mac_sta[4], + wpa_pmkid->orig_mac_sta[5], + tmp_buf); + } + else + { + line_len = snprintf (line_buf, line_size, "%08x%08x%08x%08x*%02x%02x%02x%02x%02x%02x*%02x%02x%02x%02x%02x%02x", + byte_swap_32 (wpa_pmkid->pmkid[0]), + byte_swap_32 (wpa_pmkid->pmkid[1]), + byte_swap_32 (wpa_pmkid->pmkid[2]), + byte_swap_32 (wpa_pmkid->pmkid[3]), + wpa_pmkid->orig_mac_ap[0], + wpa_pmkid->orig_mac_ap[1], + wpa_pmkid->orig_mac_ap[2], + wpa_pmkid->orig_mac_ap[3], + wpa_pmkid->orig_mac_ap[4], + wpa_pmkid->orig_mac_ap[5], + wpa_pmkid->orig_mac_sta[0], + wpa_pmkid->orig_mac_sta[1], + wpa_pmkid->orig_mac_sta[2], + wpa_pmkid->orig_mac_sta[3], + wpa_pmkid->orig_mac_sta[4], + wpa_pmkid->orig_mac_sta[5]); + } + + return line_len; } void module_init (module_ctx_t *module_ctx)