1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Terminal: Limit output length of example hash in --example-hash mode to 200. Use --mach to see full example hash

This commit is contained in:
jsteube 2022-07-27 12:35:57 +00:00
parent 9bc8a90593
commit 5fa08a7989
2 changed files with 12 additions and 8 deletions

View File

@ -121,6 +121,7 @@
- Modules: Added support of a custom charset setting for benchmarks to the module interface
- Modules: Added suffix *legacy* to old VeraCrypt modules (13711-13783).
- Terminal: Increased size of hash name column in `--help` and `--identify` options.
- Terminal: Limit output length of example hash in --example-hash mode to 200. Use --mach to see full example hash
- Modules: New LUKS v1 modules (29511-29543) which do not use `module_hash_binary_parse` to get data from containers anymore (use new tool `tools/luks2hashcat.py`).
- Modules: Renamed old LUKS module into LUKS v1 and added suffix *legacy* (14600).
- Workflow: Added basic workflow for GitHub Actions.

View File

@ -17,7 +17,7 @@
#include "timer.h"
#include "terminal.h"
#define MAXIMUM_EXAMPLE_HASH_LENGTH (128)
static const size_t MAXIMUM_EXAMPLE_HASH_LENGTH = 200;
static const size_t TERMINAL_LINE_LENGTH = 79;
@ -843,15 +843,18 @@ void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *user_op
event_log_info (hashcat_ctx, " Example.Hash.Format.: plain");
}
if (strlen (hashconfig->st_hash) > MAXIMUM_EXAMPLE_HASH_LENGTH) {
char st_hash[MAXIMUM_EXAMPLE_HASH_LENGTH + 1] = { '\0' };
if (strlen (hashconfig->st_hash) > MAXIMUM_EXAMPLE_HASH_LENGTH)
{
char *st_hash = hcstrdup (hashconfig->st_hash);
strncpy (st_hash, hashconfig->st_hash, MAXIMUM_EXAMPLE_HASH_LENGTH - 3);
strcpy (st_hash + MAXIMUM_EXAMPLE_HASH_LENGTH - 3, "...");
compress_terminal_line_length (st_hash, 24, 5);
event_log_info (hashcat_ctx, " Example.Hash........: [too long example hash for your terminal, use --machine-readable]");
event_log_info (hashcat_ctx, " %s", st_hash);
} else {
event_log_info (hashcat_ctx, " Example.Hash........: %s [Truncated, use --mach for full length]", st_hash);
hcfree (st_hash);
}
else
{
event_log_info (hashcat_ctx, " Example.Hash........: %s", hashconfig->st_hash);
}