mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-26 01:50:10 +00:00
Add user_options_extra_amplifier()
This commit is contained in:
parent
034c0699bb
commit
39d333d551
@ -12,8 +12,6 @@
|
||||
|
||||
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
|
||||
|
||||
u64 status_words_base_calculate (hashcat_ctx_t *hashcat_ctx, const u64 words_cnt);
|
||||
|
||||
void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx);
|
||||
void status_display (hashcat_ctx_t *hashcat_ctx);
|
||||
void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx);
|
||||
|
@ -170,6 +170,8 @@ void user_options_extra_init (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
void user_options_extra_destroy (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
u64 user_options_extra_amplifier (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
void user_options_logger (hashcat_ctx_t *hashcat_ctx);
|
||||
|
||||
#endif // _USER_OPTIONS_H
|
||||
|
@ -296,7 +296,7 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// words_base
|
||||
|
||||
status_ctx->words_base = status_words_base_calculate (hashcat_ctx, status_ctx->words_cnt);
|
||||
status_ctx->words_base = status_ctx->words_cnt / user_options_extra_amplifier (hashcat_ctx);
|
||||
|
||||
if (user_options->keyspace == true)
|
||||
{
|
||||
@ -314,26 +314,11 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (status_ctx->words_cur)
|
||||
{
|
||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
|
||||
const u64 progress_restored = status_ctx->words_cur * user_options_extra_amplifier (hashcat_ctx);
|
||||
|
||||
for (u32 i = 0; i < hashes->salts_cnt; i++)
|
||||
{
|
||||
for (u32 i = 0; i < hashes->salts_cnt; i++)
|
||||
{
|
||||
status_ctx->words_progress_restored[i] = status_ctx->words_cur * straight_ctx->kernel_rules_cnt;
|
||||
}
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
|
||||
{
|
||||
for (u32 i = 0; i < hashes->salts_cnt; i++)
|
||||
{
|
||||
status_ctx->words_progress_restored[i] = status_ctx->words_cur * combinator_ctx->combs_cnt;
|
||||
}
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
|
||||
{
|
||||
for (u32 i = 0; i < hashes->salts_cnt; i++)
|
||||
{
|
||||
status_ctx->words_progress_restored[i] = status_ctx->words_cur * mask_ctx->bfs_cnt;
|
||||
}
|
||||
status_ctx->words_progress_restored[i] = progress_restored;
|
||||
}
|
||||
}
|
||||
|
||||
|
34
src/status.c
34
src/status.c
@ -146,40 +146,6 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en
|
||||
return exec_ms_sum / exec_ms_cnt;
|
||||
}
|
||||
|
||||
u64 status_words_base_calculate (hashcat_ctx_t *hashcat_ctx, const u64 words_cnt)
|
||||
{
|
||||
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||
|
||||
u64 words_base = words_cnt;
|
||||
|
||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
|
||||
{
|
||||
if (straight_ctx->kernel_rules_cnt)
|
||||
{
|
||||
words_base /= straight_ctx->kernel_rules_cnt;
|
||||
}
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
|
||||
{
|
||||
if (combinator_ctx->combs_cnt)
|
||||
{
|
||||
words_base /= combinator_ctx->combs_cnt;
|
||||
}
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
|
||||
{
|
||||
if (mask_ctx->bfs_cnt)
|
||||
{
|
||||
words_base /= mask_ctx->bfs_cnt;
|
||||
}
|
||||
}
|
||||
|
||||
return words_base;
|
||||
}
|
||||
|
||||
void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
||||
|
@ -1159,6 +1159,38 @@ void user_options_extra_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||
memset (user_options_extra, 0, sizeof (user_options_extra_t));
|
||||
}
|
||||
|
||||
u64 user_options_extra_amplifier (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||
|
||||
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
|
||||
{
|
||||
if (straight_ctx->kernel_rules_cnt)
|
||||
{
|
||||
return straight_ctx->kernel_rules_cnt;
|
||||
}
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
|
||||
{
|
||||
if (combinator_ctx->combs_cnt)
|
||||
{
|
||||
return combinator_ctx->combs_cnt;
|
||||
}
|
||||
}
|
||||
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
|
||||
{
|
||||
if (mask_ctx->bfs_cnt)
|
||||
{
|
||||
return mask_ctx->bfs_cnt;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
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