1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

Show information about minimum and maximum password- and salt-length before the hash parser starts

This commit is contained in:
Jens Steube 2019-11-21 09:03:06 +01:00
parent 270210a8ab
commit 588e0ed294
4 changed files with 83 additions and 65 deletions

View File

@ -112,51 +112,53 @@ typedef enum event_identifier
EVENT_CRACKER_FINISHED = 0x00000030,
EVENT_CRACKER_HASH_CRACKED = 0x00000031,
EVENT_CRACKER_STARTING = 0x00000032,
EVENT_HASHLIST_COUNT_LINES_POST = 0x00000040,
EVENT_HASHLIST_COUNT_LINES_PRE = 0x00000041,
EVENT_HASHLIST_PARSE_HASH = 0x00000042,
EVENT_HASHLIST_SORT_HASH_POST = 0x00000043,
EVENT_HASHLIST_SORT_HASH_PRE = 0x00000044,
EVENT_HASHLIST_SORT_SALT_POST = 0x00000045,
EVENT_HASHLIST_SORT_SALT_PRE = 0x00000046,
EVENT_HASHLIST_UNIQUE_HASH_POST = 0x00000047,
EVENT_HASHLIST_UNIQUE_HASH_PRE = 0x00000048,
EVENT_INNERLOOP1_FINISHED = 0x00000050,
EVENT_INNERLOOP1_STARTING = 0x00000051,
EVENT_INNERLOOP2_FINISHED = 0x00000060,
EVENT_INNERLOOP2_STARTING = 0x00000061,
EVENT_LOG_ERROR = 0x00000070,
EVENT_LOG_INFO = 0x00000071,
EVENT_LOG_WARNING = 0x00000072,
EVENT_LOG_ADVICE = 0x00000073,
EVENT_MONITOR_RUNTIME_LIMIT = 0x00000080,
EVENT_MONITOR_STATUS_REFRESH = 0x00000081,
EVENT_MONITOR_TEMP_ABORT = 0x00000082,
EVENT_MONITOR_THROTTLE1 = 0x00000083,
EVENT_MONITOR_THROTTLE2 = 0x00000084,
EVENT_MONITOR_THROTTLE3 = 0x00000085,
EVENT_MONITOR_PERFORMANCE_HINT = 0x00000086,
EVENT_MONITOR_NOINPUT_HINT = 0x00000087,
EVENT_MONITOR_NOINPUT_ABORT = 0x00000088,
EVENT_BACKEND_SESSION_POST = 0x00000090,
EVENT_BACKEND_SESSION_PRE = 0x00000091,
EVENT_BACKEND_SESSION_HOSTMEM = 0x00000092,
EVENT_BACKEND_DEVICE_INIT_POST = 0x00000093,
EVENT_BACKEND_DEVICE_INIT_PRE = 0x00000094,
EVENT_OUTERLOOP_FINISHED = 0x000000a0,
EVENT_OUTERLOOP_MAINSCREEN = 0x000000a1,
EVENT_OUTERLOOP_STARTING = 0x000000a2,
EVENT_POTFILE_ALL_CRACKED = 0x000000b0,
EVENT_POTFILE_HASH_LEFT = 0x000000b1,
EVENT_POTFILE_HASH_SHOW = 0x000000b2,
EVENT_POTFILE_NUM_CRACKED = 0x000000b3,
EVENT_POTFILE_REMOVE_PARSE_POST = 0x000000b4,
EVENT_POTFILE_REMOVE_PARSE_PRE = 0x000000b5,
EVENT_SELFTEST_FINISHED = 0x000000c0,
EVENT_SELFTEST_STARTING = 0x000000c1,
EVENT_SET_KERNEL_POWER_FINAL = 0x000000d0,
EVENT_WORDLIST_CACHE_GENERATE = 0x000000e0,
EVENT_WORDLIST_CACHE_HIT = 0x000000e1,
EVENT_HASHCONFIG_PRE = 0x00000040,
EVENT_HASHCONFIG_POST = 0x00000041,
EVENT_HASHLIST_COUNT_LINES_POST = 0x00000050,
EVENT_HASHLIST_COUNT_LINES_PRE = 0x00000051,
EVENT_HASHLIST_PARSE_HASH = 0x00000052,
EVENT_HASHLIST_SORT_HASH_POST = 0x00000053,
EVENT_HASHLIST_SORT_HASH_PRE = 0x00000054,
EVENT_HASHLIST_SORT_SALT_POST = 0x00000055,
EVENT_HASHLIST_SORT_SALT_PRE = 0x00000056,
EVENT_HASHLIST_UNIQUE_HASH_POST = 0x00000057,
EVENT_HASHLIST_UNIQUE_HASH_PRE = 0x00000058,
EVENT_INNERLOOP1_FINISHED = 0x00000060,
EVENT_INNERLOOP1_STARTING = 0x00000061,
EVENT_INNERLOOP2_FINISHED = 0x00000070,
EVENT_INNERLOOP2_STARTING = 0x00000071,
EVENT_LOG_ERROR = 0x00000080,
EVENT_LOG_INFO = 0x00000081,
EVENT_LOG_WARNING = 0x00000082,
EVENT_LOG_ADVICE = 0x00000083,
EVENT_MONITOR_RUNTIME_LIMIT = 0x00000090,
EVENT_MONITOR_STATUS_REFRESH = 0x00000091,
EVENT_MONITOR_TEMP_ABORT = 0x00000092,
EVENT_MONITOR_THROTTLE1 = 0x00000093,
EVENT_MONITOR_THROTTLE2 = 0x00000094,
EVENT_MONITOR_THROTTLE3 = 0x00000095,
EVENT_MONITOR_PERFORMANCE_HINT = 0x00000096,
EVENT_MONITOR_NOINPUT_HINT = 0x00000097,
EVENT_MONITOR_NOINPUT_ABORT = 0x00000098,
EVENT_BACKEND_SESSION_POST = 0x000000a0,
EVENT_BACKEND_SESSION_PRE = 0x000000a1,
EVENT_BACKEND_SESSION_HOSTMEM = 0x000000a2,
EVENT_BACKEND_DEVICE_INIT_POST = 0x000000a3,
EVENT_BACKEND_DEVICE_INIT_PRE = 0x000000a4,
EVENT_OUTERLOOP_FINISHED = 0x000000b0,
EVENT_OUTERLOOP_MAINSCREEN = 0x000000b1,
EVENT_OUTERLOOP_STARTING = 0x000000b2,
EVENT_POTFILE_ALL_CRACKED = 0x000000c0,
EVENT_POTFILE_HASH_LEFT = 0x000000c1,
EVENT_POTFILE_HASH_SHOW = 0x000000c2,
EVENT_POTFILE_NUM_CRACKED = 0x000000c3,
EVENT_POTFILE_REMOVE_PARSE_POST = 0x000000c4,
EVENT_POTFILE_REMOVE_PARSE_PRE = 0x000000c5,
EVENT_SELFTEST_FINISHED = 0x000000d0,
EVENT_SELFTEST_STARTING = 0x000000d1,
EVENT_SET_KERNEL_POWER_FINAL = 0x000000e0,
EVENT_WORDLIST_CACHE_GENERATE = 0x000000f0,
EVENT_WORDLIST_CACHE_HIT = 0x000000f1,
// there will be much more event types soon

