mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-22 05:31:11 +00:00
Commandline: Throw an error if separator character given by the user with -p option is not exactly 1 byte
This commit is contained in:
parent
5024865d87
commit
f9e74045b5
@ -28,6 +28,7 @@
|
||||
## Technical
|
||||
##
|
||||
|
||||
- Commandline: Throw an error if separator character given by the user with -p option is not exactly 1 byte
|
||||
- Kernel Cache: Add kernel threads into hash computation which is later used in the kernel cache filename
|
||||
- HIP Kernels: Got rid of hip/hip_runtime.h dependancy to enable more easy integration of the HIP backend on Windows
|
||||
- SCRYPT Kernels: Add more optimized values for some new NV/AMD GPUs
|
||||
|
@ -671,7 +671,6 @@ typedef enum user_options_defaults
|
||||
SCRYPT_TMTO = 0,
|
||||
SEGMENT_SIZE = 33554432,
|
||||
SELF_TEST_DISABLE = false,
|
||||
SEPARATOR = ':',
|
||||
SHOW = false,
|
||||
SKIP = 0,
|
||||
SLOW_CANDIDATES = false,
|
||||
@ -2105,6 +2104,7 @@ typedef struct user_options
|
||||
bool skip_chgd;
|
||||
bool limit_chgd;
|
||||
bool scrypt_tmto_chgd;
|
||||
bool separator_chgd;
|
||||
|
||||
bool advice_disable;
|
||||
bool benchmark;
|
||||
@ -2174,7 +2174,7 @@ typedef struct user_options
|
||||
char *potfile_path;
|
||||
char *restore_file_path;
|
||||
char **rp_files;
|
||||
char separator;
|
||||
char *separator;
|
||||
char *truecrypt_keyfiles;
|
||||
char *veracrypt_keyfiles;
|
||||
const char *custom_charset_1;
|
||||
@ -2240,6 +2240,8 @@ typedef struct user_options_extra
|
||||
|
||||
u32 wordlist_mode;
|
||||
|
||||
char separator;
|
||||
|
||||
char *hc_hash; // can be filename or string
|
||||
|
||||
int hc_workc; // can be 0 in bf-mode = default mask
|
||||
|
@ -1977,7 +1977,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
memcpy (hashconfig_st, hashconfig, sizeof (hashconfig_t));
|
||||
|
||||
hashconfig_st->separator = SEPARATOR;
|
||||
hashconfig_st->separator = ':';
|
||||
|
||||
if (user_options->hex_salt)
|
||||
{
|
||||
|
@ -621,7 +621,7 @@ u64 default_hook_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED
|
||||
|
||||
char default_separator (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||
{
|
||||
return user_options->separator;
|
||||
return user_options_extra->separator;
|
||||
}
|
||||
|
||||
bool default_dictstat_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)
|
||||
|
@ -623,7 +623,7 @@ void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginn
|
||||
*ptr1 = 0;
|
||||
}
|
||||
|
||||
void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_t *user_options)
|
||||
void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *user_options_extra)
|
||||
{
|
||||
if (hashconfig_init (hashcat_ctx) == 0)
|
||||
{
|
||||
@ -676,7 +676,7 @@ void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_t *user_options)
|
||||
event_log_info (hashcat_ctx, " Example.Hash........: %s", hashconfig->st_hash);
|
||||
}
|
||||
|
||||
if (need_hexify ((const u8 *) hashconfig->st_pass, strlen (hashconfig->st_pass), user_options->separator, false))
|
||||
if (need_hexify ((const u8 *) hashconfig->st_pass, strlen (hashconfig->st_pass), user_options_extra->separator, false))
|
||||
{
|
||||
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
@ -730,6 +730,7 @@ void hash_info (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
folder_config_t *folder_config = hashcat_ctx->folder_config;
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||
|
||||
event_log_info (hashcat_ctx, "Hash Info:");
|
||||
event_log_info (hashcat_ctx, "==========");
|
||||
@ -737,7 +738,7 @@ void hash_info (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (user_options->hash_mode_chgd == true)
|
||||
{
|
||||
hash_info_single (hashcat_ctx, user_options);
|
||||
hash_info_single (hashcat_ctx, user_options_extra);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -751,7 +752,7 @@ void hash_info (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (hc_path_exist (modulefile) == false) continue;
|
||||
|
||||
hash_info_single (hashcat_ctx, user_options);
|
||||
hash_info_single (hashcat_ctx, user_options_extra);
|
||||
}
|
||||
|
||||
hcfree (modulefile);
|
||||
|
@ -25,6 +25,8 @@ static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4
|
||||
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMS";
|
||||
#endif
|
||||
|
||||
static char *SEPARATOR = ":";
|
||||
|
||||
static const struct option long_options[] =
|
||||
{
|
||||
{"advice-disable", no_argument, NULL, IDX_ADVICE_DISABLE},
|
||||
@ -482,7 +484,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
user_options->segment_size_chgd = true; break;
|
||||
case IDX_SCRYPT_TMTO: user_options->scrypt_tmto = hc_strtoul (optarg, NULL, 10);
|
||||
user_options->scrypt_tmto_chgd = true; break;
|
||||
case IDX_SEPARATOR: user_options->separator = optarg[0]; break;
|
||||
case IDX_SEPARATOR: user_options->separator = optarg;
|
||||
user_options->separator_chgd = true; break;
|
||||
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;
|
||||
@ -583,6 +586,16 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (user_options->separator_chgd == true)
|
||||
{
|
||||
if (strlen (user_options->separator) != 1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Separator length has to be exactly 1 byte.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->slow_candidates == true)
|
||||
{
|
||||
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
||||
@ -2085,6 +2098,13 @@ void user_options_extra_init (hashcat_ctx_t *hashcat_ctx)
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||
|
||||
// separator
|
||||
|
||||
if (user_options->separator)
|
||||
{
|
||||
user_options_extra->separator = user_options->separator[0];
|
||||
}
|
||||
|
||||
// attack-kern
|
||||
|
||||
user_options_extra->attack_kern = ATTACK_KERN_NONE;
|
||||
@ -3027,7 +3047,6 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
|
||||
|
||||
logfile_top_char (user_options->separator);
|
||||
#ifdef WITH_BRAIN
|
||||
logfile_top_string (user_options->brain_session_whitelist);
|
||||
#endif
|
||||
@ -3052,6 +3071,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
|
||||
logfile_top_string (user_options->rule_buf_l);
|
||||
logfile_top_string (user_options->rule_buf_r);
|
||||
logfile_top_string (user_options->session);
|
||||
logfile_top_string (user_options->separator);
|
||||
logfile_top_string (user_options->truecrypt_keyfiles);
|
||||
logfile_top_string (user_options->veracrypt_keyfiles);
|
||||
#ifdef WITH_BRAIN
|
||||
|
Loading…
Reference in New Issue
Block a user