mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-19 21:18:21 +00:00
Merge pull request #4227 from Chick3nman/totalcandidates
Add --total-candidates flag and functionality
This commit is contained in:
commit
db2214f755
@ -70,6 +70,7 @@
|
||||
|
||||
- Added new feature (-Y) that creates N virtual instances for each device in your system at the cost of N times the device memory consumption
|
||||
- Added options --benchmark-min and --benchmark-max to set a hash-mode range to be used during the benchmark
|
||||
- Added option --total-candidates to provide the total candidate count for an attack insteda of the internal "--keyspace" value
|
||||
- Added option --backend-devices-keepfree to configure X percentage of device memory available to keep free
|
||||
|
||||
##
|
||||
|
@ -115,6 +115,7 @@ typedef enum event_identifier
|
||||
EVENT_BRIDGES_SALT_POST = 0x00000122,
|
||||
EVENT_BRIDGES_SALT_PRE = 0x00000123,
|
||||
EVENT_CALCULATED_WORDS_BASE = 0x00000020,
|
||||
EVENT_CALCULATED_WORDS_CNT = 0x00000021,
|
||||
EVENT_CRACKER_FINISHED = 0x00000030,
|
||||
EVENT_CRACKER_HASH_CRACKED = 0x00000031,
|
||||
EVENT_CRACKER_STARTING = 0x00000032,
|
||||
@ -721,6 +722,7 @@ typedef enum user_options_defaults
|
||||
KERNEL_LOOPS = 0,
|
||||
KERNEL_THREADS = 0,
|
||||
KEYSPACE = false,
|
||||
TOTAL_CANDIDATES = false,
|
||||
LEFT = false,
|
||||
LIMIT = 0,
|
||||
LOGFILE = true,
|
||||
@ -904,6 +906,7 @@ typedef enum user_options_map
|
||||
IDX_STATUS_TIMER = 0xff4c,
|
||||
IDX_STDOUT_FLAG = 0xff4d,
|
||||
IDX_STDIN_TIMEOUT_ABORT = 0xff4e,
|
||||
IDX_TOTAL_CANDIDATES = 0xff58,
|
||||
IDX_TRUECRYPT_KEYFILES = 0xff4f,
|
||||
IDX_USERNAME = 0xff50,
|
||||
IDX_VERACRYPT_KEYFILES = 0xff51,
|
||||
@ -2438,6 +2441,7 @@ typedef struct user_options
|
||||
bool increment;
|
||||
bool keep_guessing;
|
||||
bool keyspace;
|
||||
bool total_candidates;
|
||||
bool left;
|
||||
bool logfile;
|
||||
bool loopback;
|
||||
|
@ -132,6 +132,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
status_ctx->words_base = status_ctx->words_cnt / amplifier_cnt;
|
||||
|
||||
EVENT (EVENT_CALCULATED_WORDS_BASE);
|
||||
EVENT (EVENT_CALCULATED_WORDS_CNT);
|
||||
|
||||
if (user_options->keyspace == true)
|
||||
{
|
||||
|
13
src/main.c
13
src/main.c
@ -370,10 +370,22 @@ static void main_calculated_words_base (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
|
||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
if (user_options->keyspace == false) return;
|
||||
if (user_options->total_candidates == true) return;
|
||||
|
||||
event_log_info (hashcat_ctx, "%" PRIu64 "", status_ctx->words_base);
|
||||
}
|
||||
|
||||
static void main_calculated_words_cnt (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
||||
{
|
||||
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
if (user_options->keyspace == false) return;
|
||||
if (user_options->total_candidates == false) return;
|
||||
|
||||
event_log_info (hashcat_ctx, "%" PRIu64 "", status_ctx->words_cnt);
|
||||
}
|
||||
|
||||
static void main_potfile_remove_parse_pre (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
||||
{
|
||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||
@ -1251,6 +1263,7 @@ static void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, co
|
||||
case EVENT_BRIDGES_SALT_POST: main_bridges_salt_post (hashcat_ctx, buf, len); break;
|
||||
case EVENT_BRIDGES_SALT_PRE: main_bridges_salt_pre (hashcat_ctx, buf, len); break;
|
||||
case EVENT_CALCULATED_WORDS_BASE: main_calculated_words_base (hashcat_ctx, buf, len); break;
|
||||
case EVENT_CALCULATED_WORDS_CNT: main_calculated_words_cnt (hashcat_ctx, buf, len); break;
|
||||
case EVENT_CRACKER_FINISHED: main_cracker_finished (hashcat_ctx, buf, len); break;
|
||||
case EVENT_CRACKER_HASH_CRACKED: main_cracker_hash_cracked (hashcat_ctx, buf, len); break;
|
||||
case EVENT_CRACKER_STARTING: main_cracker_starting (hashcat_ctx, buf, len); break;
|
||||
|
@ -28,12 +28,13 @@ void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag)
|
||||
{
|
||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
if (user_options->quiet == true) return;
|
||||
if (user_options->keyspace == true) return;
|
||||
if (user_options->stdout_flag == true) return;
|
||||
if (user_options->show == true) return;
|
||||
if (user_options->left == true) return;
|
||||
if (user_options->identify == true) return;
|
||||
if (user_options->quiet == true) return;
|
||||
if (user_options->keyspace == true) return;
|
||||
if (user_options->total_candidates == true) return;
|
||||
if (user_options->stdout_flag == true) return;
|
||||
if (user_options->show == true) return;
|
||||
if (user_options->left == true) return;
|
||||
if (user_options->identify == true) return;
|
||||
|
||||
if (user_options->usage > 0)
|
||||
{
|
||||
|
@ -126,6 +126,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
|
||||
" -s, --skip | Num | Skip X words from the start | -s 1000000",
|
||||
" -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
|
||||
" --keyspace | | Show keyspace base:mod values and quit |",
|
||||
" --total-candidates | | Show total candidate count (base*mod) and quit |",
|
||||
" -j, --rule-left | Rule | Single rule applied to each word from left wordlist | -j 'c'",
|
||||
" -k, --rule-right | Rule | Single rule applied to each word from right wordlist | -k '^-'",
|
||||
" -r, --rules-file | File | Multiple rules applied to each word from wordlists | -r rules/best64.rule",
|
||||
|
@ -93,6 +93,7 @@ static const struct option long_options[] =
|
||||
{"kernel-threads", required_argument, NULL, IDX_KERNEL_THREADS},
|
||||
{"keyboard-layout-mapping", required_argument, NULL, IDX_KEYBOARD_LAYOUT_MAPPING},
|
||||
{"keyspace", no_argument, NULL, IDX_KEYSPACE},
|
||||
{"total-candidates", no_argument, NULL, IDX_TOTAL_CANDIDATES},
|
||||
{"left", no_argument, NULL, IDX_LEFT},
|
||||
{"limit", required_argument, NULL, IDX_LIMIT},
|
||||
{"logfile-disable", no_argument, NULL, IDX_LOGFILE_DISABLE},
|
||||
@ -246,6 +247,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
|
||||
user_options->kernel_threads = KERNEL_THREADS;
|
||||
user_options->keyboard_layout_mapping = NULL;
|
||||
user_options->keyspace = KEYSPACE;
|
||||
user_options->total_candidates = TOTAL_CANDIDATES;
|
||||
user_options->left = LEFT;
|
||||
user_options->limit = LIMIT;
|
||||
user_options->logfile = LOGFILE;
|
||||
@ -449,6 +451,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
user_options->limit_chgd = true; break;
|
||||
case IDX_KEEP_GUESSING: user_options->keep_guessing = true; break;
|
||||
case IDX_KEYSPACE: user_options->keyspace = true; break;
|
||||
case IDX_TOTAL_CANDIDATES: user_options->total_candidates = true; break;
|
||||
case IDX_BENCHMARK: user_options->benchmark = true; break;
|
||||
case IDX_BENCHMARK_ALL: user_options->benchmark_all = true; break;
|
||||
case IDX_BENCHMARK_MAX: user_options->benchmark_max = hc_strtoul (optarg, NULL, 10); break;
|
||||
@ -1863,6 +1866,11 @@ void user_options_session_auto (hashcat_ctx_t *hashcat_ctx)
|
||||
user_options->session = "progress_only";
|
||||
}
|
||||
|
||||
if (user_options->total_candidates == true)
|
||||
{
|
||||
user_options->session = "candidates";
|
||||
}
|
||||
|
||||
if (user_options->keyspace == true)
|
||||
{
|
||||
user_options->session = "keyspace";
|
||||
@ -1936,6 +1944,7 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (user_options->hash_info == true
|
||||
|| user_options->keyspace == true
|
||||
|| user_options->total_candidates == true
|
||||
|| user_options->speed_only == true
|
||||
|| user_options->progress_only == true
|
||||
|| user_options->identify == true
|
||||
@ -2006,6 +2015,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
|
||||
user_options->speed_only = true;
|
||||
}
|
||||
|
||||
if (user_options->total_candidates == true)
|
||||
{
|
||||
user_options->quiet = true;
|
||||
}
|
||||
|
||||
if (user_options->keyspace == true)
|
||||
{
|
||||
user_options->quiet = true;
|
||||
@ -2016,6 +2030,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
|
||||
user_options->backend_vector_width = 1;
|
||||
}
|
||||
|
||||
if (user_options->total_candidates == true)
|
||||
{
|
||||
user_options->keyspace = true;
|
||||
}
|
||||
|
||||
if (user_options->stdout_flag == true)
|
||||
{
|
||||
user_options->force = true;
|
||||
@ -3374,6 +3393,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
|
||||
logfile_top_uint (user_options->kernel_loops);
|
||||
logfile_top_uint (user_options->kernel_threads);
|
||||
logfile_top_uint (user_options->keyspace);
|
||||
logfile_top_uint (user_options->total_candidates);
|
||||
logfile_top_uint (user_options->left);
|
||||
logfile_top_uint (user_options->logfile);
|
||||
logfile_top_uint (user_options->loopback);
|
||||
|
Loading…
Reference in New Issue
Block a user