View File

@ -444,6 +444,8 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
* setup variables and buffers depending on hash_mode
*/
EVENT (EVENT_HASHCONFIG_PRE);
if (hashconfig_init (hashcat_ctx) == -1)
{
event_log_error (hashcat_ctx, "Invalid hash-mode '%u' selected.", user_options->hash_mode);
@ -451,6 +453,8 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
return -1;
}
EVENT (EVENT_HASHCONFIG_POST);
/**
* generate hashlist filename for later use
*/

View File

@ -484,24 +484,6 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
event_log_info (hashcat_ctx, NULL);
/**
* Optimizer constraints
*/
event_log_info (hashcat_ctx, "Minimum password length supported by kernel: %u", hashconfig->pw_min);
event_log_info (hashcat_ctx, "Maximum password length supported by kernel: %u", hashconfig->pw_max);
if (hashconfig->is_salted == true)
{
if (hashconfig->opti_type & OPTI_TYPE_RAW_HASH)
{
event_log_info (hashcat_ctx, "Minimim salt length supported by kernel: %u", hashconfig->salt_min);
event_log_info (hashcat_ctx, "Maximum salt length supported by kernel: %u", hashconfig->salt_max);
}
}
event_log_info (hashcat_ctx, NULL);
if ((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0)
{
if (hashconfig->has_optimized_kernel == true)
@ -898,6 +880,34 @@ static void main_wordlist_cache_generate (MAYBE_UNUSED hashcat_ctx_t *hashcat_ct
}
}
static void main_hashconfig_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
{
}
static void main_hashconfig_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
/**
* Optimizer constraints
*/
event_log_info (hashcat_ctx, "Minimum password length supported by kernel: %u", hashconfig->pw_min);
event_log_info (hashcat_ctx, "Maximum password length supported by kernel: %u", hashconfig->pw_max);
if (hashconfig->is_salted == true)
{
if (hashconfig->opti_type & OPTI_TYPE_RAW_HASH)
{
event_log_info (hashcat_ctx, "Minimim salt length supported by kernel: %u", hashconfig->salt_min);
event_log_info (hashcat_ctx, "Maximum salt length supported by kernel: %u", hashconfig->salt_max);
}
}
event_log_info (hashcat_ctx, NULL);
}
static void main_hashlist_count_lines_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
{
const user_options_t *user_options = hashcat_ctx->user_options;
@ -1006,6 +1016,8 @@ static void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, co
case EVENT_CRACKER_FINISHED: main_cracker_finished (hashcat_ctx, buf, len); break;
case EVENT_CRACKER_HASH_CRACKED: main_cracker_hash_cracked (hashcat_ctx, buf, len); break;
case EVENT_CRACKER_STARTING: main_cracker_starting (hashcat_ctx, buf, len); break;
case EVENT_HASHCONFIG_PRE: main_hashconfig_pre (hashcat_ctx, buf, len); break;
case EVENT_HASHCONFIG_POST: main_hashconfig_post (hashcat_ctx, buf, len); break;
case EVENT_HASHLIST_COUNT_LINES_POST: main_hashlist_count_lines_post (hashcat_ctx, buf, len); break;
case EVENT_HASHLIST_COUNT_LINES_PRE: main_hashlist_count_lines_pre (hashcat_ctx, buf, len); break;
case EVENT_HASHLIST_PARSE_HASH: main_hashlist_parse_hash (hashcat_ctx, buf, len); break;