1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-22 22:58:30 +00:00

Truncate longer hash format in status output

This commit is contained in:
jsteube 2017-03-24 10:45:40 +01:00
parent 627bd4d83b
commit 6d66ff96c1
4 changed files with 89 additions and 58 deletions

View File

@ -20,6 +20,7 @@
##
- Refactored internal use of esalt from sync with number of salts to sync with number of digests
- Truncate longer hash format in status output
##
## Bugs

View File

@ -39,6 +39,8 @@ int tty_break(void);
int tty_getchar(void);
int tty_fix(void);
void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginning, const size_t keep_from_end);
void opencl_info (hashcat_ctx_t *hashcat_ctx);
void opencl_info_compact (hashcat_ctx_t *hashcat_ctx);

View File

@ -16,6 +16,7 @@
#include "outfile.h"
#include "monitor.h"
#include "mpsp.h"
#include "terminal.h"
#include "status.h"
static const char ST_0000[] = "Initializing";
@ -293,6 +294,8 @@ char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
ascii_digest ((hashcat_ctx_t *) hashcat_ctx, tmp_buf, HCBUFSIZ_LARGE, 0, 0);
compress_terminal_line_length (tmp_buf, 17, 6); // 17 = strlen ("Hash.Target....: ")
char *tmp_buf2 = strdup (tmp_buf);
free (tmp_buf);

View File

