From 3279607a4edb21a397cea70b377b0df4517aca87 Mon Sep 17 00:00:00 2001 From: jsteube Date: Sat, 24 Sep 2016 14:00:59 +0200 Subject: [PATCH] Some better newline handling --- src/hashcat.c | 36 +++++++++++++++++++++++++----------- src/opencl.c | 12 ++++-------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/hashcat.c b/src/hashcat.c index c71cc0c55..dbc3328a7 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -221,8 +221,8 @@ static void goodbye_screen (const user_options_t *user_options, const time_t *pr if (user_options->show == true) return; if (user_options->left == true) return; - if (user_options->quiet == false) log_info_nn ("Started: %s", ctime (proc_start)); - if (user_options->quiet == false) log_info_nn ("Stopped: %s", ctime (proc_stop)); + log_info_nn ("Started: %s", ctime (proc_start)); + log_info_nn ("Stopped: %s", ctime (proc_stop)); } static int outer_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, int myargc, char **myargv, folder_config_t *folder_config, logfile_ctx_t *logfile_ctx, tuning_db_t *tuning_db, induct_ctx_t *induct_ctx, outcheck_ctx_t *outcheck_ctx, outfile_ctx_t *outfile_ctx, potfile_ctx_t *potfile_ctx, rules_ctx_t *rules_ctx, dictstat_ctx_t *dictstat_ctx, loopback_ctx_t *loopback_ctx, opencl_ctx_t *opencl_ctx) @@ -324,7 +324,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_ potfile_hash_free (potfile_ctx, hashconfig); - if (user_options->quiet == false) log_info_nn (""); + //if (user_options->quiet == false) log_info_nn (""); return 0; } @@ -640,6 +640,8 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_ log_info ("Rules: %u", rules_ctx->kernel_rules_cnt); } + if (user_options->quiet == false) log_info (""); + if (hashconfig->opti_type) { log_info ("Applicable Optimizers:"); @@ -652,6 +654,8 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_ } } + if (user_options->quiet == false) log_info (""); + /** * Watchdog and Temperature balance */ @@ -1835,8 +1839,16 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_ { if (potfile_remove_cracks > 0) { - if (potfile_remove_cracks == 1) log_info ("INFO: Removed 1 hash found in potfile\n"); - else log_info ("INFO: Removed %d hashes found in potfile\n", potfile_remove_cracks); + if (potfile_remove_cracks == 1) + { + log_info ("INFO: Removed 1 hash found in potfile"); + log_info (""); + } + else + { + log_info ("INFO: Removed %d hashes found in potfile", potfile_remove_cracks); + log_info (""); + } } } @@ -2836,10 +2848,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_ { status_benchmark (opencl_ctx, hashconfig, user_options); - if (user_options->machine_readable == false) - { - log_info (""); - } + log_info (""); } else { @@ -2847,8 +2856,6 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_ { clear_prompt (); - log_info (""); - status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra, rules_ctx); log_info (""); @@ -2858,6 +2865,8 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_ if (user_options->status == true) { status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra, rules_ctx); + + log_info (""); } } } @@ -3544,6 +3553,11 @@ int main (int argc, char **argv) local_free (outer_threads); + if (user_options->benchmark == true) + { + user_options->quiet = false; + } + // destroy others mutex hc_thread_mutex_delete (mux_display); diff --git a/src/opencl.c b/src/opencl.c index bf82e4acb..2d2e8be23 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -1380,7 +1380,6 @@ int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_option if (platforms_cnt == 0) { - log_info (""); log_info ("ATTENTION! No OpenCL compatible platform found"); log_info (""); log_info ("You're probably missing the OpenCL runtime installation"); @@ -2276,7 +2275,6 @@ int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *use if (catalyst_broken == 1) { - log_info (""); log_info ("ATTENTION! The Catalyst driver installed on your system is known to be broken!"); log_info ("It passes over cracked hashes and will not report them as cracked"); log_info ("You are STRONGLY encouraged not to use it"); @@ -2288,7 +2286,6 @@ int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *use if (catalyst_warn == 1) { - log_info (""); log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!"); log_info ("You are STRONGLY encouraged to use the official supported catalyst driver"); log_info ("See hashcat's homepage for official supported catalyst drivers"); @@ -2305,8 +2302,8 @@ int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *use { if (device_param->kernel_exec_timeout != 0) { - if (user_options->quiet == false) log_info ("- Device #%u: WARNING! Kernel exec timeout is not disabled, it might cause you errors of code 702", device_id + 1); - if (user_options->quiet == false) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch"); + log_info ("- Device #%u: WARNING! Kernel exec timeout is not disabled, it might cause you errors of code 702", device_id + 1); + log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch"); } } } @@ -2318,7 +2315,6 @@ int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *use { if (user_options->force == 0) { - log_info (""); log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable."); log_info ("You are STRONGLY encouraged not to use it"); log_info ("You can use --force to override this but do not post error reports if you do so"); @@ -2742,14 +2738,14 @@ int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconf if ((size_scrypt / 4) > device_param->device_maxmem_alloc) { - if (user_options->quiet == false) log_info ("WARNING: Not enough single-block device memory allocatable to use --scrypt-tmto %d, increasing...", tmto); + log_info ("WARNING: Not enough single-block device memory allocatable to use --scrypt-tmto %d, increasing...", tmto); continue; } if (size_scrypt > device_param->device_global_mem) { - if (user_options->quiet == false) log_info ("WARNING: Not enough total device memory allocatable to use --scrypt-tmto %d, increasing...", tmto); + log_info ("WARNING: Not enough total device memory allocatable to use --scrypt-tmto %d, increasing...", tmto); continue; }