mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-22 06:28:16 +00:00
Fix conflict and clean up code
This commit is contained in:
parent
1b2d71b8a2
commit
088f4a804b
@ -850,7 +850,7 @@ typedef enum user_options_map
|
||||
IDX_HOOK_THREADS = 0xff1f,
|
||||
IDX_IDENTIFY = 0xff20,
|
||||
IDX_INCREMENT = 'i',
|
||||
IDX_INCREMENT_INVERSE = 0xff56,
|
||||
IDX_INCREMENT_INVERSE = 0xff61,
|
||||
IDX_INCREMENT_MAX = 0xff21,
|
||||
IDX_INCREMENT_MIN = 0xff22,
|
||||
IDX_INDUCTION_DIR = 0xff23,
|
||||
@ -964,9 +964,9 @@ typedef void * hc_dynfunc_t;
|
||||
#endif
|
||||
|
||||
typedef enum increment {
|
||||
INCREMENT_NONE,
|
||||
INCREMENT_NORMAL,
|
||||
INCREMENT_INVERSED,
|
||||
INCREMENT_NONE = 0,
|
||||
INCREMENT_NORMAL = 1,
|
||||
INCREMENT_INVERSED = 2,
|
||||
} increment_t;
|
||||
|
||||
/**
|
||||
|
@ -571,7 +571,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
case IDX_BITMAP_MIN: user_options->bitmap_min = hc_strtoul (optarg, NULL, 10); break;
|
||||
case IDX_BITMAP_MAX: user_options->bitmap_max = hc_strtoul (optarg, NULL, 10); break;
|
||||
case IDX_HOOK_THREADS: user_options->hook_threads = hc_strtoul (optarg, NULL, 10); break;
|
||||
case IDX_INCREMENT: increment_parse(hashcat_ctx); break;
|
||||
case IDX_INCREMENT: user_options->increment++; break;
|
||||
case IDX_INCREMENT_INVERSE: user_options->increment = INCREMENT_INVERSED; break;
|
||||
case IDX_INCREMENT_MIN: user_options->increment_min = hc_strtoul (optarg, NULL, 10);
|
||||
user_options->increment_min_chgd = true; break;
|
||||
@ -989,6 +989,14 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// In case the user uses -iii, escaping enum bounds
|
||||
if (user_options->increment > INCREMENT_INVERSED)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Invalid -i/--increment value.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((user_options->rp_files_cnt > 0) && (user_options->rp_gen > 0))
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Combining -r/--rules-file and -g/--rules-generate is not supported.");
|
||||
@ -3387,21 +3395,6 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void increment_parse (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
// Set increment inverse when -ii
|
||||
if (user_options->increment == INCREMENT_NORMAL)
|
||||
{
|
||||
user_options->increment = INCREMENT_INVERSED;
|
||||
}
|
||||
else
|
||||
{
|
||||
user_options->increment = INCREMENT_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
void user_options_logger (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
Loading…
Reference in New Issue
Block a user