@ -19,6 +19,8 @@
#include "terminal.h"
#include "hashcat.h"
static const size_t TERMINAL_LINE_LENGTH = 79;
static const char *PROMPT = "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag)
@ -463,6 +465,29 @@ int tty_fix()
}
#endif
void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginning, const size_t keep_from_end)
{
const size_t target_len = TERMINAL_LINE_LENGTH - keep_from_beginning;
const size_t out_len = strlen (out_buf);
if (out_len < target_len) return;
char *ptr1 = out_buf + target_len - 3 - keep_from_end;
char *ptr2 = out_buf + out_len - keep_from_end;
*ptr1++ = '.';
*ptr1++ = '.';
*ptr1++ = '.';
for (size_t i = 0; i < keep_from_end; i++)
{
*ptr1++ = *ptr2++;
}
*ptr1 = 0;
}
void opencl_info (hashcat_ctx_t *hashcat_ctx)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
@ -695,28 +720,28 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
*/
event_log_info (hashcat_ctx,
"Session..........: %s",
"Session........: %s",
hashcat_status->session);
event_log_info (hashcat_ctx,
"Status...........: %s",
"Status.........: %s",
hashcat_status->status_string);
event_log_info (hashcat_ctx,
"Hash.Type........: %s",
"Hash.Type......: %s",
hashcat_status->hash_type);
event_log_info (hashcat_ctx,
"Hash.Target......: %s",
"Hash.Target....: %s",
hashcat_status->hash_target);
event_log_info (hashcat_ctx,
"Time.Started.....: %s (%s)",
"Time.Started...: %s (%s)",
hashcat_status->time_started_absolute,
hashcat_status->time_started_relative);
event_log_info (hashcat_ctx,
"Time.Estimated...: %s (%s)",
"Time.Estimated.: %s (%s)",
hashcat_status->time_estimated_absolute,
hashcat_status->time_estimated_relative);
@ -725,7 +750,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_FILE:
event_log_info (hashcat_ctx,
"Input.Base.......: File (%s)",
"Input.Base.....: File (%s)",
hashcat_status->input_base);
break;
@ -733,11 +758,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_FILE_RULES_FILE:
event_log_info (hashcat_ctx,
"Input.Base.......: File (%s)",
"Input.Base.....: File (%s)",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod........: Rules (%s)",
"Input.Mod......: Rules (%s)",
hashcat_status->input_mod);
break;
@ -745,28 +770,28 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_FILE_RULES_GEN:
event_log_info (hashcat_ctx,
"Input.Base.......: File (%s)",
"Input.Base.....: File (%s)",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod........: Rules (Generated)");
"Input.Mod......: Rules (Generated)");
break;
case INPUT_MODE_STRAIGHT_STDIN:
event_log_info (hashcat_ctx,
"Input.Base.......: Pipe");
"Input.Base.....: Pipe");
break;
case INPUT_MODE_STRAIGHT_STDIN_RULES_FILE:
event_log_info (hashcat_ctx,
"Input.Base.......: Pipe");
"Input.Base.....: Pipe");
event_log_info (hashcat_ctx,
"Input.Mod........: Rules (%s)",
"Input.Mod......: Rules (%s)",
hashcat_status->input_mod);
break;
@ -774,21 +799,21 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_STDIN_RULES_GEN:
event_log_info (hashcat_ctx,
"Input.Base.......: Pipe");
"Input.Base.....: Pipe");
event_log_info (hashcat_ctx,
"Input.Mod........: Rules (Generated)");
"Input.Mod......: Rules (Generated)");
break;
case INPUT_MODE_COMBINATOR_BASE_LEFT:
event_log_info (hashcat_ctx,
"Input.Base.......: File (%s), Left Side",
"Input.Base.....: File (%s), Left Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod........: File (%s), Right Side",
"Input.Mod......: File (%s), Right Side",
hashcat_status->input_mod);
break;
@ -796,11 +821,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_COMBINATOR_BASE_RIGHT:
event_log_info (hashcat_ctx,
"Input.Base.......: File (%s), Right Side",
"Input.Base.....: File (%s), Right Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod........: File (%s), Left Side",
"Input.Mod......: File (%s), Left Side",
hashcat_status->input_mod);
break;
@ -808,7 +833,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_MASK:
event_log_info (hashcat_ctx,
"Input.Mask.......: %s [%d]",
"Input.Mask.....: %s [%d]",
hashcat_status->input_base,
hashcat_status->input_mask_length);
@ -817,12 +842,12 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_MASK_CS:
event_log_info (hashcat_ctx,
"Input.Mask.......: %s [%d]",
"Input.Mask.....: %s [%d]",
hashcat_status->input_base,
hashcat_status->input_mask_length);
event_log_info (hashcat_ctx,
"Input.Charset....: %s ",
"Input.Charset..: %s ",
hashcat_status->input_charset);
break;
@ -830,11 +855,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_HYBRID1:
event_log_info (hashcat_ctx,
"Input.Base.......: File (%s), Left Side",
"Input.Base.....: File (%s), Left Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod........: Mask (%s) [%d], Right Side",
"Input.Mod......: Mask (%s) [%d], Right Side",
hashcat_status->input_mod,
hashcat_status->input_mask_length);
@ -843,16 +868,16 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_HYBRID1_CS:
event_log_info (hashcat_ctx,
"Input.Base.......: File (%s), Left Side",
"Input.Base.....: File (%s), Left Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod........: Mask (%s) [%d], Right Side",
"Input.Mod......: Mask (%s) [%d], Right Side",
hashcat_status->input_mod,
hashcat_status->input_mask_length);
event_log_info (hashcat_ctx,
"Input.Charset....: %s",
"Input.Charset..: %s",
hashcat_status->input_charset);
break;
@ -860,11 +885,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_HYBRID2:
event_log_info (hashcat_ctx,
"Input.Base.......: File (%s), Right Side",
"Input.Base.....: File (%s), Right Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod........: Mask (%s) [%d], Left Side",
"Input.Mod......: Mask (%s) [%d], Left Side",
hashcat_status->input_mod,
hashcat_status->input_mask_length);
@ -873,16 +898,16 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_HYBRID2_CS:
event_log_info (hashcat_ctx,
"Input.Base.......: File (%s), Right Side",
"Input.Base.....: File (%s), Right Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod........: Mask (%s) [%d], Left Side",
"Input.Mod......: Mask (%s) [%d], Left Side",
hashcat_status->input_mod,
hashcat_status->input_mask_length);
event_log_info (hashcat_ctx,
"Input.Charset....: %s",
"Input.Charset..: %s",
hashcat_status->input_charset);
break;
@ -893,7 +918,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_FILE:
event_log_info (hashcat_ctx,
"Input.Queue......: %d/%d (%.02f%%)",
"Input.Queue....: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
@ -903,7 +928,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_FILE_RULES_FILE:
event_log_info (hashcat_ctx,
"Input.Queue......: %d/%d (%.02f%%)",
"Input.Queue....: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
@ -913,7 +938,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_FILE_RULES_GEN:
event_log_info (hashcat_ctx,
"Input.Queue......: %d/%d (%.02f%%)",
"Input.Queue....: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
@ -923,7 +948,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_MASK:
event_log_info (hashcat_ctx,
"Input.Queue......: %d/%d (%.02f%%)",
"Input.Queue....: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
@ -933,7 +958,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_MASK_CS:
event_log_info (hashcat_ctx,
"Input.Queue......: %d/%d (%.02f%%)",
"Input.Queue....: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
@ -949,7 +974,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
hashcat_status->input_base_percent);
event_log_info (hashcat_ctx,
"Input.Queue.Mod..: %d/%d (%.02f%%)",
"Input.Queue.Mod: %d/%d (%.02f%%)",
hashcat_status->input_mod_offset,
hashcat_status->input_mod_count,
hashcat_status->input_mod_percent);
@ -965,7 +990,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
hashcat_status->input_base_percent);
event_log_info (hashcat_ctx,
"Input.Queue.Mod..: %d/%d (%.02f%%)",
"Input.Queue.Mod: %d/%d (%.02f%%)",
hashcat_status->input_mod_offset,
hashcat_status->input_mod_count,
hashcat_status->input_mod_percent);
@ -980,7 +1005,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Speed.Dev.#%d.....: %9sH/s (%0.2fms)", device_id + 1,
"Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id + 1,
device_info->speed_sec_dev,
device_info->exec_msec_dev);
}
@ -988,12 +1013,12 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->device_info_active > 1)
{
event_log_info (hashcat_ctx,
"Speed.Dev.#*.....: %9sH/s",
"Speed.Dev.#*...: %9sH/s",
hashcat_status->speed_sec_all);
}
event_log_info (hashcat_ctx,
"Recovered........: %d/%d (%.2f%%) Digests, %d/%d (%.2f%%) Salts",
"Recovered......: %d/%d (%.2f%%) Digests, %d/%d (%.2f%%) Salts",
hashcat_status->digests_done,
hashcat_status->digests_cnt,
hashcat_status->digests_percent,
@ -1004,7 +1029,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->digests_cnt > 1000)
{
event_log_info (hashcat_ctx,
"Recovered/Time...: %s",
"Recovered/Time.: %s",
hashcat_status->cpt);
}
@ -1013,19 +1038,19 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case PROGRESS_MODE_KEYSPACE_KNOWN:
event_log_info (hashcat_ctx,
"Progress.........: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
"Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
hashcat_status->progress_cur_relative_skip,
hashcat_status->progress_end_relative_skip,
hashcat_status->progress_finished_percent);
event_log_info (hashcat_ctx,
"Rejected.........: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
"Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
hashcat_status->progress_rejected,
hashcat_status->progress_cur_relative_skip,
hashcat_status->progress_rejected_percent);
event_log_info (hashcat_ctx,
"Restore.Point....: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
"Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
hashcat_status->restore_point,
hashcat_status->restore_total,
hashcat_status->restore_percent);
@ -1035,15 +1060,15 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case PROGRESS_MODE_KEYSPACE_UNKNOWN:
event_log_info (hashcat_ctx,
"Progress.........: %" PRIu64,
"Progress.......: %" PRIu64,
hashcat_status->progress_cur_relative_skip);
event_log_info (hashcat_ctx,
"Rejected.........: %" PRIu64,
"Rejected.......: %" PRIu64,
hashcat_status->progress_rejected);
event_log_info (hashcat_ctx,
"Restore.Point....: %" PRIu64,
"Restore.Point..: %" PRIu64,
hashcat_status->restore_point);
break;
@ -1058,7 +1083,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (device_info->input_candidates_dev == NULL) continue;
event_log_info (hashcat_ctx,
"Candidates.#%d....: %s", device_id + 1,
"Candidates.#%d..: %s", device_id + 1,
device_info->input_candidates_dev);
}
@ -1073,7 +1098,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (device_info->hwmon_dev == NULL) continue;
event_log_info (hashcat_ctx,
"HWMon.Dev.#%d.....: %s", device_id + 1,
"HWMon.Dev.#%d...: %s", device_id + 1,
device_info->hwmon_dev);
}
}
@ -1139,7 +1164,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Speed.Dev.#%d.....: %9sH/s (%0.2fms)", device_id + 1,
"Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id + 1,
device_info->speed_sec_dev,
device_info->exec_msec_dev);
}
@ -1147,7 +1172,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->device_info_active > 1)
{
event_log_info (hashcat_ctx,
"Speed.Dev.#*.....: %9sH/s",
"Speed.Dev.#*...: %9sH/s",
hashcat_status->speed_sec_all);
}
@ -1208,7 +1233,7 @@ void status_speed (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Speed.Dev.#%d.....: %9sH/s (%0.2fms)", device_id + 1,
"Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id + 1,
device_info->speed_sec_dev,
device_info->exec_msec_dev);
}
@ -1216,7 +1241,7 @@ void status_speed (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->device_info_active > 1)
{
event_log_info (hashcat_ctx,
"Speed.Dev.#*.....: %9sH/s",
"Speed.Dev.#*...: %9sH/s",
hashcat_status->speed_sec_all);
}
@ -1277,7 +1302,7 @@ void status_progress (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Progress.Dev.#%d..: %d", device_id + 1,
"Progress.Dev.#%d: %d", device_id + 1,
device_info->progress_dev);
}
@ -1288,7 +1313,7 @@ void status_progress (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Runtime.Dev.#%d...: %0.2fms", device_id + 1,
"Runtime.Dev.#%d.: %0.2fms", device_id + 1,
device_info->runtime_msec_dev);
}