mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-13 19:28:56 +00:00
Allow modules to change value from user_options->hash_mode to something different in hashconfig->hash_mode. This will be required for modes that can automatically select the right hash_mode for the user for instance LUKS
This commit is contained in:
parent
f6ea21449b
commit
c3630b2f18
@ -57,7 +57,7 @@ u32 brain_compute_session (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (user_options->brain_session != 0) return user_options->brain_session;
|
||||
|
||||
const u64 seed = (const u64) user_options->hash_mode;
|
||||
const u64 seed = (const u64) hashconfig->hash_mode;
|
||||
|
||||
XXH64_state_t *state = XXH64_createState ();
|
||||
|
||||
@ -156,7 +156,7 @@ u32 brain_compute_attack (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
XXH64_reset (state, user_options->brain_session);
|
||||
|
||||
const int hash_mode = user_options->hash_mode;
|
||||
const int hash_mode = hashconfig->hash_mode;
|
||||
const int attack_mode = user_options->attack_mode;
|
||||
|
||||
XXH64_update (state, &hash_mode, sizeof (hash_mode));
|
||||
|
@ -463,7 +463,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (rc_hashconfig == -1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Unknown hash-type '%u' selected.", user_options->hash_mode);
|
||||
event_log_error (hashcat_ctx, "Invalid hash-mode '%u' selected.", user_options->hash_mode);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -27974,17 +27974,17 @@ bool default_hlfmt_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_U
|
||||
u32 default_forced_outfile_format
|
||||
{
|
||||
|
||||
if (user_options->hash_mode == 9710)
|
||||
if (hashconfig->hash_mode == 9710)
|
||||
{
|
||||
user_options->outfile_format = 5;
|
||||
}
|
||||
|
||||
if (user_options->hash_mode == 9810)
|
||||
if (hashconfig->hash_mode == 9810)
|
||||
{
|
||||
user_options->outfile_format = 5;
|
||||
}
|
||||
|
||||
if (user_options->hash_mode == 10410)
|
||||
if (hashconfig->hash_mode == 10410)
|
||||
{
|
||||
user_options->outfile_format = 5;
|
||||
}
|
||||
@ -28166,11 +28166,11 @@ bool outfile_check_disable
|
||||
{
|
||||
|
||||
|
||||
if ((user_options->hash_mode == 5200) ||
|
||||
((user_options->hash_mode >= 6200) && (user_options->hash_mode <= 6299)) ||
|
||||
(user_options->hash_mode == 9000) ||
|
||||
((user_options->hash_mode >= 13700) && (user_options->hash_mode <= 13799)) ||
|
||||
(user_options->hash_mode == 14600)) return 0;
|
||||
if ((hashconfig->hash_mode == 5200) ||
|
||||
((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299)) ||
|
||||
(hashconfig->hash_mode == 9000) ||
|
||||
((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode <= 13799)) ||
|
||||
(hashconfig->hash_mode == 14600)) return 0;
|
||||
}
|
||||
|
||||
bool potfile_disable
|
||||
@ -28319,7 +28319,7 @@ bool potfile_keep_all_hashes
|
||||
{
|
||||
// keep all hashes if -m 3000 was combined with --left or --show
|
||||
|
||||
if (user_options->hash_mode == 3000)
|
||||
if (hashconfig->hash_mode == 3000)
|
||||
{
|
||||
if ((user_options->show == true) || (user_options->left == true))
|
||||
{
|
||||
@ -28708,16 +28708,16 @@ bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
* 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))
|
||||
if ((hashconfig->hash_mode == 1500)
|
||||
|| (hashconfig->hash_mode == 3000)
|
||||
|| (hashconfig->hash_mode == 3200)
|
||||
|| (hashconfig->hash_mode == 8900)
|
||||
|| (hashconfig->hash_mode == 9300)
|
||||
|| (hashconfig->hash_mode == 9800)
|
||||
|| (hashconfig->hash_mode == 12500)
|
||||
|| (hashconfig->hash_mode == 14000)
|
||||
|| (hashconfig->hash_mode == 14100)
|
||||
|| (hashconfig->hash_mode == 15700))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -29006,7 +29006,7 @@ int module_hash_binary_parse ()
|
||||
{
|
||||
memset (hashes_buf[hashes_cnt].esalt, 0, hashconfig->esalt_size);
|
||||
|
||||
if ((user_options->hash_mode == 2500) || (user_options->hash_mode == 2501))
|
||||
if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501))
|
||||
{
|
||||
wpa_eapol_t *wpa_eapol = (wpa_eapol_t *) hashes_buf[hashes_cnt].esalt;
|
||||
|
||||
|
@ -4369,7 +4369,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
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, "* Device #%u: Skipping unstable hash-mode %u for this device.", device_id + 1, hashconfig->hash_mode);
|
||||
event_log_warning (hashcat_ctx, " You can use --force to override, but do not report related errors.");
|
||||
|
||||
device_param->skipped = true;
|
||||
@ -4852,10 +4852,10 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
char *device_name_chksum_amp_mp = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
|
||||
#if defined (__x86_64__)
|
||||
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, user_options->hash_mode);
|
||||
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 64, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, hashconfig->hash_mode);
|
||||
const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%u-%s-%s-%s-%d", 64, device_param->platform_vendor_id, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime);
|
||||
#else
|
||||
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, user_options->hash_mode);
|
||||
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%u-%u-%s-%s-%s-%d-%u-%u", 32, device_param->platform_vendor_id, device_param->vector_width, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime, user_options->opencl_vector_width, hashconfig->hash_modes);
|
||||
const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%u-%s-%s-%s-%d", 32, device_param->platform_vendor_id, device_param->device_name, device_param->device_version, device_param->driver_version, opencl_ctx->comptime);
|
||||
#endif
|
||||
|
||||
|
@ -289,7 +289,7 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (rc == 0)
|
||||
{
|
||||
usage_sort_buf[usage_sort_cnt].hash_mode = i;
|
||||
usage_sort_buf[usage_sort_cnt].hash_mode = hashconfig->hash_mode;
|
||||
usage_sort_buf[usage_sort_cnt].hash_name = hcstrdup (hashconfig->hash_name);
|
||||
usage_sort_buf[usage_sort_cnt].hash_category = hashconfig->hash_category;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user