diff --git a/include/status.h b/include/status.h index bff65c767..0e22c9f3b 100644 --- a/include/status.h +++ b/include/status.h @@ -25,6 +25,7 @@ int status_get_input_mode (const hashcat_ctx_t *hashcat_ctx) char *status_get_input_base (const hashcat_ctx_t *hashcat_ctx); char *status_get_input_mod (const hashcat_ctx_t *hashcat_ctx); char *status_get_input_charset (const hashcat_ctx_t *hashcat_ctx); +char *status_get_input_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); char *status_get_hash_type (const hashcat_ctx_t *hashcat_ctx); char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx); int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx); diff --git a/include/types.h b/include/types.h index 25a697673..3f24a9477 100644 --- a/include/types.h +++ b/include/types.h @@ -1486,6 +1486,7 @@ typedef struct double hashes_msec_dev; double exec_msec_dev; char *speed_sec_dev; + char *input_candidates_dev; } device_info_t; diff --git a/src/hashcat.c b/src/hashcat.c index 7c8cc2e33..0e0e06923 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -1186,10 +1186,11 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st { device_info_t *device_info = hashcat_status->device_info_buf + device_id; - device_info->skipped_dev = status_get_skipped_dev (hashcat_ctx, device_id); - device_info->hashes_msec_dev = status_get_hashes_msec_dev (hashcat_ctx, device_id); - device_info->exec_msec_dev = status_get_exec_msec_dev (hashcat_ctx, device_id); - device_info->speed_sec_dev = status_get_speed_sec_dev (hashcat_ctx, device_id); + device_info->skipped_dev = status_get_skipped_dev (hashcat_ctx, device_id); + device_info->hashes_msec_dev = status_get_hashes_msec_dev (hashcat_ctx, device_id); + device_info->exec_msec_dev = status_get_exec_msec_dev (hashcat_ctx, device_id); + device_info->speed_sec_dev = status_get_speed_sec_dev (hashcat_ctx, device_id); + device_info->input_candidates_dev = status_get_input_candidates_dev (hashcat_ctx, device_id); } hashcat_status->hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx); diff --git a/src/status.c b/src/status.c index d31f0e9ee..b140e4afd 100644 --- a/src/status.c +++ b/src/status.c @@ -511,6 +511,70 @@ char *status_get_input_charset (const hashcat_ctx_t *hashcat_ctx) return NULL; } +char *status_get_input_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id) +{ + const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; + const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; + + hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id]; + + char *display = (char *) malloc (HCBUFSIZ_TINY); + + if (user_options_extra->attack_kern == ATTACK_KERN_BF) + { + snprintf (display, HCBUFSIZ_TINY - 1, "[Generating]"); + } + else + { + snprintf (display, HCBUFSIZ_TINY - 1, "[Copying]"); + } + + if (device_param->skipped == true) return display; + + if ((device_param->outerloop_left == 0) || (device_param->innerloop_left == 0)) return display; + + const u32 outerloop_first = 0; + const u32 outerloop_last = device_param->outerloop_left - 1; + + const u32 innerloop_first = 0; + const u32 innerloop_last = device_param->innerloop_left - 1; + + plain_t plain1 = { 0, 0, 0, outerloop_first, innerloop_first }; + plain_t plain2 = { 0, 0, 0, outerloop_last, innerloop_last }; + + u32 plain_buf1[16] = { 0 }; + u32 plain_buf2[16] = { 0 }; + + u8 *plain_ptr1 = (u8 *) plain_buf1; + u8 *plain_ptr2 = (u8 *) plain_buf2; + + int plain_len1 = 0; + int plain_len2 = 0; + + build_plain ((hashcat_ctx_t *) hashcat_ctx, device_param, &plain1, plain_buf1, &plain_len1); + build_plain ((hashcat_ctx_t *) hashcat_ctx, device_param, &plain2, plain_buf2, &plain_len2); + + const bool need_hex1 = need_hexify (plain_ptr1, plain_len1); + const bool need_hex2 = need_hexify (plain_ptr2, plain_len2); + + if ((need_hex1 == true) || (need_hex2 == true)) + { + exec_hexify (plain_ptr1, plain_len1, plain_ptr1); + exec_hexify (plain_ptr2, plain_len2, plain_ptr2); + + plain_ptr1[plain_len1 * 2] = 0; + plain_ptr2[plain_len2 * 2] = 0; + + snprintf (display, HCBUFSIZ_TINY - 1, "$HEX[%s] -> $HEX[%s]", plain_ptr1, plain_ptr2); + } + else + { + snprintf (display, HCBUFSIZ_TINY - 1, "%s -> %s", plain_ptr1, plain_ptr2); + } + + return display; +} + int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx) { const hashes_t *hashes = hashcat_ctx->hashes; diff --git a/src/terminal.c b/src/terminal.c index c8cdfa3a1..87f8e9782 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -611,10 +611,9 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx) void status_display (hashcat_ctx_t *hashcat_ctx) { - opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; - status_ctx_t *status_ctx = hashcat_ctx->status_ctx; - user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; - user_options_t *user_options = hashcat_ctx->user_options; + opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; + status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + user_options_t *user_options = hashcat_ctx->user_options; if (status_ctx->devices_status == STATUS_INIT) { @@ -660,14 +659,6 @@ void status_display (hashcat_ctx_t *hashcat_ctx) status_get_time_estimated_relative (hashcat_ctx)); event_log_info (hashcat_ctx, "Hash.Type......: %s", status_get_hash_type (hashcat_ctx)); event_log_info (hashcat_ctx, "Hash.Target....: %s", status_get_hash_target (hashcat_ctx)); - event_log_info (hashcat_ctx, "Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", - status_get_digests_done (hashcat_ctx), - status_get_digests_cnt (hashcat_ctx), - status_get_digests_percent (hashcat_ctx), - status_get_salts_done (hashcat_ctx), - status_get_salts_cnt (hashcat_ctx), - status_get_salts_percent (hashcat_ctx)); - event_log_info (hashcat_ctx, "Recovered/Time.: %s", status_get_cpt (hashcat_ctx)); switch (status_get_input_mode (hashcat_ctx)) { @@ -728,6 +719,13 @@ void status_display (hashcat_ctx_t *hashcat_ctx) break; } + for (int device_id = 0; device_id < status_get_device_info_cnt (hashcat_ctx); device_id++) + { + if (status_get_skipped_dev (hashcat_ctx, device_id) == true) continue; + + event_log_info (hashcat_ctx, "Candidates.#%d..: %s", device_id + 1, status_get_input_candidates_dev (hashcat_ctx, device_id)); + } + switch (status_get_progress_mode (hashcat_ctx)) { case PROGRESS_MODE_KEYSPACE_KNOWN: @@ -751,10 +749,16 @@ void status_display (hashcat_ctx_t *hashcat_ctx) break; } - const int device_info_cnt = status_get_device_info_cnt (hashcat_ctx); - const int device_info_active = status_get_device_info_active (hashcat_ctx); + event_log_info (hashcat_ctx, "Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", + status_get_digests_done (hashcat_ctx), + status_get_digests_cnt (hashcat_ctx), + status_get_digests_percent (hashcat_ctx), + status_get_salts_done (hashcat_ctx), + status_get_salts_cnt (hashcat_ctx), + status_get_salts_percent (hashcat_ctx)); + event_log_info (hashcat_ctx, "Recovered/Time.: %s", status_get_cpt (hashcat_ctx)); - for (int device_id = 0; device_id < device_info_cnt; device_id++) + for (int device_id = 0; device_id < status_get_device_info_cnt (hashcat_ctx); device_id++) { if (status_get_skipped_dev (hashcat_ctx, device_id) == true) continue; @@ -763,69 +767,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx) status_get_exec_msec_dev (hashcat_ctx, device_id)); } - if (device_info_active > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*...: %9sH/s", status_get_speed_sec_all (hashcat_ctx)); - - if (status_ctx->run_main_level1 == false) return; - - for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++) - { - hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id]; - - if (device_param->skipped) continue; - - if ((device_param->outerloop_left == 0) || (device_param->innerloop_left == 0)) - { - if (user_options_extra->attack_kern == ATTACK_KERN_BF) - { - event_log_info (hashcat_ctx, "Candidates.#%d..: [Generating]", device_id + 1); - } - else - { - event_log_info (hashcat_ctx, "Candidates.#%d..: [Copying]", device_id + 1); - } - - continue; - } - - const u32 outerloop_first = 0; - const u32 outerloop_last = device_param->outerloop_left - 1; - - const u32 innerloop_first = 0; - const u32 innerloop_last = device_param->innerloop_left - 1; - - plain_t plain1 = { 0, 0, 0, outerloop_first, innerloop_first }; - plain_t plain2 = { 0, 0, 0, outerloop_last, innerloop_last }; - - u32 plain_buf1[16] = { 0 }; - u32 plain_buf2[16] = { 0 }; - - u8 *plain_ptr1 = (u8 *) plain_buf1; - u8 *plain_ptr2 = (u8 *) plain_buf2; - - int plain_len1 = 0; - int plain_len2 = 0; - - build_plain (hashcat_ctx, device_param, &plain1, plain_buf1, &plain_len1); - build_plain (hashcat_ctx, device_param, &plain2, plain_buf2, &plain_len2); - - bool need_hex1 = need_hexify (plain_ptr1, plain_len1); - bool need_hex2 = need_hexify (plain_ptr2, plain_len2); - - if ((need_hex1 == true) || (need_hex2 == true)) - { - exec_hexify (plain_ptr1, plain_len1, plain_ptr1); - exec_hexify (plain_ptr2, plain_len2, plain_ptr2); - - plain_ptr1[plain_len1 * 2] = 0; - plain_ptr2[plain_len2 * 2] = 0; - - event_log_info (hashcat_ctx, "Candidates.#%d..: $HEX[%s] -> $HEX[%s]", device_id + 1, plain_ptr1, plain_ptr2); - } - else - { - event_log_info (hashcat_ctx, "Candidates.#%d..: %s -> %s", device_id + 1, plain_ptr1, plain_ptr2); - } - } + if (status_get_device_info_active (hashcat_ctx) > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*...: %9sH/s", status_get_speed_sec_all (hashcat_ctx)); if (user_options->gpu_temp_disable == false) {