diff --git a/src/main.c b/src/main.c index 7d72823fa..d062d9141 100644 --- a/src/main.c +++ b/src/main.c @@ -173,8 +173,8 @@ static void main_cracker_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB } else if (user_options_extra->wordlist_mode == WL_MODE_STDIN) { - fprintf (stdout, "Starting attack in stdin mode..." EOL); - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, "Starting attack in stdin mode..."); + event_log_info (hashcat_ctx, ""); } } @@ -191,7 +191,7 @@ static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB if (user_options->machine_readable == false) { - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, ""); } } else @@ -200,11 +200,11 @@ static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB { clear_prompt (); - if (hashes->digests_saved != hashes->digests_done) fprintf (stdout, EOL); + if (hashes->digests_saved != hashes->digests_done) event_log_info (hashcat_ctx, ""); status_display (hashcat_ctx); - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, ""); } else { @@ -212,7 +212,7 @@ static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB { status_display (hashcat_ctx); - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, ""); } } } @@ -235,7 +235,7 @@ static void main_calculated_words_base (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, if (user_options->keyspace == false) return; - fprintf (stdout, "%" PRIu64 "" EOL, status_ctx->words_base); + event_log_info (hashcat_ctx, "%" PRIu64 "", status_ctx->words_base); } static void main_potfile_remove_parse_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -244,7 +244,7 @@ static void main_potfile_remove_parse_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_c if (user_options->quiet == true) return; - fprintf (stdout, "Comparing hashes with potfile entries..."); + event_log_info_nn (hashcat_ctx, "Comparing hashes with potfile entries..."); } static void main_potfile_remove_parse_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -253,7 +253,7 @@ static void main_potfile_remove_parse_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ if (user_options->quiet == true) return; - fprintf (stdout, "Compared hashes with potfile entries..."); + event_log_info_nn (hashcat_ctx, "Compared hashes with potfile entries..."); } static void main_potfile_num_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -269,13 +269,13 @@ static void main_potfile_num_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, M { if (potfile_remove_cracks == 1) { - fprintf (stdout, "INFO: Removed 1 hash found in potfile" EOL); - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, "INFO: Removed 1 hash found in potfile"); + event_log_info (hashcat_ctx, ""); } else { - fprintf (stdout, "INFO: Removed %d hashes found in potfile" EOL, potfile_remove_cracks); - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, "INFO: Removed %d hashes found in potfile", potfile_remove_cracks); + event_log_info (hashcat_ctx, ""); } } } @@ -286,8 +286,8 @@ static void main_potfile_all_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, M if (user_options->quiet == true) return; - fprintf (stdout, "INFO: All hashes found in potfile! You can use --show to display them." EOL); - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, "INFO: All hashes found in potfile! You can use --show to display them."); + event_log_info (hashcat_ctx, ""); } static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -309,36 +309,36 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, { char *hash_type = strhashtype (hashconfig->hash_mode); // not a bug - fprintf (stdout, "Hashtype: %s" EOL, hash_type); - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, "Hashtype: %s", hash_type); + event_log_info (hashcat_ctx, ""); } } if (user_options->quiet == true) return; - fprintf (stdout, "Hashes: %u digests; %u unique digests, %u unique salts" EOL, hashes->hashes_cnt_orig, hashes->digests_cnt, hashes->salts_cnt); - fprintf (stdout, "Bitmaps: %u bits, %u entries, 0x%08x mask, %u bytes, %u/%u rotates" EOL, bitmap_ctx->bitmap_bits, bitmap_ctx->bitmap_nums, bitmap_ctx->bitmap_mask, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_shift1, bitmap_ctx->bitmap_shift2); + event_log_info (hashcat_ctx, "Hashes: %u digests; %u unique digests, %u unique salts", hashes->hashes_cnt_orig, hashes->digests_cnt, hashes->salts_cnt); + event_log_info (hashcat_ctx, "Bitmaps: %u bits, %u entries, 0x%08x mask, %u bytes, %u/%u rotates", bitmap_ctx->bitmap_bits, bitmap_ctx->bitmap_nums, bitmap_ctx->bitmap_mask, bitmap_ctx->bitmap_size, bitmap_ctx->bitmap_shift1, bitmap_ctx->bitmap_shift2); if (user_options->attack_mode == ATTACK_MODE_STRAIGHT) { - fprintf (stdout, "Rules: %u" EOL, straight_ctx->kernel_rules_cnt); + event_log_info (hashcat_ctx, "Rules: %u", straight_ctx->kernel_rules_cnt); } if (user_options->quiet == false) event_log_info (hashcat_ctx, ""); if (hashconfig->opti_type) { - fprintf (stdout, "Applicable Optimizers:" EOL); + event_log_info (hashcat_ctx, "Applicable Optimizers:"); for (u32 i = 0; i < 32; i++) { const u32 opti_bit = 1u << i; - if (hashconfig->opti_type & opti_bit) fprintf (stdout, "* %s" EOL, stroptitype (opti_bit)); + if (hashconfig->opti_type & opti_bit) event_log_info (hashcat_ctx, "* %s", stroptitype (opti_bit)); } } - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, ""); /** * Watchdog and Temperature balance @@ -346,31 +346,31 @@ static void main_outerloop_mainscreen (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, if (hwmon_ctx->enabled == false && user_options->gpu_temp_disable == false) { - fprintf (stdout, "Watchdog: Hardware Monitoring Interface not found on your system" EOL); + event_log_info (hashcat_ctx, "Watchdog: Hardware Monitoring Interface not found on your system"); } if (hwmon_ctx->enabled == true && user_options->gpu_temp_abort > 0) { - fprintf (stdout, "Watchdog: Temperature abort trigger set to %uc" EOL, user_options->gpu_temp_abort); + event_log_info (hashcat_ctx, "Watchdog: Temperature abort trigger set to %uc", user_options->gpu_temp_abort); } else { - fprintf (stdout, "Watchdog: Temperature abort trigger disabled" EOL); + event_log_info (hashcat_ctx, "Watchdog: Temperature abort trigger disabled"); } if (hwmon_ctx->enabled == true && user_options->gpu_temp_retain > 0) { - fprintf (stdout, "Watchdog: Temperature retain trigger set to %uc" EOL, user_options->gpu_temp_retain); + event_log_info (hashcat_ctx, "Watchdog: Temperature retain trigger set to %uc", user_options->gpu_temp_retain); } else { - fprintf (stdout, "Watchdog: Temperature retain trigger disabled" EOL); + event_log_info (hashcat_ctx, "Watchdog: Temperature retain trigger disabled"); } - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, ""); #if defined (DEBUG) - if (user_options->benchmark == true) fprintf (stdout, "Hashmode: %d" EOL, hashconfig->hash_mode); + if (user_options->benchmark == true) event_log_info (hashcat_ctx, "Hashmode: %d", hashconfig->hash_mode); #endif } @@ -380,7 +380,7 @@ static void main_opencl_session_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MA if (user_options->quiet == true) return; - fprintf (stdout, "Initializing device kernels and memory: "); + event_log_info_nn (hashcat_ctx, "Initializing device kernels and memory..."); } static void main_opencl_session_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -389,7 +389,7 @@ static void main_opencl_session_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, M if (user_options->quiet == true) return; - fprintf (stdout, "Done" EOL); + event_log_info_nn (hashcat_ctx, "Initialized device kernels and memory..."); } static void main_weak_hash_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -398,7 +398,7 @@ static void main_weak_hash_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_U if (user_options->quiet == true) return; - fprintf (stdout, "Checking for weak hashes: "); + event_log_info_nn (hashcat_ctx, "Checking for weak hashes..."); } static void main_weak_hash_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -407,7 +407,7 @@ static void main_weak_hash_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_ if (user_options->quiet == true) return; - fprintf (stdout, "Done" EOL); + event_log_info_nn (hashcat_ctx, "Checked for weak hashes..."); } static void main_bitmap_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -416,7 +416,7 @@ static void main_bitmap_init_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE if (user_options->quiet == true) return; - fprintf (stdout, "Generating bitmap tables: "); + event_log_info_nn (hashcat_ctx, "Generating bitmap tables..."); } static void main_bitmap_init_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -425,7 +425,7 @@ static void main_bitmap_init_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB if (user_options->quiet == true) return; - fprintf (stdout, "Done" EOL); + event_log_info_nn (hashcat_ctx, "Generated bitmap tables..."); } static void main_set_kernel_power_final (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len) @@ -436,8 +436,8 @@ static void main_set_kernel_power_final (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx clear_prompt (); - fprintf (stdout, "INFO: approaching final keyspace, workload adjusted" EOL); - fprintf (stdout, EOL); + event_log_info (hashcat_ctx, "INFO: approaching final keyspace, workload adjusted"); + event_log_info (hashcat_ctx, ""); send_prompt (); } diff --git a/src/status.c b/src/status.c index f0c6b1a4f..5dc6217a7 100644 --- a/src/status.c +++ b/src/status.c @@ -932,7 +932,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx) if ((cpt_ctx->cpt_start + 86400) < now) { - event_log_info (hashcat_ctx, "Recovered/Time.: CUR:%u,%u,%u AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", + event_log_info (hashcat_ctx, "Recovered/Time.: CUR:%" PRIu64 ",%" PRIu64 ",%" PRIu64 " AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", cpt_cur_min, cpt_cur_hour, cpt_cur_day, @@ -942,7 +942,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx) } else if ((cpt_ctx->cpt_start + 3600) < now) { - event_log_info (hashcat_ctx, "Recovered/Time.: CUR:%u,%u,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", + event_log_info (hashcat_ctx, "Recovered/Time.: CUR:%" PRIu64 ",%" PRIu64 ",N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", cpt_cur_min, cpt_cur_hour, cpt_avg_min, @@ -951,7 +951,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx) } else if ((cpt_ctx->cpt_start + 60) < now) { - event_log_info (hashcat_ctx, "Recovered/Time.: CUR:%u,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", + event_log_info (hashcat_ctx, "Recovered/Time.: CUR:%" PRIu64 ",N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", cpt_cur_min, cpt_avg_min, cpt_avg_hour,