mirror of
https://github.com/hashcat/hashcat
synced 2025-02-14 15:24:28 +01:00
Add hook for unstable_warning
This commit is contained in:
parent
5633d6808f
commit
e17c3a54d8
@ -311,6 +311,7 @@ char default_separator (MAYBE_UNUSED const hashconfig_t *ha
|
||||
const char *default_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
const char *default_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
u64 default_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
bool default_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
bool default_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
|
||||
#endif // _INTERFACE_H
|
||||
|
@ -42,6 +42,7 @@ char module_separator (MAYBE_UNUSED const hashconfig_t *ha
|
||||
const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
bool module_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra);
|
||||
|
||||
int module_hash_decode_outfile (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, const char *line_buf, MAYBE_UNUSED const int line_len);
|
||||
|
@ -960,6 +960,7 @@ struct hashconfig
|
||||
bool dictstat_disable;
|
||||
bool hlfmt_disable;
|
||||
bool warmup_disable;
|
||||
bool unstable_warning;
|
||||
bool outfile_check_disable;
|
||||
bool outfile_check_nocomp;
|
||||
bool potfile_disable;
|
||||
@ -1049,7 +1050,7 @@ typedef struct hc_device_param
|
||||
u32 platform_devices_id; // for mapping with hms devices
|
||||
|
||||
bool skipped;
|
||||
bool skipped_temp;
|
||||
bool unstable_warning;
|
||||
|
||||
st_status_t st_status;
|
||||
|
||||
@ -2279,6 +2280,7 @@ typedef struct module_ctx
|
||||
const char *(*module_st_hash) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||
const char *(*module_st_pass) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||
u64 (*module_tmp_size) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||
bool (*module_unstable_warning) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||
bool (*module_warmup_disable) (const hashconfig_t *, const user_options_t *, const user_options_extra_t *);
|
||||
|
||||
int (*module_hash_decode_outfile) (const hashconfig_t *, void *, salt_t *, void *, const char *, const int);
|
||||
|
@ -696,6 +696,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
hashconfig->st_hash = default_st_hash (hashconfig, user_options, user_options_extra);
|
||||
hashconfig->st_pass = default_st_pass (hashconfig, user_options, user_options_extra);
|
||||
hashconfig->tmp_size = default_tmp_size (hashconfig, user_options, user_options_extra);
|
||||
hashconfig->unstable_warning = default_unstable_warning (hashconfig, user_options, user_options_extra);
|
||||
hashconfig->warmup_disable = default_warmup_disable (hashconfig, user_options, user_options_extra);
|
||||
|
||||
// finally, the real stuff
|
||||
@ -743,6 +744,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
|
||||
if (module_ctx->module_st_hash) hashconfig->st_hash = module_ctx->module_st_hash (hashconfig, user_options, user_options_extra);
|
||||
if (module_ctx->module_st_pass) hashconfig->st_pass = module_ctx->module_st_pass (hashconfig, user_options, user_options_extra);
|
||||
if (module_ctx->module_tmp_size) hashconfig->tmp_size = module_ctx->module_tmp_size (hashconfig, user_options, user_options_extra);
|
||||
if (module_ctx->module_unstable_warning) hashconfig->unstable_warning = module_ctx->module_unstable_warning (hashconfig, user_options, user_options_extra);
|
||||
if (module_ctx->module_warmup_disable) hashconfig->warmup_disable = module_ctx->module_warmup_disable (hashconfig, user_options, user_options_extra);
|
||||
|
||||
if (user_options->keyboard_layout_mapping)
|
||||
@ -1425,6 +1427,16 @@ bool default_potfile_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
return potfile_disable;
|
||||
}
|
||||
|
||||
|
||||
bool default_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||
{
|
||||
const bool unstable_warning = false;
|
||||
|
||||
return unstable_warning;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// migrate
|
||||
|
||||
void to_hccapx_t (hashcat_ctx_t *hashcat_ctx, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos)
|
||||
|
@ -28891,3 +28891,32 @@ char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAY
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||
{
|
||||
|
||||
#if defined (__APPLE__)
|
||||
|
||||
/**
|
||||
* If '--force' is not set, we proceed to excluding unstable hash-modes,
|
||||
* too high kernel runtime, even on -u1 -n1, therefore likely to run into trap 6
|
||||
*/
|
||||
|
||||
if ((user_options->hash_mode == 1500)
|
||||
|| (user_options->hash_mode == 3000)
|
||||
|| (user_options->hash_mode == 3200)
|
||||
|| (user_options->hash_mode == 8900)
|
||||
|| (user_options->hash_mode == 9300)
|
||||
|| (user_options->hash_mode == 9800)
|
||||
|| (user_options->hash_mode == 12500)
|
||||
|| (user_options->hash_mode == 14000)
|
||||
|| (user_options->hash_mode == 14100)
|
||||
|| (user_options->hash_mode == 15700))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
return false;
|
||||
}
|
||||
|
52
src/opencl.c
52
src/opencl.c
@ -4329,39 +4329,16 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
EVENT_DATA (EVENT_OPENCL_DEVICE_INIT_PRE, &device_id, sizeof (u32));
|
||||
|
||||
bool skipped_temp = false;
|
||||
const bool unstable_warning = hashconfig->unstable_warning;
|
||||
|
||||
#if defined (__APPLE__)
|
||||
|
||||
/**
|
||||
* If '--force' is not set, we proceed to excluding unstable hash-modes,
|
||||
* too high kernel runtime, even on -u1 -n1, therefore likely to run into trap 6
|
||||
*/
|
||||
|
||||
if ((user_options->hash_mode == 1500)
|
||||
|| (user_options->hash_mode == 3000)
|
||||
|| (user_options->hash_mode == 3200)
|
||||
|| (user_options->hash_mode == 8900)
|
||||
|| (user_options->hash_mode == 9300)
|
||||
|| (user_options->hash_mode == 9800)
|
||||
|| (user_options->hash_mode == 12500)
|
||||
|| (user_options->hash_mode == 14000)
|
||||
|| (user_options->hash_mode == 14100)
|
||||
|| (user_options->hash_mode == 15700))
|
||||
{
|
||||
skipped_temp = true;
|
||||
}
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
if ((skipped_temp == true) && (user_options->force == false))
|
||||
if ((unstable_warning == true) && (user_options->force == false))
|
||||
{
|
||||
event_log_warning (hashcat_ctx, "* Device #%u: Skipping unstable hash-mode %u for this device.", device_id + 1, user_options->hash_mode);
|
||||
event_log_warning (hashcat_ctx, " You can use --force to override, but do not report related errors.");
|
||||
|
||||
device_param->skipped = true;
|
||||
|
||||
device_param->skipped_temp = true;
|
||||
device_param->unstable_warning = true;
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -4983,18 +4960,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (CL_rc == -1) return -1;
|
||||
|
||||
char *jit_build_options = module_ctx->module_jit_build_options (hashconfig, user_options, user_options_extra, hashes, device_param);
|
||||
|
||||
char *build_opts_update;
|
||||
|
||||
if (module_ctx->module_jit_build_options)
|
||||
{
|
||||
char *jit_build_options = module_ctx->module_jit_build_options (hashconfig, user_options, user_options_extra, hashes, device_param);
|
||||
|
||||
hc_asprintf (&build_opts_update, "%s %s", build_opts, jit_build_options);
|
||||
}
|
||||
else
|
||||
{
|
||||
hc_asprintf (&build_opts_update, "%s", build_opts);
|
||||
}
|
||||
hc_asprintf (&build_opts_update, "%s %s", build_opts, jit_build_options);
|
||||
|
||||
CL_rc = hc_clBuildProgram (hashcat_ctx, device_param->program, 1, &device_param->device, build_opts_update, NULL, NULL);
|
||||
|
||||
@ -6689,16 +6659,16 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// Prevent exit from benchmark mode if all devices are skipped due to unstable hash-modes (macOS)
|
||||
|
||||
bool has_skipped_temp = false;
|
||||
bool has_unstable_warning = false;
|
||||
|
||||
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_temp == true) has_skipped_temp = true;
|
||||
if (device_param->unstable_warning == true) has_unstable_warning = true;
|
||||
}
|
||||
|
||||
if ((hardware_power_all == 0) && (has_skipped_temp == false)) return -1;
|
||||
if ((hardware_power_all == 0) && (has_unstable_warning == false)) return -1;
|
||||
|
||||
opencl_ctx->hardware_power_all = hardware_power_all;
|
||||
|
||||
@ -6715,9 +6685,9 @@ void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
|
||||
|
||||
if (device_param->skipped_temp == true)
|
||||
if (device_param->unstable_warning == true)
|
||||
{
|
||||
device_param->skipped_temp = false;
|
||||
device_param->unstable_warning = false;
|
||||
|
||||
device_param->skipped = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user