mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-28 19:08:19 +00:00
New option to set number of words in the wordlist
This commit is contained in:
parent
328a2064a1
commit
c5f8ce3722
@ -717,6 +717,7 @@ typedef enum user_options_defaults
|
|||||||
VERACRYPT_PIM_START = 485,
|
VERACRYPT_PIM_START = 485,
|
||||||
VERACRYPT_PIM_STOP = 485,
|
VERACRYPT_PIM_STOP = 485,
|
||||||
WORDLIST_AUTOHEX_DISABLE = false,
|
WORDLIST_AUTOHEX_DISABLE = false,
|
||||||
|
WORDLIST_COUNT = 0,
|
||||||
WORKLOAD_PROFILE = 2,
|
WORKLOAD_PROFILE = 2,
|
||||||
|
|
||||||
} user_options_defaults_t;
|
} user_options_defaults_t;
|
||||||
@ -841,6 +842,7 @@ typedef enum user_options_map
|
|||||||
IDX_VERSION_LOWER = 'v',
|
IDX_VERSION_LOWER = 'v',
|
||||||
IDX_VERSION = 'V',
|
IDX_VERSION = 'V',
|
||||||
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff53,
|
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff53,
|
||||||
|
IDX_WORDLIST_COUNT = 0xff54,
|
||||||
IDX_WORKLOAD_PROFILE = 'w',
|
IDX_WORKLOAD_PROFILE = 'w',
|
||||||
|
|
||||||
} user_options_map_t;
|
} user_options_map_t;
|
||||||
@ -2354,6 +2356,7 @@ typedef struct user_options
|
|||||||
bool remove;
|
bool remove;
|
||||||
bool restore;
|
bool restore;
|
||||||
bool restore_disable;
|
bool restore_disable;
|
||||||
|
bool rule_buf_l_chgd;
|
||||||
bool self_test_disable;
|
bool self_test_disable;
|
||||||
bool show;
|
bool show;
|
||||||
bool slow_candidates;
|
bool slow_candidates;
|
||||||
@ -2365,6 +2368,7 @@ typedef struct user_options
|
|||||||
bool username;
|
bool username;
|
||||||
bool veracrypt_pim_start_chgd;
|
bool veracrypt_pim_start_chgd;
|
||||||
bool veracrypt_pim_stop_chgd;
|
bool veracrypt_pim_stop_chgd;
|
||||||
|
bool wordlist_count_chgd;
|
||||||
bool version;
|
bool version;
|
||||||
bool wordlist_autohex_disable;
|
bool wordlist_autohex_disable;
|
||||||
#ifdef WITH_BRAIN
|
#ifdef WITH_BRAIN
|
||||||
@ -2441,6 +2445,7 @@ typedef struct user_options
|
|||||||
u32 usage;
|
u32 usage;
|
||||||
u32 veracrypt_pim_start;
|
u32 veracrypt_pim_start;
|
||||||
u32 veracrypt_pim_stop;
|
u32 veracrypt_pim_stop;
|
||||||
|
u64 wordlist_count;
|
||||||
u32 workload_profile;
|
u32 workload_profile;
|
||||||
u64 limit;
|
u64 limit;
|
||||||
u64 skip;
|
u64 skip;
|
||||||
|
@ -1069,7 +1069,9 @@ time_t status_get_sec_etc (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
time_t sec_etc = 0;
|
time_t sec_etc = 0;
|
||||||
|
|
||||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) ||
|
||||||
|
(user_options_extra->wordlist_mode == WL_MODE_STDIN) ||
|
||||||
|
(user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||||
{
|
{
|
||||||
if (status_ctx->devices_status != STATUS_CRACKED)
|
if (status_ctx->devices_status != STATUS_CRACKED)
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "rp.h"
|
#include "rp.h"
|
||||||
#include "wordlist.h"
|
#include "wordlist.h"
|
||||||
#include "straight.h"
|
#include "straight.h"
|
||||||
|
#include "user_options.h"
|
||||||
|
|
||||||
static int straight_ctx_add_wl (hashcat_ctx_t *hashcat_ctx, const char *dict)
|
static int straight_ctx_add_wl (hashcat_ctx_t *hashcat_ctx, const char *dict)
|
||||||
{
|
{
|
||||||
@ -80,7 +81,15 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int rc = count_words (hashcat_ctx, &fp, straight_ctx->dict, &status_ctx->words_cnt);
|
int rc = 0;
|
||||||
|
if (user_options->wordlist_count > 0)
|
||||||
|
{
|
||||||
|
status_ctx->words_cnt = user_options->wordlist_count * straight_ctx->kernel_rules_cnt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rc = count_words (hashcat_ctx, &fp, straight_ctx->dict, &status_ctx->words_cnt);
|
||||||
|
}
|
||||||
|
|
||||||
hc_fclose (&fp);
|
hc_fclose (&fp);
|
||||||
|
|
||||||
@ -98,6 +107,10 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (user_options_extra->wordlist_mode == WL_MODE_STDIN)
|
||||||
|
{
|
||||||
|
status_ctx->words_cnt = user_options->wordlist_count * straight_ctx->kernel_rules_cnt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
||||||
{
|
{
|
||||||
|
@ -60,6 +60,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
|
|||||||
" --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
|
" --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
|
||||||
" --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check-timer=30",
|
" --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check-timer=30",
|
||||||
" --wordlist-autohex-disable | | Disable the conversion of $HEX[] from the wordlist |",
|
" --wordlist-autohex-disable | | Disable the conversion of $HEX[] from the wordlist |",
|
||||||
|
" --wordlist-count | Num | Sets number of words in the wordlist | --wordlist-count=14341564",
|
||||||
" -p, --separator | Char | Separator char for hashlists and outfile | -p :",
|
" -p, --separator | Char | Separator char for hashlists and outfile | -p :",
|
||||||
" --stdout | | Do not crack a hash, instead print candidates only |",
|
" --stdout | | Do not crack a hash, instead print candidates only |",
|
||||||
" --show | | Compare hashlist with potfile; show cracked hashes |",
|
" --show | | Compare hashlist with potfile; show cracked hashes |",
|
||||||
|
@ -140,6 +140,7 @@ static const struct option long_options[] =
|
|||||||
{"veracrypt-pim-stop", required_argument, NULL, IDX_VERACRYPT_PIM_STOP},
|
{"veracrypt-pim-stop", required_argument, NULL, IDX_VERACRYPT_PIM_STOP},
|
||||||
{"version", no_argument, NULL, IDX_VERSION},
|
{"version", no_argument, NULL, IDX_VERSION},
|
||||||
{"wordlist-autohex-disable", no_argument, NULL, IDX_WORDLIST_AUTOHEX_DISABLE},
|
{"wordlist-autohex-disable", no_argument, NULL, IDX_WORDLIST_AUTOHEX_DISABLE},
|
||||||
|
{"wordlist-count", required_argument, NULL, IDX_WORDLIST_COUNT},
|
||||||
{"workload-profile", required_argument, NULL, IDX_WORKLOAD_PROFILE},
|
{"workload-profile", required_argument, NULL, IDX_WORKLOAD_PROFILE},
|
||||||
#ifdef WITH_BRAIN
|
#ifdef WITH_BRAIN
|
||||||
{"brain-client", no_argument, NULL, IDX_BRAIN_CLIENT},
|
{"brain-client", no_argument, NULL, IDX_BRAIN_CLIENT},
|
||||||
@ -288,6 +289,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
|
|||||||
user_options->veracrypt_pim_stop = VERACRYPT_PIM_STOP;
|
user_options->veracrypt_pim_stop = VERACRYPT_PIM_STOP;
|
||||||
user_options->version = VERSION;
|
user_options->version = VERSION;
|
||||||
user_options->wordlist_autohex_disable = WORDLIST_AUTOHEX_DISABLE;
|
user_options->wordlist_autohex_disable = WORDLIST_AUTOHEX_DISABLE;
|
||||||
|
user_options->wordlist_count = WORDLIST_COUNT;
|
||||||
user_options->workload_profile = WORKLOAD_PROFILE;
|
user_options->workload_profile = WORKLOAD_PROFILE;
|
||||||
user_options->rp_files_cnt = 0;
|
user_options->rp_files_cnt = 0;
|
||||||
user_options->rp_files = (char **) hccalloc (256, sizeof (char *));
|
user_options->rp_files = (char **) hccalloc (256, sizeof (char *));
|
||||||
@ -450,7 +452,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
case IDX_RP_GEN_FUNC_SEL: user_options->rp_gen_func_sel = optarg; break;
|
case IDX_RP_GEN_FUNC_SEL: user_options->rp_gen_func_sel = optarg; break;
|
||||||
case IDX_RP_GEN_SEED: user_options->rp_gen_seed = hc_strtoul (optarg, NULL, 10);
|
case IDX_RP_GEN_SEED: user_options->rp_gen_seed = hc_strtoul (optarg, NULL, 10);
|
||||||
user_options->rp_gen_seed_chgd = true; break;
|
user_options->rp_gen_seed_chgd = true; break;
|
||||||
case IDX_RULE_BUF_L: user_options->rule_buf_l = optarg; break;
|
case IDX_RULE_BUF_L: user_options->rule_buf_l = optarg;
|
||||||
|
user_options->rule_buf_l_chgd = true; break;
|
||||||
case IDX_RULE_BUF_R: user_options->rule_buf_r = optarg; break;
|
case IDX_RULE_BUF_R: user_options->rule_buf_r = optarg; break;
|
||||||
case IDX_MARKOV_DISABLE: user_options->markov_disable = true; break;
|
case IDX_MARKOV_DISABLE: user_options->markov_disable = true; break;
|
||||||
case IDX_MARKOV_CLASSIC: user_options->markov_classic = true; break;
|
case IDX_MARKOV_CLASSIC: user_options->markov_classic = true; break;
|
||||||
@ -462,6 +465,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
|||||||
user_options->outfile_format_chgd = true; break;
|
user_options->outfile_format_chgd = true; break;
|
||||||
case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = false; break;
|
case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = false; break;
|
||||||
case IDX_OUTFILE_CHECK_TIMER: user_options->outfile_check_timer = hc_strtoul (optarg, NULL, 10); break;
|
case IDX_OUTFILE_CHECK_TIMER: user_options->outfile_check_timer = hc_strtoul (optarg, NULL, 10); break;
|
||||||
|
case IDX_WORDLIST_COUNT: user_options->wordlist_count = hc_strtoull (optarg, NULL, 10);
|
||||||
|
user_options->wordlist_count_chgd = true; break;
|
||||||
case IDX_WORDLIST_AUTOHEX_DISABLE: user_options->wordlist_autohex_disable = true; break;
|
case IDX_WORDLIST_AUTOHEX_DISABLE: user_options->wordlist_autohex_disable = true; break;
|
||||||
case IDX_HEX_CHARSET: user_options->hex_charset = true; break;
|
case IDX_HEX_CHARSET: user_options->hex_charset = true; break;
|
||||||
case IDX_HEX_SALT: user_options->hex_salt = true; break;
|
case IDX_HEX_SALT: user_options->hex_salt = true; break;
|
||||||
@ -1437,6 +1442,23 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user_options->wordlist_count_chgd == true)
|
||||||
|
{
|
||||||
|
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
||||||
|
{
|
||||||
|
event_log_error (hashcat_ctx, "Use of --wordlist-count is only allowed in attack mode 0 (straight).");
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (user_options->rule_buf_l_chgd == true)
|
||||||
|
{
|
||||||
|
event_log_error (hashcat_ctx, "Combining --wordlist-count with --rule-left is not allowed.");
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (user_options->backend_info > 2)
|
if (user_options->backend_info > 2)
|
||||||
{
|
{
|
||||||
event_log_error (hashcat_ctx, "Invalid --backend-info/-I value, must have a value greater or equal to 0 and lower than 3.");
|
event_log_error (hashcat_ctx, "Invalid --backend-info/-I value, must have a value greater or equal to 0 and lower than 3.");
|
||||||
|
Loading…
Reference in New Issue
Block a user