1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-15 20:39:17 +00:00

Move no-rules check to interface.c so that interface.c is the only source where pw_min and pw_max are set

This commit is contained in:
jsteube 2017-07-17 15:27:03 +02:00
parent 79bb69bcd4
commit 9d92100a57
2 changed files with 34 additions and 55 deletions

View File

@ -19619,8 +19619,9 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le
int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
user_options_t *user_options = hashcat_ctx->user_options;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
user_options_t *user_options = hashcat_ctx->user_options;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
hashconfig->hash_mode = user_options->hash_mode;
hashconfig->hash_type = 0;
@ -24521,11 +24522,15 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
case 11600: hashconfig->hook_size = sizeof (seven_zip_hook_t); break;
};
// pw_min : algo specific hard min length
/**
* pw_min and pw_max
*/
hashconfig->pw_min = PW_MIN;
hashconfig->pw_max = PW_MAX;
// pw_min : algo specific hard min length
switch (hashconfig->hash_mode)
{
case 112: hashconfig->pw_min = 8; break; // https://www.toadworld.com/platforms/oracle/b/weblog/archive/2013/11/12/oracle-12c-passwords
@ -24561,6 +24566,32 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->pw_max /= 2;
}
#define PW_DICTMAX 31
if ((user_options->rp_files_cnt > 0) || (user_options->rp_gen > 0))
{
switch (user_options_extra->attack_kern)
{
case ATTACK_KERN_STRAIGHT: if (hashconfig->pw_max > PW_DICTMAX) hashconfig->pw_max = PW_DICTMAX;
break;
}
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
switch (user_options_extra->attack_kern)
{
case ATTACK_KERN_STRAIGHT: if (hashconfig->pw_max > PW_DICTMAX) hashconfig->pw_max = PW_DICTMAX;
break;
}
}
else
{
// If we have a NOOP rule then we can process words from wordlists > length 32 for slow hashes
}
}
switch (hashconfig->hash_mode)
{
case 500: hashconfig->pw_max = 15; // -L available

View File

@ -201,7 +201,6 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options;
@ -246,57 +245,6 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx)
}
}
/**
* pw_min and pw_max
*/
u32 pw_min = hashconfig->pw_min;
u32 pw_max = hashconfig->pw_max;
if (user_options->length_limit_disable == true)
{
}
else
{
// If we have a NOOP rule then we can process words from wordlists > length 32 for slow hashes
const bool has_noop = kernel_rules_has_noop (straight_ctx->kernel_rules_buf, straight_ctx->kernel_rules_cnt);
#define PW_DICTMAX 32
if (has_noop == false)
{
switch (user_options_extra->attack_kern)
{
case ATTACK_KERN_STRAIGHT: if (pw_max > PW_DICTMAX) pw_max = PW_DICTMAX;
break;
case ATTACK_KERN_COMBI: if (pw_max > PW_DICTMAX) pw_max = PW_DICTMAX;
break;
}
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
switch (user_options_extra->attack_kern)
{
case ATTACK_KERN_STRAIGHT: if (pw_max > PW_DICTMAX) pw_max = PW_DICTMAX;
break;
case ATTACK_KERN_COMBI: if (pw_max > PW_DICTMAX) pw_max = PW_DICTMAX;
break;
}
}
else
{
// in this case we can process > 32
}
}
}
hashconfig->pw_min = pw_min;
hashconfig->pw_max = pw_max;
/**
* wordlist based work
*/