From d6b843901b3ef94b37adff6461d70294af752300 Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 23 Feb 2017 11:59:34 +0100 Subject: [PATCH] In case of multiline error message use only the first line as error and the description as warning --- src/opencl.c | 83 ++++++++++++++++++++++++++-------------------- src/restore.c | 8 +++-- src/user_options.c | 12 ++++--- 3 files changed, 60 insertions(+), 43 deletions(-) diff --git a/src/opencl.c b/src/opencl.c index 64b428368..ec80b116d 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -92,9 +92,11 @@ static int ocl_check_dri (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx) if (fd_dri == NULL) { event_log_error (hashcat_ctx, "Can not access %s: %m", dri_card0_path); - event_log_error (hashcat_ctx, "This causes some drivers to crash when OpenCL is used!"); - event_log_error (hashcat_ctx, "Usually it's enough to add your user account to the \"video\" group to fix this problem:"); - event_log_error (hashcat_ctx, "$ sudo usermod -a -G video $LOGNAME"); + + event_log_warning (hashcat_ctx, "This causes some drivers to crash when OpenCL is used!"); + event_log_warning (hashcat_ctx, "Usually it's enough to add your user account to the \"video\" group to fix this problem:"); + event_log_warning (hashcat_ctx, "$ sudo usermod -a -G video $LOGNAME"); + event_log_warning (hashcat_ctx, NULL); return -1; } @@ -407,24 +409,26 @@ int ocl_init (hashcat_ctx_t *hashcat_ctx) if (ocl->lib == NULL) { event_log_error (hashcat_ctx, "Can not find an OpenCL ICD loader library"); - event_log_error (hashcat_ctx, NULL); - event_log_error (hashcat_ctx, "You're probably missing the OpenCL runtime and driver installation"); + + event_log_warning (hashcat_ctx, "You're probably missing the OpenCL runtime and driver installation"); + event_log_warning (hashcat_ctx, NULL); #if defined (__linux__) - event_log_error (hashcat_ctx, "* AMD users on Linux require \"AMDGPU-Pro Driver\" (16.40 or later)"); + event_log_warning (hashcat_ctx, "* AMD users on Linux require \"AMDGPU-Pro Driver\" (16.40 or later)"); #elif defined (_WIN) - event_log_error (hashcat_ctx, "* AMD users on Windows require \"AMD Radeon Software Crimson Edition\" (15.12 or later)"); + event_log_warning (hashcat_ctx, "* AMD users on Windows require \"AMD Radeon Software Crimson Edition\" (15.12 or later)"); #endif - event_log_error (hashcat_ctx, "* Intel CPU users require \"OpenCL Runtime for Intel Core and Intel Xeon Processors\" (16.1.1 or later)"); + event_log_warning (hashcat_ctx, "* Intel CPU users require \"OpenCL Runtime for Intel Core and Intel Xeon Processors\" (16.1.1 or later)"); #if defined (__linux__) - event_log_error (hashcat_ctx, "* Intel GPU on Linux users require \"OpenCL 2.0 GPU Driver Package for Linux\" (2.0 or later)"); + event_log_warning (hashcat_ctx, "* Intel GPU on Linux users require \"OpenCL 2.0 GPU Driver Package for Linux\" (2.0 or later)"); #elif defined (_WIN) - event_log_error (hashcat_ctx, "* Intel GPU on Windows users require \"OpenCL Driver for Intel Iris and Intel HD Graphics\""); + event_log_warning (hashcat_ctx, "* Intel GPU on Windows users require \"OpenCL Driver for Intel Iris and Intel HD Graphics\""); #endif - event_log_error (hashcat_ctx, "* NVidia users require \"NVIDIA Driver\" (367.x or later)"); + event_log_warning (hashcat_ctx, "* NVidia users require \"NVIDIA Driver\" (367.x or later)"); + event_log_warning (hashcat_ctx, NULL); return -1; } @@ -2247,24 +2251,26 @@ int opencl_ctx_init (hashcat_ctx_t *hashcat_ctx) if (platforms_cnt == 0) { event_log_error (hashcat_ctx, "ATTENTION! No OpenCL compatible platform found"); - event_log_error (hashcat_ctx, NULL); - event_log_error (hashcat_ctx, "You're probably missing the OpenCL runtime installation"); + + event_log_warning (hashcat_ctx, "You're probably missing the OpenCL runtime installation"); + event_log_warning (hashcat_ctx, NULL); #if defined (__linux__) - event_log_error (hashcat_ctx, "* AMD users on Linux require \"AMDGPU-Pro Driver\" (16.40 or later)"); + event_log_warning (hashcat_ctx, "* AMD users on Linux require \"AMDGPU-Pro Driver\" (16.40 or later)"); #elif defined (_WIN) - event_log_error (hashcat_ctx, "* AMD users on Windows require \"AMD Radeon Software Crimson Edition\" (15.12 or later)"); + event_log_warning (hashcat_ctx, "* AMD users on Windows require \"AMD Radeon Software Crimson Edition\" (15.12 or later)"); #endif - event_log_error (hashcat_ctx, "* Intel CPU users require \"OpenCL Runtime for Intel Core and Intel Xeon Processors\" (16.1.1 or later)"); + event_log_warning (hashcat_ctx, "* Intel CPU users require \"OpenCL Runtime for Intel Core and Intel Xeon Processors\" (16.1.1 or later)"); #if defined (__linux__) - event_log_error (hashcat_ctx, "* Intel GPU on Linux users require \"OpenCL 2.0 GPU Driver Package for Linux\" (2.0 or later)"); + event_log_warning (hashcat_ctx, "* Intel GPU on Linux users require \"OpenCL 2.0 GPU Driver Package for Linux\" (2.0 or later)"); #elif defined (_WIN) - event_log_error (hashcat_ctx, "* Intel GPU on Windows users require \"OpenCL Driver for Intel Iris and Intel HD Graphics\""); + event_log_warning (hashcat_ctx, "* Intel GPU on Windows users require \"OpenCL Driver for Intel Iris and Intel HD Graphics\""); #endif - event_log_error (hashcat_ctx, "* NVidia users require \"NVIDIA Driver\" (367.x or later)"); + event_log_warning (hashcat_ctx, "* NVidia users require \"NVIDIA Driver\" (367.x or later)"); + event_log_warning (hashcat_ctx, NULL); FREE_OPENCL_CTX_ON_ERROR; @@ -2525,6 +2531,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) event_log_warning (hashcat_ctx, "You are STRONGLY encouraged to use the driver as listed in docs/readme.txt"); event_log_warning (hashcat_ctx, "You can use --opencl-platforms to manually deselect the platform and get rid of this error"); event_log_warning (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so"); + event_log_warning (hashcat_ctx, NULL); return -1; } @@ -3057,10 +3064,11 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) if (intel_warn == true) { event_log_error (hashcat_ctx, "* Device #%u: Outdated or broken Intel OpenCL runtime detected!", device_id + 1); - event_log_error (hashcat_ctx, NULL); - event_log_error (hashcat_ctx, "You are STRONGLY encouraged to use the official supported NVIDIA driver"); - event_log_error (hashcat_ctx, "See hashcat's homepage for official supported NVIDIA drivers"); - event_log_error (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so"); + + event_log_warning (hashcat_ctx, "You are STRONGLY encouraged to use the official supported NVIDIA driver"); + event_log_warning (hashcat_ctx, "See hashcat's homepage for official supported NVIDIA drivers"); + event_log_warning (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so"); + event_log_warning (hashcat_ctx, NULL); return -1; } @@ -3090,11 +3098,12 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) if (amd_warn == true) { event_log_error (hashcat_ctx, "* Device #%u: Outdated or broken AMD driver detected!", device_id + 1); - event_log_error (hashcat_ctx, NULL); - event_log_error (hashcat_ctx, "You are STRONGLY encouraged to use the official supported AMD driver"); - event_log_error (hashcat_ctx, "See hashcat's homepage for official supported AMD drivers"); - event_log_error (hashcat_ctx, "Also see: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#i_may_have_the_wrong_driver_installed_what_should_i_do"); - event_log_error (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so"); + + event_log_warning (hashcat_ctx, "You are STRONGLY encouraged to use the official supported AMD driver"); + event_log_warning (hashcat_ctx, "See hashcat's homepage for official supported AMD drivers"); + event_log_warning (hashcat_ctx, "Also see: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#i_may_have_the_wrong_driver_installed_what_should_i_do"); + event_log_warning (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so"); + event_log_warning (hashcat_ctx, NULL); return -1; } @@ -3110,11 +3119,12 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) if (nv_warn == true) { event_log_error (hashcat_ctx, "* Device #%u: Outdated or broken NVIDIA driver detected!", device_id + 1); - event_log_error (hashcat_ctx, NULL); - event_log_error (hashcat_ctx, "You are STRONGLY encouraged to use the official supported NVIDIA driver"); - event_log_error (hashcat_ctx, "See hashcat's homepage for official supported NVIDIA drivers"); - event_log_error (hashcat_ctx, "Also see: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#i_may_have_the_wrong_driver_installed_what_should_i_do"); - event_log_error (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so"); + + event_log_warning (hashcat_ctx, "You are STRONGLY encouraged to use the official supported NVIDIA driver"); + event_log_warning (hashcat_ctx, "See hashcat's homepage for official supported NVIDIA drivers"); + event_log_warning (hashcat_ctx, "Also see: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#i_may_have_the_wrong_driver_installed_what_should_i_do"); + event_log_warning (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so"); + event_log_warning (hashcat_ctx, NULL); return -1; } @@ -3135,9 +3145,10 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime) if ((strstr (device_param->device_opencl_version, "beignet")) || (strstr (device_param->device_version, "beignet"))) { event_log_error (hashcat_ctx, "* Device #%u: Intel beignet driver detected!", device_id + 1); - event_log_error (hashcat_ctx, NULL); - event_log_error (hashcat_ctx, "The beignet driver has been marked as half-baked and likely to fail kernel compilation"); - event_log_error (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so"); + + event_log_warning (hashcat_ctx, "The beignet driver has been marked as half-baked and likely to fail kernel compilation"); + event_log_warning (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so"); + event_log_warning (hashcat_ctx, NULL); return -1; } diff --git a/src/restore.c b/src/restore.c index a04855705..66af3a75c 100644 --- a/src/restore.c +++ b/src/restore.c @@ -137,9 +137,11 @@ static int read_restore (hashcat_ctx_t *hashcat_ctx) if (chdir (rd->cwd)) { event_log_error (hashcat_ctx, "The directory '%s' does not exist. It is needed to restore (--restore) the session.", rd->cwd); - event_log_error (hashcat_ctx, "You could either create this directory or update the .restore file using e.g. the analyze_hc_restore.pl tool:"); - event_log_error (hashcat_ctx, "https://github.com/philsmd/analyze_hc_restore"); - event_log_error (hashcat_ctx, "The directory must contain all files and folders mentioned within the command line."); + + event_log_warning (hashcat_ctx, "You could either create this directory or update the .restore file using e.g. the analyze_hc_restore.pl tool:"); + event_log_warning (hashcat_ctx, "https://github.com/philsmd/analyze_hc_restore"); + event_log_warning (hashcat_ctx, "The directory must contain all files and folders mentioned within the command line."); + event_log_warning (hashcat_ctx, NULL); return -1; } diff --git a/src/user_options.c b/src/user_options.c index ec033e569..baf982565 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -546,8 +546,10 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) if (user_options->force == false) { event_log_error (hashcat_ctx, "The manual use of the -n option (or --kernel-accel) is outdated."); - event_log_error (hashcat_ctx, "Please consider using the -w option instead."); - event_log_error (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so."); + + event_log_warning (hashcat_ctx, "Please consider using the -w option instead."); + event_log_warning (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so."); + event_log_warning (hashcat_ctx, NULL); return -1; } @@ -572,8 +574,10 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) if (user_options->force == false) { event_log_error (hashcat_ctx, "The manual use of the -u option (or --kernel-loops) is outdated."); - event_log_error (hashcat_ctx, "Please consider using the -w option instead."); - event_log_error (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so."); + + event_log_warning (hashcat_ctx, "Please consider using the -w option instead."); + event_log_warning (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so."); + event_log_warning (hashcat_ctx, NULL); return -1; }