2016-09-27 20:07:49 +02:00
|
|
|
/**
|
|
|
|
* Author......: See docs/credits.txt
|
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "types.h"
|
2016-10-08 23:45:35 +02:00
|
|
|
#include "event.h"
|
2016-10-31 11:28:06 +01:00
|
|
|
#include "shared.h"
|
2016-09-27 20:07:49 +02:00
|
|
|
#include "wordlist.h"
|
2019-03-31 17:39:00 +02:00
|
|
|
#include "combinator.h"
|
2016-09-27 20:07:49 +02:00
|
|
|
|
2016-10-06 10:10:04 +02:00
|
|
|
int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
2016-09-27 20:07:49 +02:00
|
|
|
{
|
2016-10-06 10:10:04 +02:00
|
|
|
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
2017-07-18 14:45:15 +02:00
|
|
|
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2016-10-06 10:10:04 +02:00
|
|
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-09-27 20:07:49 +02:00
|
|
|
combinator_ctx->enabled = false;
|
|
|
|
|
2020-12-29 04:58:58 +01:00
|
|
|
if (user_options->hash_info == true) return 0;
|
2017-08-22 11:09:46 +02:00
|
|
|
if (user_options->left == true) return 0;
|
2019-05-01 15:52:56 +02:00
|
|
|
if (user_options->backend_info == true) return 0;
|
2017-08-22 11:09:46 +02:00
|
|
|
if (user_options->show == true) return 0;
|
|
|
|
if (user_options->usage == true) return 0;
|
|
|
|
if (user_options->version == true) return 0;
|
2016-09-30 11:48:14 +02:00
|
|
|
|
2016-09-27 20:07:49 +02:00
|
|
|
if ((user_options->attack_mode != ATTACK_MODE_COMBI)
|
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_HYBRID1)
|
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_HYBRID2)) return 0;
|
|
|
|
|
|
|
|
combinator_ctx->enabled = true;
|
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (user_options->slow_candidates == true)
|
2016-10-03 16:27:34 +02:00
|
|
|
{
|
2018-09-01 23:12:56 +02:00
|
|
|
// this is always need to be COMBINATOR_MODE_BASE_LEFT
|
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
|
|
|
{
|
|
|
|
// display
|
|
|
|
|
|
|
|
char *dictfile1 = user_options_extra->hc_workv[0];
|
|
|
|
char *dictfile2 = user_options_extra->hc_workv[1];
|
|
|
|
|
|
|
|
// at this point we know the file actually exist
|
|
|
|
// find the bigger dictionary and use as base
|
|
|
|
|
|
|
|
if (hc_path_is_file (dictfile1) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: Not a regular file.", dictfile1);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_is_file (dictfile2) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: Not a regular file.", dictfile2);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
HCFILE fp1;
|
|
|
|
HCFILE fp2;
|
2018-09-01 23:12:56 +02:00
|
|
|
|
2019-07-01 17:27:08 +02:00
|
|
|
if (hc_fopen (&fp1, dictfile1, "rb") == false)
|
2018-09-01 23:12:56 +02:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-07-01 17:27:08 +02:00
|
|
|
if (hc_fopen (&fp2, dictfile2, "rb") == false)
|
2018-09-01 23:12:56 +02:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
|
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
2018-09-01 23:12:56 +02:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
combinator_ctx->combs_cnt = 1;
|
|
|
|
|
|
|
|
u64 words1_cnt = 0;
|
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
const int rc1 = count_words (hashcat_ctx, &fp1, dictfile1, &words1_cnt);
|
2018-09-01 23:12:56 +02:00
|
|
|
|
|
|
|
if (rc1 == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1);
|
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
|
|
|
hc_fclose (&fp2);
|
2018-09-01 23:12:56 +02:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (words1_cnt == 0)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: empty file.", dictfile1);
|
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
|
|
|
hc_fclose (&fp2);
|
2018-09-01 23:12:56 +02:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
combinator_ctx->combs_cnt = 1;
|
|
|
|
|
|
|
|
u64 words2_cnt = 0;
|
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
const int rc2 = count_words (hashcat_ctx, &fp2, dictfile2, &words2_cnt);
|
2018-09-01 23:12:56 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
|
|
|
hc_fclose (&fp2);
|
2019-06-21 21:35:24 +02:00
|
|
|
|
2018-09-01 23:12:56 +02:00
|
|
|
if (rc2 == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile2);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (words2_cnt == 0)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: empty file.", dictfile2);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
combinator_ctx->dict1 = dictfile1;
|
|
|
|
combinator_ctx->dict2 = dictfile2;
|
|
|
|
|
|
|
|
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT;
|
|
|
|
combinator_ctx->combs_cnt = words2_cnt;
|
|
|
|
}
|
2018-09-01 12:31:17 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
|
2017-06-30 16:51:57 +02:00
|
|
|
{
|
2018-09-01 12:31:17 +02:00
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
|
|
|
{
|
|
|
|
// display
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
char *dictfile1 = user_options_extra->hc_workv[0];
|
|
|
|
char *dictfile2 = user_options_extra->hc_workv[1];
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
// at this point we know the file actually exist
|
|
|
|
// find the bigger dictionary and use as base
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (hc_path_is_file (dictfile1) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: Not a regular file.", dictfile1);
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (hc_path_is_file (dictfile2) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: Not a regular file.", dictfile2);
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
HCFILE fp1;
|
|
|
|
HCFILE fp2;
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2019-07-01 17:27:08 +02:00
|
|
|
if (hc_fopen (&fp1, dictfile1, "rb") == false)
|
2018-09-01 12:31:17 +02:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2019-07-01 17:27:08 +02:00
|
|
|
if (hc_fopen (&fp2, dictfile2, "rb") == false)
|
2018-09-01 12:31:17 +02:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
|
2017-02-11 01:09:58 +01:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
combinator_ctx->combs_cnt = 1;
|
2017-02-22 16:33:23 +01:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
u64 words1_cnt = 0;
|
2017-02-22 16:33:23 +01:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
const int rc1 = count_words (hashcat_ctx, &fp1, dictfile1, &words1_cnt);
|
2017-02-22 16:33:23 +01:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (rc1 == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1);
|
2017-02-22 16:33:23 +01:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
|
|
|
hc_fclose (&fp2);
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (words1_cnt == 0)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: empty file.", dictfile1);
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
|
|
|
hc_fclose (&fp2);
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
combinator_ctx->combs_cnt = 1;
|
2017-02-22 16:33:23 +01:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
u64 words2_cnt = 0;
|
2017-02-22 16:33:23 +01:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
const int rc2 = count_words (hashcat_ctx, &fp2, dictfile2, &words2_cnt);
|
2017-02-22 16:33:23 +01:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
|
|
|
hc_fclose (&fp2);
|
2019-06-21 21:35:24 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (rc2 == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile2);
|
2017-02-22 16:33:23 +01:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (words2_cnt == 0)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: empty file.", dictfile2);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
combinator_ctx->dict1 = dictfile1;
|
|
|
|
combinator_ctx->dict2 = dictfile2;
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (words1_cnt >= words2_cnt)
|
|
|
|
{
|
|
|
|
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT;
|
|
|
|
combinator_ctx->combs_cnt = words2_cnt;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_RIGHT;
|
|
|
|
combinator_ctx->combs_cnt = words1_cnt;
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
// we also have to switch wordlist related rules!
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
const char *tmpc = user_options->rule_buf_l;
|
|
|
|
|
|
|
|
user_options->rule_buf_l = user_options->rule_buf_r;
|
|
|
|
user_options->rule_buf_r = tmpc;
|
|
|
|
|
|
|
|
u32 tmpi = user_options_extra->rule_len_l;
|
|
|
|
|
|
|
|
user_options_extra->rule_len_l = user_options_extra->rule_len_r;
|
|
|
|
user_options_extra->rule_len_r = tmpi;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2017-06-30 16:51:57 +02:00
|
|
|
{
|
2017-07-18 13:23:42 +02:00
|
|
|
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT;
|
2017-06-30 16:51:57 +02:00
|
|
|
}
|
2018-09-01 12:31:17 +02:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
2017-06-30 16:51:57 +02:00
|
|
|
{
|
2017-07-18 13:23:42 +02:00
|
|
|
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_RIGHT;
|
2018-09-01 12:31:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// this is always need to be COMBINATOR_MODE_BASE_LEFT
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
|
|
|
{
|
|
|
|
// display
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
char *dictfile1 = user_options_extra->hc_workv[0];
|
|
|
|
char *dictfile2 = user_options_extra->hc_workv[1];
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
// at this point we know the file actually exist
|
|
|
|
// find the bigger dictionary and use as base
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (hc_path_is_file (dictfile1) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: Not a regular file.", dictfile1);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-07-18 13:23:42 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (hc_path_is_file (dictfile2) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: Not a regular file.", dictfile2);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
HCFILE fp1;
|
|
|
|
HCFILE fp2;
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2019-07-01 17:27:08 +02:00
|
|
|
if (hc_fopen (&fp1, dictfile1, "rb") == false)
|
2018-09-01 12:31:17 +02:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2019-07-01 17:27:08 +02:00
|
|
|
if (hc_fopen (&fp2, dictfile2, "rb") == false)
|
2018-09-01 12:31:17 +02:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
combinator_ctx->combs_cnt = 1;
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
u64 words1_cnt = 0;
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
const int rc1 = count_words (hashcat_ctx, &fp1, dictfile1, &words1_cnt);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (rc1 == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
|
|
|
hc_fclose (&fp2);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (words1_cnt == 0)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: empty file.", dictfile1);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
|
|
|
hc_fclose (&fp2);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
combinator_ctx->combs_cnt = 1;
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
u64 words2_cnt = 0;
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
const int rc2 = count_words (hashcat_ctx, &fp2, dictfile2, &words2_cnt);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp1);
|
|
|
|
hc_fclose (&fp2);
|
2019-06-21 21:35:24 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (rc2 == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile2);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (words2_cnt == 0)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: empty file.", dictfile2);
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
combinator_ctx->dict1 = dictfile1;
|
|
|
|
combinator_ctx->dict2 = dictfile2;
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT;
|
|
|
|
combinator_ctx->combs_cnt = words2_cnt;
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2017-06-30 16:51:57 +02:00
|
|
|
{
|
2018-09-01 12:31:17 +02:00
|
|
|
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT;
|
2017-06-30 16:51:57 +02:00
|
|
|
}
|
2018-09-01 12:31:17 +02:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
|
|
|
{
|
|
|
|
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
char *dictfile = user_options_extra->hc_workv[1];
|
2017-06-30 16:51:57 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
// at this point we know the file actually exist
|
2017-07-18 13:23:42 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (hc_path_is_file (dictfile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: Not a regular file.", dictfile);
|
2017-07-18 13:23:42 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-07-18 13:23:42 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
HCFILE fp;
|
2017-07-18 13:23:42 +02:00
|
|
|
|
2019-07-01 17:27:08 +02:00
|
|
|
if (hc_fopen (&fp, dictfile, "rb") == false)
|
2018-09-01 12:31:17 +02:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
|
2017-07-18 13:23:42 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-07-18 13:23:42 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
mask_ctx->bfs_cnt = 1;
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
u64 words_cnt = 0;
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
const int rc = count_words (hashcat_ctx, &fp, dictfile, &words_cnt);
|
2019-06-21 21:56:38 +02:00
|
|
|
|
2019-06-26 19:06:46 +02:00
|
|
|
hc_fclose (&fp);
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
if (rc == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile);
|
2016-10-03 16:27:34 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
return -1;
|
|
|
|
}
|
2017-07-18 13:23:42 +02:00
|
|
|
|
2018-09-01 12:31:17 +02:00
|
|
|
combinator_ctx->combs_cnt = words_cnt;
|
|
|
|
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT;
|
2017-06-29 12:19:05 +02:00
|
|
|
}
|
|
|
|
}
|
2016-10-03 16:27:34 +02:00
|
|
|
}
|
|
|
|
|
2016-09-27 20:07:49 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-10-06 10:10:04 +02:00
|
|
|
void combinator_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
|
2016-09-27 20:07:49 +02:00
|
|
|
{
|
2016-10-06 10:10:04 +02:00
|
|
|
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
|
|
|
|
2016-10-02 00:00:21 +02:00
|
|
|
if (combinator_ctx->enabled == false) return;
|
2016-09-30 13:36:27 +02:00
|
|
|
|
2016-10-02 00:00:21 +02:00
|
|
|
memset (combinator_ctx, 0, sizeof (combinator_ctx_t));
|
2016-09-27 20:07:49 +02:00
|
|
|
}
|