1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 15:18:16 +00:00

Add some hint about performance for new users

This commit is contained in:
jsteube 2016-11-21 18:30:36 +01:00
parent ac340a2ec1
commit 7ca6a45781
4 changed files with 116 additions and 15 deletions

View File

@ -111,6 +111,7 @@ typedef enum event_identifier
EVENT_MONITOR_THROTTLE1 = 0x00000083,
EVENT_MONITOR_THROTTLE2 = 0x00000084,
EVENT_MONITOR_THROTTLE3 = 0x00000085,
EVENT_MONITOR_PERFORMANCE_HINT = 0x00000086,
EVENT_OPENCL_SESSION_POST = 0x00000090,
EVENT_OPENCL_SESSION_PRE = 0x00000091,
EVENT_OUTERLOOP_FINISHED = 0x000000a0,

View File

@ -593,6 +593,41 @@ static void main_monitor_throttle3 (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY
}
}
static void main_monitor_performance_hint (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;
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
if (user_options->quiet == true) return;
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{
clear_prompt ();
}
if (user_options->workload_profile < 3)
{
event_log_warning (hashcat_ctx, "Cracking performance lower than expected? Append -w 3 to the commandline!");
event_log_warning (hashcat_ctx, "");
}
else
{
event_log_warning (hashcat_ctx, "Cracking performance lower than expected?");
event_log_warning (hashcat_ctx, "");
event_log_warning (hashcat_ctx, "* Update your OpenCL runtime / Driver but the right way:");
event_log_warning (hashcat_ctx, " 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, "");
event_log_warning (hashcat_ctx, "* Create more work items to make use of your parallelization power:");
event_log_warning (hashcat_ctx, " https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
event_log_warning (hashcat_ctx, "");
}
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{
send_prompt ();
}
}
static void main_monitor_temp_abort (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;
@ -810,6 +845,7 @@ static void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, co
case EVENT_MONITOR_THROTTLE1: main_monitor_throttle1 (hashcat_ctx, buf, len); break;
case EVENT_MONITOR_THROTTLE2: main_monitor_throttle2 (hashcat_ctx, buf, len); break;
case EVENT_MONITOR_THROTTLE3: main_monitor_throttle3 (hashcat_ctx, buf, len); break;
case EVENT_MONITOR_PERFORMANCE_HINT: main_monitor_performance_hint (hashcat_ctx, buf, len); break;
case EVENT_OPENCL_SESSION_POST: main_opencl_session_post (hashcat_ctx, buf, len); break;
case EVENT_OPENCL_SESSION_PRE: main_opencl_session_pre (hashcat_ctx, buf, len); break;
case EVENT_OUTERLOOP_FINISHED: main_outerloop_finished (hashcat_ctx, buf, len); break;

View File

@ -13,6 +13,7 @@
#include "thread.h"
#include "restore.h"
#include "shared.h"
#include "status.h"
#include "monitor.h"
int get_runtime_left (const hashcat_ctx_t *hashcat_ctx)
@ -51,16 +52,19 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
bool runtime_check = false;
bool remove_check = false;
bool status_check = false;
bool restore_check = false;
bool hwmon_check = false;
bool runtime_check = false;
bool remove_check = false;
bool status_check = false;
bool restore_check = false;
bool hwmon_check = false;
bool performance_check = false;
const int sleep_time = 1;
const int temp_threshold = 1; // degrees celcius
const int fan_speed_min = 15; // in percentage
const int fan_speed_max = 100;
const int sleep_time = 1;
const int temp_threshold = 1; // degrees celcius
const int fan_speed_min = 20; // in percentage
const int fan_speed_max = 100;
const float exec_low = 50.0f; // in ms
const float util_low = 90.0f; // in percent
if (user_options->runtime)
{
@ -87,7 +91,12 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
hwmon_check = true;
}
if ((runtime_check == false) && (remove_check == false) && (status_check == false) && (restore_check == false) && (hwmon_check == false))
if (hwmon_ctx->enabled == true)
{
performance_check = true; // this check simply requires hwmon to work
}
if ((runtime_check == false) && (remove_check == false) && (status_check == false) && (restore_check == false) && (hwmon_check == false) && (performance_check == false))
{
return 0;
}
@ -105,11 +114,12 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
time (&last_temp_check_time);
u32 slowdown_warnings = 0;
u32 slowdown_warnings = 0;
u32 performance_warnings = 0;
u32 restore_left = user_options->restore_timer;
u32 remove_left = user_options->remove_timer;
u32 status_left = user_options->status_timer;
u32 restore_left = user_options->restore_timer;
u32 remove_left = user_options->remove_timer;
u32 status_left = user_options->status_timer;
while (status_ctx->shutdown_inner == false)
{
@ -319,6 +329,60 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
status_left = user_options->status_timer;
}
}
if (performance_check == true)
{
int exec_cnt = 0;
int util_cnt = 0;
double exec_total = 0;
double util_total = 0;
hc_thread_mutex_lock (status_ctx->mux_hwmon);
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
if (device_param->skipped == true) continue;
exec_cnt++;
const double exec = status_get_exec_msec_dev (hashcat_ctx, device_id);
exec_total += exec;
const int util = hm_get_utilization_with_device_id (hashcat_ctx, device_id);
if (util == -1) continue;
util_total += (double) util;
util_cnt++;
}
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
double exec_avg = 0;
double util_avg = 0;
if (exec_cnt > 0) exec_avg = exec_total / exec_cnt;
if (util_cnt > 0) util_avg = util_total / util_cnt;
if ((exec_avg > 0) && (exec_avg < exec_low))
{
performance_warnings++;
if (performance_warnings == 10) EVENT_DATA (EVENT_MONITOR_PERFORMANCE_HINT, NULL, 0);
}
if ((util_avg > 0) && (util_avg < util_low))
{
performance_warnings++;
if (performance_warnings == 10) EVENT_DATA (EVENT_MONITOR_PERFORMANCE_HINT, NULL, 0);
}
}
}
// final round of save_hash

View File

@ -1637,7 +1637,7 @@ char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_i
}
else
{
output_len = snprintf (output_buf, HCBUFSIZ_TINY - 1, "*ERROR*");
output_len = snprintf (output_buf, HCBUFSIZ_TINY - 1, "N/A");
}
hc_thread_mutex_unlock (status_ctx->mux_hwmon);