Limit kernel-loops in straight-mode to 256, therefore allow rules to be stored in constant memory

This commit is contained in:
jsteube
2017-08-23 12:43:59 +02:00
parent 51372438fe
commit 1d04de3a8e
642 changed files with 2918 additions and 2828 deletions
+14 -1
View File
@@ -3796,7 +3796,20 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->kernel_accel_max = 1024;
device_param->kernel_loops_min = 1;
device_param->kernel_loops_max = 1024;
//device_param->kernel_loops_max = 1024;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
device_param->kernel_loops_max = KERNEL_RULES;
}
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{
device_param->kernel_loops_max = KERNEL_COMBS;
}
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{
device_param->kernel_loops_max = KERNEL_BFS;
}
tuning_db_entry_t *tuningdb_entry = tuning_db_search (hashcat_ctx, device_param->device_name, device_param->device_type, user_options->attack_mode, hashconfig->hash_mode);
+53 -14
View File
@@ -53,9 +53,10 @@ static int sort_by_tuning_db_entry (const void *v1, const void *v2)
int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
{
folder_config_t *folder_config = hashcat_ctx->folder_config;
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
user_options_t *user_options = hashcat_ctx->user_options;
folder_config_t *folder_config = hashcat_ctx->folder_config;
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
user_options_t *user_options = hashcat_ctx->user_options;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
tuning_db->enabled = false;
@@ -182,7 +183,15 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
if (token_ptr[2][0] != '*') hash_type = atoi (token_ptr[2]);
if (token_ptr[3][0] != 'N') vector_width = atoi (token_ptr[3]);
if (token_ptr[4][0] != 'A')
if (token_ptr[4][0] == 'A')
{
kernel_accel = 0;
}
else if (token_ptr[4][0] == 'M')
{
kernel_accel = 1024;
}
else
{
kernel_accel = atoi (token_ptr[4]);
@@ -193,25 +202,55 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
continue;
}
}
else
{
kernel_accel = 0;
}
if (token_ptr[5][0] != 'A')
if (token_ptr[5][0] == 'A')
{
kernel_loops = 0;
}
else if (token_ptr[5][0] == 'M')
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
kernel_loops = KERNEL_RULES;
}
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{
kernel_loops = KERNEL_COMBS;
}
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
{
kernel_loops = KERNEL_BFS;
}
}
else
{
kernel_loops = atoi (token_ptr[5]);
if ((kernel_loops < 1) || (kernel_loops > 1024))
if (kernel_loops < 1)
{
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num);
continue;
}
if ((user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) && (kernel_loops > KERNEL_RULES))
{
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num);
continue;
}
else if ((user_options_extra->attack_kern == ATTACK_KERN_COMBI) && (kernel_loops > KERNEL_COMBS))
{
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num);
continue;
}
else if ((user_options_extra->attack_kern == ATTACK_KERN_BF) && (kernel_loops > KERNEL_BFS))
{
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num);
continue;
}
}
else
{
kernel_loops = 0;
}
tuning_db_entry_t *entry = &tuning_db->entry_buf[tuning_db->entry_cnt];
+46 -2
View File
@@ -689,7 +689,31 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->kernel_loops > 1024)
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) && (user_options->kernel_loops > KERNEL_RULES))
{
event_log_error (hashcat_ctx, "Invalid kernel-loops specified.");
return -1;
}
else if ((user_options->attack_mode == ATTACK_MODE_COMBI) && (user_options->kernel_loops > KERNEL_COMBS))
{
event_log_error (hashcat_ctx, "Invalid kernel-loops specified.");
return -1;
}
else if ((user_options->attack_mode == ATTACK_MODE_BF) && (user_options->kernel_loops > KERNEL_BFS))
{
event_log_error (hashcat_ctx, "Invalid kernel-loops specified.");
return -1;
}
else if ((user_options->attack_mode == ATTACK_MODE_HYBRID1) && (user_options->kernel_loops > KERNEL_COMBS))
{
event_log_error (hashcat_ctx, "Invalid kernel-loops specified.");
return -1;
}
else if ((user_options->attack_mode == ATTACK_MODE_HYBRID2) && (user_options->kernel_loops > KERNEL_COMBS))
{
event_log_error (hashcat_ctx, "Invalid kernel-loops specified.");
@@ -1313,10 +1337,30 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
user_options->force = true;
user_options->hash_mode = 2000;
user_options->kernel_accel = 1024;
user_options->kernel_loops = 1024;
user_options->opencl_vector_width = 1;
user_options->outfile_format = OUTFILE_FMT_PLAIN;
user_options->quiet = true;
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
user_options->kernel_loops = KERNEL_RULES;
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
user_options->kernel_loops = KERNEL_COMBS;
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
{
user_options->kernel_loops = KERNEL_BFS;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{
user_options->kernel_loops = KERNEL_COMBS;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
{
user_options->kernel_loops = KERNEL_COMBS;
}
}
if (user_options->opencl_info == true)