1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-01 20:38:14 +00:00

Add noop-check to rules_ctx.c

This commit is contained in:
jsteube 2016-09-25 14:53:57 +02:00
parent 4399b0361b
commit 92e263a761
3 changed files with 24 additions and 17 deletions

View File

@ -31,4 +31,6 @@ int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule);
int rules_ctx_init (rules_ctx_t *rules_ctx, const user_options_t *user_options); int rules_ctx_init (rules_ctx_t *rules_ctx, const user_options_t *user_options);
void rules_ctx_destroy (rules_ctx_t *rules_ctx); void rules_ctx_destroy (rules_ctx_t *rules_ctx);
bool rules_ctx_has_noop (rules_ctx_t *rules_ctx);
#endif // _RP_H #endif // _RP_H

View File

@ -385,17 +385,9 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
* If we have a NOOP rule then we can process words from wordlists > length 32 for slow hashes * If we have a NOOP rule then we can process words from wordlists > length 32 for slow hashes
*/ */
int has_noop = 0; const bool has_noop = rules_ctx_has_noop (rules_ctx);
for (uint kernel_rules_pos = 0; kernel_rules_pos < rules_ctx->kernel_rules_cnt; kernel_rules_pos++) if (has_noop == false)
{
if (rules_ctx->kernel_rules_buf[kernel_rules_pos].cmds[0] != RULE_OP_MANGLE_NOOP) continue;
if (rules_ctx->kernel_rules_buf[kernel_rules_pos].cmds[1] != 0) continue;
has_noop = 1;
}
if (has_noop == 0)
{ {
switch (user_options_extra->attack_kern) switch (user_options_extra->attack_kern)
{ {
@ -3308,6 +3300,13 @@ int main (int argc, char **argv)
setup_seeding (user_options, &proc_start); setup_seeding (user_options, &proc_start);
/**
* Inform user things getting started,
* - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
*/
welcome_screen (user_options, &proc_start);
/** /**
* logfile init * logfile init
*/ */
@ -3324,13 +3323,6 @@ int main (int argc, char **argv)
user_options_logger (user_options, logfile_ctx); user_options_logger (user_options, logfile_ctx);
/**
* Inform user things getting started,
* - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
*/
welcome_screen (user_options, &proc_start);
/** /**
* tuning db * tuning db
*/ */

View File

@ -918,3 +918,16 @@ void rules_ctx_destroy (rules_ctx_t *rules_ctx)
myfree (rules_ctx); myfree (rules_ctx);
} }
bool rules_ctx_has_noop (rules_ctx_t *rules_ctx)
{
for (uint kernel_rules_pos = 0; kernel_rules_pos < rules_ctx->kernel_rules_cnt; kernel_rules_pos++)
{
if (rules_ctx->kernel_rules_buf[kernel_rules_pos].cmds[0] != RULE_OP_MANGLE_NOOP) continue;
if (rules_ctx->kernel_rules_buf[kernel_rules_pos].cmds[1] != 0) continue;
return true;
}
return false;
}