1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-22 22:58:30 +00:00

Add new option --slow-candidates which allows hashcat to generate passwords on-host

This commit is contained in:
jsteube 2018-09-01 12:31:17 +02:00
parent 466ea8eaba
commit 52c52836e3
24 changed files with 3403 additions and 2194 deletions

View File

@ -1,5 +1,11 @@
* changes v4.2.1 -> xxx
##
## Features
##
- Add new option --slow-candidates which allows hashcat to generate passwords on-host
##
## Improvements
##

View File

@ -188,8 +188,8 @@ _hashcat ()
local HIDDEN_FILES_AGGRESIVE="${HIDDEN_FILES}|hcmask|hcchr"
local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H'
local SHORT_OPTS="-m -a -V -v -h -b -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-disable --gpu-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable"
local SHORT_OPTS="-m -a -V -v -h -b -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-disable --gpu-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates"
local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to"
COMPREPLY=()

View File

@ -74,8 +74,8 @@ int run_kernel_decompress (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device
int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 pws_cnt);
int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 pws_cnt);
void generate_source_kernel_filename (const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *shared_dir, char *source_file);
void generate_cached_kernel_filename (const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *profile_dir, const char *device_name_chksum, char *cached_file);
void generate_source_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *shared_dir, char *source_file);
void generate_cached_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *profile_dir, const char *device_name_chksum, char *cached_file);
void generate_source_kernel_mp_filename (const u32 opti_type, const u64 opts_type, char *shared_dir, char *source_file);
void generate_cached_kernel_mp_filename (const u32 opti_type, const u64 opts_type, char *profile_dir, const char *device_name_chksum, char *cached_file);
void generate_source_kernel_amp_filename (const u32 attack_kern, char *shared_dir, char *source_file);

36
include/slow_candidates.h Normal file
View File

@ -0,0 +1,36 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _SLOW_CANDIDATES_H
#define _SLOW_CANDIDATES_H
typedef struct extra_info_straight
{
FILE *fd;
u64 rule_pos_prev;
u64 rule_pos;
u8 base_buf[256];
u32 base_len;
u8 out_buf[256];
u32 out_len;
} extra_info_straight_t;
typedef struct extra_info_mask
{
u64 pos;
u8 out_buf[256];
u32 out_len;
} extra_info_mask_t;
void slow_candidates_seek (hashcat_ctx_t *hashcat_ctx, void *extra_info, const u64 cur, const u64 end);
void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info);
#endif // _SLOW_CANDIDATES_H

View File

@ -15,6 +15,7 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en
// should be static after refactoring
void format_timer_display (struct tm *tm, char *buf, size_t len);
void format_speed_display (double val, char *buf, size_t len);
void format_speed_display_1k (double val, char *buf, size_t len);
int status_get_device_info_cnt (const hashcat_ctx_t *hashcat_ctx);
int status_get_device_info_active (const hashcat_ctx_t *hashcat_ctx);

View File

@ -529,8 +529,8 @@ typedef enum user_options_defaults
{
ADVICE_DISABLE = false,
ATTACK_MODE = ATTACK_MODE_STRAIGHT,
BENCHMARK = false,
BENCHMARK_ALL = false,
BENCHMARK = false,
BITMAP_MAX = 24,
BITMAP_MIN = 16,
DEBUG_MODE = 0,
@ -566,13 +566,13 @@ typedef enum user_options_defaults
OUTFILE_AUTOHEX = true,
OUTFILE_CHECK_TIMER = 5,
OUTFILE_FORMAT = 3,
WORDLIST_AUTOHEX_DISABLE = false,
POTFILE_DISABLE = false,
PROGRESS_ONLY = false,
QUIET = false,
REMOVE = false,
REMOVE_TIMER = 60,
RESTORE = false,
RESTORE_DISABLE = false,
RESTORE = false,
RESTORE_TIMER = 60,
RP_GEN = 0,
RP_GEN_FUNC_MAX = 4,
@ -580,19 +580,20 @@ typedef enum user_options_defaults
RP_GEN_SEED = 0,
RUNTIME = 0,
SCRYPT_TMTO = 0,
SELF_TEST_DISABLE = false,
SEGMENT_SIZE = 33554432,
SELF_TEST_DISABLE = false,
SEPARATOR = ':',
SHOW = false,
SKIP = 0,
SLOW_CANDIDATES = false,
SPEED_ONLY = false,
STATUS = false,
STATUS_TIMER = 10,
STDOUT_FLAG = false,
SPEED_ONLY = false,
PROGRESS_ONLY = false,
USAGE = false,
USERNAME = false,
VERSION = false,
WORDLIST_AUTOHEX_DISABLE = false,
WORKLOAD_PROFILE = 2,
} user_options_defaults_t;
@ -601,94 +602,95 @@ typedef enum user_options_map
{
IDX_ADVICE_DISABLE = 0xff00,
IDX_ATTACK_MODE = 'a',
IDX_BENCHMARK = 'b',
IDX_BENCHMARK_ALL = 0xff01,
IDX_BENCHMARK = 'b',
IDX_BITMAP_MAX = 0xff02,
IDX_BITMAP_MIN = 0xff03,
IDX_CPU_AFFINITY = 0xff04,
IDX_CPU_AFFINITY = 0xff0a,
IDX_CUSTOM_CHARSET_1 = '1',
IDX_CUSTOM_CHARSET_2 = '2',
IDX_CUSTOM_CHARSET_3 = '3',
IDX_CUSTOM_CHARSET_4 = '4',
IDX_DEBUG_FILE = 0xff05,
IDX_DEBUG_MODE = 0xff06,
IDX_ENCODING_FROM = 0xff07,
IDX_ENCODING_TO = 0xff08,
IDX_EXAMPLE_HASHES = 0xff09,
IDX_FORCE = 0xff0a,
IDX_GPU_TEMP_ABORT = 0xff0b,
IDX_GPU_TEMP_DISABLE = 0xff0c,
IDX_DEBUG_FILE = 0xff0b,
IDX_DEBUG_MODE = 0xff0c,
IDX_ENCODING_FROM = 0xff0d,
IDX_ENCODING_TO = 0xff0e,
IDX_EXAMPLE_HASHES = 0xff0f,
IDX_FORCE = 0xff10,
IDX_GPU_TEMP_ABORT = 0xff11,
IDX_GPU_TEMP_DISABLE = 0xff12,
IDX_HASH_MODE = 'm',
IDX_HCCAPX_MESSAGE_PAIR = 0xff0d,
IDX_HCCAPX_MESSAGE_PAIR = 0xff13,
IDX_HELP = 'h',
IDX_HEX_CHARSET = 0xff0e,
IDX_HEX_SALT = 0xff0f,
IDX_HEX_WORDLIST = 0xff10,
IDX_HEX_CHARSET = 0xff14,
IDX_HEX_SALT = 0xff15,
IDX_HEX_WORDLIST = 0xff16,
IDX_INCREMENT = 'i',
IDX_INCREMENT_MAX = 0xff11,
IDX_INCREMENT_MIN = 0xff12,
IDX_INDUCTION_DIR = 0xff13,
IDX_KEEP_GUESSING = 0xff14,
IDX_INCREMENT_MAX = 0xff17,
IDX_INCREMENT_MIN = 0xff18,
IDX_INDUCTION_DIR = 0xff19,
IDX_KEEP_GUESSING = 0xff1a,
IDX_KERNEL_ACCEL = 'n',
IDX_KERNEL_LOOPS = 'u',
IDX_KEYSPACE = 0xff15,
IDX_LEFT = 0xff16,
IDX_KEYSPACE = 0xff1b,
IDX_LEFT = 0xff1c,
IDX_LIMIT = 'l',
IDX_LOGFILE_DISABLE = 0xff17,
IDX_LOOPBACK = 0xff18,
IDX_MACHINE_READABLE = 0xff19,
IDX_MARKOV_CLASSIC = 0xff1a,
IDX_MARKOV_DISABLE = 0xff1b,
IDX_MARKOV_HCSTAT2 = 0xff1c,
IDX_LOGFILE_DISABLE = 0xff1d,
IDX_LOOPBACK = 0xff1e,
IDX_MACHINE_READABLE = 0xff1f,
IDX_MARKOV_CLASSIC = 0xff20,
IDX_MARKOV_DISABLE = 0xff21,
IDX_MARKOV_HCSTAT2 = 0xff22,
IDX_MARKOV_THRESHOLD = 't',
IDX_NONCE_ERROR_CORRECTIONS = 0xff1d,
IDX_NVIDIA_SPIN_DAMP = 0xff1e,
IDX_NONCE_ERROR_CORRECTIONS = 0xff23,
IDX_NVIDIA_SPIN_DAMP = 0xff24,
IDX_OPENCL_DEVICES = 'd',
IDX_OPENCL_DEVICE_TYPES = 'D',
IDX_OPENCL_INFO = 'I',
IDX_OPENCL_PLATFORMS = 0xff1f,
IDX_OPENCL_VECTOR_WIDTH = 0xff20,
IDX_OPENCL_PLATFORMS = 0xff25,
IDX_OPENCL_VECTOR_WIDTH = 0xff26,
IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff21,
IDX_OUTFILE_CHECK_DIR = 0xff22,
IDX_OUTFILE_CHECK_TIMER = 0xff23,
IDX_OUTFILE_FORMAT = 0xff24,
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff27,
IDX_OUTFILE_CHECK_DIR = 0xff28,
IDX_OUTFILE_CHECK_TIMER = 0xff29,
IDX_OUTFILE_FORMAT = 0xff2a,
IDX_OUTFILE = 'o',
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff25,
IDX_POTFILE_DISABLE = 0xff26,
IDX_POTFILE_PATH = 0xff27,
IDX_QUIET = 0xff28,
IDX_REMOVE = 0xff29,
IDX_REMOVE_TIMER = 0xff2a,
IDX_RESTORE = 0xff2b,
IDX_RESTORE_DISABLE = 0xff2c,
IDX_RESTORE_FILE_PATH = 0xff2d,
IDX_POTFILE_DISABLE = 0xff2b,
IDX_POTFILE_PATH = 0xff2c,
IDX_PROGRESS_ONLY = 0xff2d,
IDX_QUIET = 0xff2e,
IDX_REMOVE = 0xff2f,
IDX_REMOVE_TIMER = 0xff30,
IDX_RESTORE = 0xff31,
IDX_RESTORE_DISABLE = 0xff32,
IDX_RESTORE_FILE_PATH = 0xff33,
IDX_RP_FILE = 'r',
IDX_RP_GEN_FUNC_MAX = 0xff2e,
IDX_RP_GEN_FUNC_MIN = 0xff2f,
IDX_RP_GEN_FUNC_MAX = 0xff34,
IDX_RP_GEN_FUNC_MIN = 0xff35,
IDX_RP_GEN = 'g',
IDX_RP_GEN_SEED = 0xff30,
IDX_RP_GEN_SEED = 0xff36,
IDX_RULE_BUF_L = 'j',
IDX_RULE_BUF_R = 'k',
IDX_RUNTIME = 0xff31,
IDX_SCRYPT_TMTO = 0xff32,
IDX_SELF_TEST_DISABLE = 0xff33,
IDX_RUNTIME = 0xff37,
IDX_SCRYPT_TMTO = 0xff38,
IDX_SEGMENT_SIZE = 'c',
IDX_SELF_TEST_DISABLE = 0xff39,
IDX_SEPARATOR = 'p',
IDX_SESSION = 0xff34,
IDX_SHOW = 0xff35,
IDX_SESSION = 0xff3a,
IDX_SHOW = 0xff3b,
IDX_SKIP = 's',
IDX_STATUS = 0xff36,
IDX_STATUS_TIMER = 0xff37,
IDX_STDOUT_FLAG = 0xff38,
IDX_SPEED_ONLY = 0xff39,
IDX_PROGRESS_ONLY = 0xff3a,
IDX_TRUECRYPT_KEYFILES = 0xff3b,
IDX_USERNAME = 0xff3c,
IDX_VERACRYPT_KEYFILES = 0xff3d,
IDX_VERACRYPT_PIM = 0xff3e,
IDX_SLOW_CANDIDATES = 'S',
IDX_SPEED_ONLY = 0xff3c,
IDX_STATUS = 0xff3d,
IDX_STATUS_TIMER = 0xff3e,
IDX_STDOUT_FLAG = 0xff3f,
IDX_TRUECRYPT_KEYFILES = 0xff40,
IDX_USERNAME = 0xff41,
IDX_VERACRYPT_KEYFILES = 0xff42,
IDX_VERACRYPT_PIM = 0xff43,
IDX_VERSION_LOWER = 'v',
IDX_VERSION = 'V',
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff44,
IDX_WORKLOAD_PROFILE = 'w',
} user_options_map_t;
@ -898,6 +900,18 @@ typedef struct pw
} pw_t;
typedef struct pw_pre
{
u32 pw_buf[64];
u32 pw_len;
u32 base_buf[64];
u32 base_len;
u32 rule_idx;
} pw_pre_t;
typedef struct pw_idx
{
u32 off;
@ -1051,6 +1065,8 @@ typedef struct hc_device_param
size_t size_pws_amp;
size_t size_pws_comp;
size_t size_pws_idx;
size_t size_pws_pre;
size_t size_pws_base;
size_t size_tmps;
size_t size_hooks;
size_t size_bfs;
@ -1079,6 +1095,12 @@ typedef struct hc_device_param
u32 *pws_comp;
u64 pws_cnt;
pw_pre_t *pws_pre_buf;
u64 pws_pre_cnt;
pw_pre_t *pws_base_buf; // for debug mode
u64 pws_base_cnt;
u64 words_off;
u64 words_done;
@ -1596,20 +1618,20 @@ typedef struct user_options
bool attack_mode_chgd;
bool hash_mode_chgd;
bool hccapx_message_pair_chgd;
bool increment_max_chgd;
bool increment_min_chgd;
bool kernel_accel_chgd;
bool kernel_loops_chgd;
bool nonce_error_corrections_chgd;
bool nvidia_spin_damp_chgd;
bool opencl_vector_width_chgd;
bool outfile_format_chgd;
bool remove_timer_chgd;
bool rp_gen_seed_chgd;
bool runtime_chgd;
bool workload_profile_chgd;
bool segment_size_chgd;
bool hccapx_message_pair_chgd;
bool nonce_error_corrections_chgd;
bool workload_profile_chgd;
bool advice_disable;
bool benchmark;
@ -1632,29 +1654,25 @@ typedef struct user_options
bool opencl_info;
bool optimized_kernel_enable;
bool outfile_autohex;
bool wordlist_autohex_disable;
bool potfile_disable;
bool progress_only;
bool quiet;
bool remove;
bool restore;
bool restore_disable;
bool self_test_disable;
bool show;
bool slow_candidates;
bool speed_only;
bool status;
bool stdout_flag;
bool speed_only;
bool progress_only;
bool usage;
bool username;
bool version;
bool wordlist_autohex_disable;
char *cpu_affinity;
const char *custom_charset_1;
const char *custom_charset_2;
const char *custom_charset_3;
char *custom_charset_4;
char *debug_file;
const char *encoding_from;
const char *encoding_to;
char *induction_dir;
char *markov_hcstat2;
char *opencl_devices;
@ -1665,12 +1683,17 @@ typedef struct user_options
char *potfile_path;
char *restore_file_path;
char **rp_files;
const char *rule_buf_l;
const char *rule_buf_r;
char separator;
const char *session;
char *truecrypt_keyfiles;
char *veracrypt_keyfiles;
const char *custom_charset_1;
const char *custom_charset_2;
const char *custom_charset_3;
const char *encoding_from;
const char *encoding_to;
const char *rule_buf_l;
const char *rule_buf_r;
const char *session;
u32 attack_mode;
u32 bitmap_max;
u32 bitmap_min;

View File

@ -11,6 +11,8 @@
size_t convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const size_t line_len);
void pw_pre_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len, const u8 *base_buf, const int base_len, const int rule_idx);
void pw_base_add (hc_device_param_t *device_param, pw_pre_t *pw_pre);
void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len);
void get_next_word_lm (char *buf, u64 sz, u64 *len, u64 *off);

View File

@ -315,7 +315,7 @@ CFLAGS_CROSS_WIN64_LZMA := $(filter-out $(CFLAGS_REMOVE_LZMA),$(CFLAGS_CROSS_W
## Objects
##
OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md4 cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_sysfs ext_lzma filehandling folder hashcat hashes hlfmt hwmon induct interface locking logfile loopback memory monitor mpsp opencl outfile_check outfile pidfile potfile restore rp rp_cpu rp_kernel_on_cpu rp_kernel_on_cpu_optimized selftest shared status stdout straight terminal thread timer tuningdb usage user_options wordlist
OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md4 cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_sysfs ext_lzma filehandling folder hashcat hashes hlfmt hwmon induct interface locking logfile loopback memory monitor mpsp opencl outfile_check outfile pidfile potfile restore rp rp_cpu rp_kernel_on_cpu rp_kernel_on_cpu_optimized selftest slow_candidates shared status stdout straight terminal thread timer tuningdb usage user_options wordlist
NATIVE_STATIC_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.STATIC.o)
NATIVE_SHARED_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.SHARED.o)

View File

@ -47,6 +47,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
const user_options_t *user_options = hashcat_ctx->user_options;
const double target_msec = opencl_ctx->target_msec;
@ -103,6 +104,11 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if (CL_rc == -1) return -1;
if (user_options->slow_candidates == true)
{
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (straight_ctx->kernel_rules_cnt > 1)
@ -112,6 +118,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if (CL_rc == -1) return -1;
}
}
}
// Do a pre-autotune test run to find out if kernel runtime is above some TDR limit

View File

@ -33,6 +33,11 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
combinator_ctx->enabled = true;
if (user_options->slow_candidates == true)
{
}
else
{
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
if (user_options->attack_mode == ATTACK_MODE_COMBI)
@ -325,6 +330,7 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT;
}
}
}
return 0;
}

View File

@ -15,6 +15,7 @@
#include "filehandling.h"
#include "rp.h"
#include "rp_cpu.h"
#include "slow_candidates.h"
#include "dispatch.h"
static u64 get_lowest_words_done (const hashcat_ctx_t *hashcat_ctx)
@ -145,6 +146,166 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
iconv_tmp = (char *) hcmalloc (HCBUFSIZ_TINY);
}
if (user_options->slow_candidates == true)
{
while (status_ctx->run_thread_level1 == true)
{
hc_thread_mutex_lock (status_ctx->mux_dispatcher);
if (feof (stdin) != 0)
{
hc_thread_mutex_unlock (status_ctx->mux_dispatcher);
break;
}
u64 words_extra_total = 0;
memset (device_param->pws_comp, 0, device_param->size_pws_comp);
memset (device_param->pws_idx, 0, device_param->size_pws_idx);
memset (device_param->pws_pre_buf, 0, device_param->size_pws_pre);
memset (device_param->pws_base_buf, 0, device_param->size_pws_base);
device_param->pws_pre_cnt = 0;
device_param->pws_base_cnt = 0;
while (device_param->pws_pre_cnt < device_param->kernel_power)
{
char *line_buf = fgets (buf, HCBUFSIZ_LARGE - 1, stdin);
if (line_buf == NULL) break;
size_t line_len = in_superchop (line_buf);
line_len = convert_from_hex (hashcat_ctx, line_buf, (u32) line_len);
// do the on-the-fly encoding
if (iconv_enabled == true)
{
char *iconv_ptr = iconv_tmp;
size_t iconv_sz = HCBUFSIZ_TINY;
const size_t iconv_rc = iconv (iconv_ctx, &line_buf, &line_len, &iconv_ptr, &iconv_sz);
if (iconv_rc == (size_t) -1) continue;
line_buf = iconv_tmp;
line_len = HCBUFSIZ_TINY - iconv_sz;
}
// post-process rule engine
char rule_buf_out[RP_PASSWORD_SIZE];
if (run_rule_engine ((int) user_options_extra->rule_len_l, user_options->rule_buf_l))
{
if (line_len >= RP_PASSWORD_SIZE) continue;
memset (rule_buf_out, 0, sizeof (rule_buf_out));
const int rule_len_out = _old_apply_rule (user_options->rule_buf_l, (int) user_options_extra->rule_len_l, line_buf, (int) line_len, rule_buf_out);
if (rule_len_out < 0) continue;
line_buf = rule_buf_out;
line_len = (size_t) rule_len_out;
}
if (line_len >= PW_MAX) continue;
// hmm that's always the case, or?
const u32 attack_kern = user_options_extra->attack_kern;
if (attack_kern == ATTACK_KERN_STRAIGHT)
{
if ((line_len < hashconfig->pw_min) || (line_len > hashconfig->pw_max))
{
words_extra_total++;
continue;
}
}
pw_pre_add (device_param, (u8 *) line_buf, (int) line_len, NULL, 0, 0);
while (status_ctx->run_thread_level1 == false) break;
}
hc_thread_mutex_unlock (status_ctx->mux_dispatcher);
u64 pre_rejects = 0;
if (0)
{
}
else
{
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + pws_pre_idx;
pw_base_add (device_param, pw_pre);
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
}
words_extra_total += pre_rejects;
if (words_extra_total > 0)
{
hc_thread_mutex_lock (status_ctx->mux_counter);
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
status_ctx->words_progress_rejected[salt_pos] += words_extra_total * straight_ctx->kernel_rules_cnt;
}
hc_thread_mutex_unlock (status_ctx->mux_counter);
}
if (status_ctx->run_thread_level1 == false) break;
if (device_param->pws_cnt)
{
// flush
int CL_rc;
CL_rc = run_copy (hashcat_ctx, device_param, device_param->pws_cnt);
if (CL_rc == -1)
{
hcfree (buf);
return -1;
}
CL_rc = run_cracker (hashcat_ctx, device_param, device_param->pws_cnt);
if (CL_rc == -1)
{
hcfree (buf);
return -1;
}
device_param->pws_cnt = 0;
device_param->pws_base_cnt = 0;
}
if (status_ctx->run_thread_level1 == false) break;
if (device_param->speed_only_finish == true) break;
}
}
else
{
while (status_ctx->run_thread_level1 == true)
{
hc_thread_mutex_lock (status_ctx->mux_dispatcher);
@ -220,7 +381,7 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
}
}
pw_add (device_param, (u8 *) line_buf, (int) line_len);
pw_add (device_param, (const u8 *) line_buf, (const int) line_len);
while (status_ctx->run_thread_level1 == false) break;
}
@ -277,6 +438,13 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
device_param->kernel_accel = 0;
device_param->kernel_loops = 0;
}
device_param->kernel_accel_prev = device_param->kernel_accel;
device_param->kernel_loops_prev = device_param->kernel_loops;
device_param->kernel_accel = 0;
device_param->kernel_loops = 0;
if (iconv_enabled == true)
{
@ -322,6 +490,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
@ -329,6 +498,360 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
const u32 attack_mode = user_options->attack_mode;
const u32 attack_kern = user_options_extra->attack_kern;
if (user_options->slow_candidates == true)
{
// attack modes from here
if (attack_mode == ATTACK_MODE_BF)
{
extra_info_mask_t extra_info_mask;
memset (&extra_info_mask, 0, sizeof (extra_info_mask));
extra_info_mask.out_len = mask_ctx->css_cnt;
u64 words_cur = 0;
while (status_ctx->run_thread_level1 == true)
{
u64 words_fin = 0;
memset (device_param->pws_comp, 0, device_param->size_pws_comp);
memset (device_param->pws_idx, 0, device_param->size_pws_idx);
u64 pre_rejects = -1u;
while (pre_rejects)
{
u64 words_extra_total = 0;
u64 words_extra = pre_rejects;
pre_rejects = 0;
memset (device_param->pws_pre_buf, 0, device_param->size_pws_pre);
device_param->pws_pre_cnt = 0;
while (words_extra)
{
const u64 work = get_work (hashcat_ctx, device_param, words_extra);
if (work == 0) break;
words_extra = 0;
u64 words_off = device_param->words_off;
words_fin = words_off + work;
words_cur = words_off;
for (u64 i = words_cur; i < words_fin; i++)
{
extra_info_mask.pos = i;
slow_candidates_next (hashcat_ctx, &extra_info_mask);
pw_pre_add (device_param, extra_info_mask.out_buf, extra_info_mask.out_len, NULL, 0, 0);
if (status_ctx->run_thread_level1 == false) break;
}
words_cur = words_fin;
words_extra_total += words_extra;
if (status_ctx->run_thread_level1 == false) break;
}
if (0)
{
}
else
{
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + pws_pre_idx;
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
}
words_extra_total += pre_rejects;
if (status_ctx->run_thread_level1 == false) break;
if (words_extra_total > 0)
{
hc_thread_mutex_lock (status_ctx->mux_counter);
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
status_ctx->words_progress_rejected[salt_pos] += words_extra_total;
}
hc_thread_mutex_unlock (status_ctx->mux_counter);
}
}
//
// flush
//
const u64 pws_cnt = device_param->pws_cnt;
if (pws_cnt)
{
int CL_rc;
CL_rc = run_copy (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1)
{
return -1;
}
CL_rc = run_cracker (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1)
{
return -1;
}
device_param->pws_cnt = 0;
}
if (device_param->speed_only_finish == true) break;
if (status_ctx->run_thread_level2 == true)
{
device_param->words_done = words_fin;
status_ctx->words_cur = get_lowest_words_done (hashcat_ctx);
}
if (status_ctx->run_thread_level1 == false) break;
if (words_fin == 0) break;
}
}
else if (attack_mode == ATTACK_MODE_STRAIGHT)
{
char *dictfile = straight_ctx->dict;
FILE *fd = fopen (dictfile, "rb");
if (fd == NULL)
{
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
return -1;
}
hashcat_ctx_t *hashcat_ctx_tmp = (hashcat_ctx_t *) hcmalloc (sizeof (hashcat_ctx_t));
memcpy (hashcat_ctx_tmp, hashcat_ctx, sizeof (hashcat_ctx_t)); // yes we actually want to copy these pointers
hashcat_ctx_tmp->wl_data = (wl_data_t *) hcmalloc (sizeof (wl_data_t));
const int rc_wl_data_init = wl_data_init (hashcat_ctx_tmp);
if (rc_wl_data_init == -1)
{
fclose (fd);
hcfree (hashcat_ctx_tmp->wl_data);
hcfree (hashcat_ctx_tmp);
return -1;
}
extra_info_straight_t extra_info_straight;
memset (&extra_info_straight, 0, sizeof (extra_info_straight));
extra_info_straight.fd = fd;
u64 words_cur = 0;
while (status_ctx->run_thread_level1 == true)
{
u64 words_fin = 0;
memset (device_param->pws_comp, 0, device_param->size_pws_comp);
memset (device_param->pws_idx, 0, device_param->size_pws_idx);
memset (device_param->pws_base_buf, 0, device_param->size_pws_base);
u64 pre_rejects = -1u;
while (pre_rejects)
{
u64 words_extra_total = 0;
u64 words_extra = pre_rejects;
pre_rejects = 0;
memset (device_param->pws_pre_buf, 0, device_param->size_pws_pre);
device_param->pws_pre_cnt = 0;
while (words_extra)
{
const u64 work = get_work (hashcat_ctx, device_param, words_extra);
if (work == 0) break;
words_extra = 0;
u64 words_off = device_param->words_off;
words_fin = words_off + work;
slow_candidates_seek (hashcat_ctx_tmp, &extra_info_straight, words_cur, words_off);
words_cur = words_off;
for (u64 i = words_cur; i < words_fin; i++)
{
slow_candidates_next (hashcat_ctx_tmp, &extra_info_straight);
if (attack_kern == ATTACK_KERN_STRAIGHT)
{
if ((extra_info_straight.out_len < hashconfig->pw_min) || (extra_info_straight.out_len > hashconfig->pw_max))
{
words_extra++;
continue;
}
}
else if (attack_kern == ATTACK_KERN_COMBI)
{
if ((extra_info_straight.out_len < hashconfig->pw_min) || (extra_info_straight.out_len > hashconfig->pw_max))
{
words_extra++;
continue;
}
}
pw_pre_add (device_param, extra_info_straight.out_buf, extra_info_straight.out_len, extra_info_straight.base_buf, extra_info_straight.base_len, extra_info_straight.rule_pos_prev);
if (status_ctx->run_thread_level1 == false) break;
}
words_cur = words_fin;
words_extra_total += words_extra;
if (status_ctx->run_thread_level1 == false) break;
}
if (0)
{
}
else
{
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + pws_pre_idx;
pw_base_add (device_param, pw_pre);
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
}
words_extra_total += pre_rejects;
if (status_ctx->run_thread_level1 == false) break;
if (words_extra_total > 0)
{
hc_thread_mutex_lock (status_ctx->mux_counter);
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
status_ctx->words_progress_rejected[salt_pos] += words_extra_total;
}
hc_thread_mutex_unlock (status_ctx->mux_counter);
}
}
//
// flush
//
const u64 pws_cnt = device_param->pws_cnt;
if (pws_cnt)
{
int CL_rc;
CL_rc = run_copy (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1)
{
fclose (fd);
hcfree (hashcat_ctx_tmp->wl_data);
hcfree (hashcat_ctx_tmp);
return -1;
}
CL_rc = run_cracker (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1)
{
fclose (fd);
hcfree (hashcat_ctx_tmp->wl_data);
hcfree (hashcat_ctx_tmp);
return -1;
}
device_param->pws_cnt = 0;
device_param->pws_base_cnt = 0;
}
if (device_param->speed_only_finish == true) break;
if (status_ctx->run_thread_level2 == true)
{
device_param->words_done = words_fin;
status_ctx->words_cur = get_lowest_words_done (hashcat_ctx);
}
if (status_ctx->run_thread_level1 == false) break;
if (words_fin == 0) break;
}
fclose (fd);
wl_data_destroy (hashcat_ctx_tmp);
hcfree (hashcat_ctx_tmp->wl_data);
hcfree (hashcat_ctx_tmp);
}
}
else
{
if ((attack_mode == ATTACK_MODE_BF) || (((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) && (attack_mode == ATTACK_MODE_HYBRID2)))
{
if (((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) && (attack_mode == ATTACK_MODE_HYBRID2))
@ -378,8 +901,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
status_ctx->words_cur = get_lowest_words_done (hashcat_ctx);
}
if (status_ctx->run_thread_level1 == false) break;
}
}
else
@ -442,32 +963,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
hashcat_ctx_t *hashcat_ctx_tmp = (hashcat_ctx_t *) hcmalloc (sizeof (hashcat_ctx_t));
/*
hashcat_ctx_tmp->bitmap_ctx = hashcat_ctx->bitmap_ctx;
hashcat_ctx_tmp->combinator_ctx = hashcat_ctx->combinator_ctx;
hashcat_ctx_tmp->cpt_ctx = hashcat_ctx->cpt_ctx;
hashcat_ctx_tmp->debugfile_ctx = hashcat_ctx->debugfile_ctx;
hashcat_ctx_tmp->dictstat_ctx = hashcat_ctx->dictstat_ctx;
hashcat_ctx_tmp->folder_config = hashcat_ctx->folder_config;
hashcat_ctx_tmp->hashconfig = hashcat_ctx->hashconfig;
hashcat_ctx_tmp->hashes = hashcat_ctx->hashes;
hashcat_ctx_tmp->hwmon_ctx = hashcat_ctx->hwmon_ctx;
hashcat_ctx_tmp->induct_ctx = hashcat_ctx->induct_ctx;
hashcat_ctx_tmp->logfile_ctx = hashcat_ctx->logfile_ctx;
hashcat_ctx_tmp->loopback_ctx = hashcat_ctx->loopback_ctx;
hashcat_ctx_tmp->mask_ctx = hashcat_ctx->mask_ctx;
hashcat_ctx_tmp->opencl_ctx = hashcat_ctx->opencl_ctx;
hashcat_ctx_tmp->outcheck_ctx = hashcat_ctx->outcheck_ctx;
hashcat_ctx_tmp->outfile_ctx = hashcat_ctx->outfile_ctx;
hashcat_ctx_tmp->potfile_ctx = hashcat_ctx->potfile_ctx;
hashcat_ctx_tmp->restore_ctx = hashcat_ctx->restore_ctx;
hashcat_ctx_tmp->status_ctx = hashcat_ctx->status_ctx;
hashcat_ctx_tmp->straight_ctx = hashcat_ctx->straight_ctx;
hashcat_ctx_tmp->tuning_db = hashcat_ctx->tuning_db;
hashcat_ctx_tmp->user_options_extra = hashcat_ctx->user_options_extra;
hashcat_ctx_tmp->user_options = hashcat_ctx->user_options;
*/
memcpy (hashcat_ctx_tmp, hashcat_ctx, sizeof (hashcat_ctx_t)); // yes we actually want to copy these pointers
hashcat_ctx_tmp->wl_data = (wl_data_t *) hcmalloc (sizeof (wl_data_t));
@ -563,7 +1058,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
}
}
pw_add (device_param, (u8 *) line_buf, (int) line_len);
pw_add (device_param, (const u8 *) line_buf, (const int) line_len);
if (status_ctx->run_thread_level1 == false) break;
}
@ -641,34 +1136,24 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (attack_kern == ATTACK_KERN_STRAIGHT)
{
CL_rc = run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
if (CL_rc == -1)
{
if (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp);
fclose (fd);
hcfree (hashcat_ctx_tmp->wl_data);
hcfree (hashcat_ctx_tmp);
return -1;
}
}
else if (attack_kern == ATTACK_KERN_COMBI)
{
CL_rc = run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
if (CL_rc == -1)
{
if (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp);
fclose (fd);
hcfree (hashcat_ctx_tmp->wl_data);
hcfree (hashcat_ctx_tmp);
return -1;
}
}
@ -699,6 +1184,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
hcfree (hashcat_ctx_tmp);
}
}
device_param->kernel_accel_prev = device_param->kernel_accel;
device_param->kernel_loops_prev = device_param->kernel_loops;

View File

@ -51,8 +51,7 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->usage == true) return 0;
if (user_options->version == true) return 0;
if (user_options->attack_mode == ATTACK_MODE_BF) return 0;
if (user_options->attack_mode == ATTACK_MODE_COMBI) return 0;
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT) return 0;
induct_ctx->enabled = true;

View File

@ -27322,11 +27322,11 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
char source_file[256] = { 0 };
generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, false, folder_config->shared_dir, source_file);
generate_source_kernel_filename (user_options->slow_candidates, hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, false, folder_config->shared_dir, source_file);
hashconfig->has_pure_kernel = hc_path_read (source_file);
generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, true, folder_config->shared_dir, source_file);
generate_source_kernel_filename (user_options->slow_candidates, hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, true, folder_config->shared_dir, source_file);
hashconfig->has_optimized_kernel = hc_path_read (source_file);
@ -27730,6 +27730,11 @@ u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx)
u32 kernel_loops_fixed = 0;
if (user_options->slow_candidates == true)
{
}
else
{
if (hashconfig->hash_mode == 1500 && user_options->attack_mode == ATTACK_MODE_BF)
{
kernel_loops_fixed = 1024;
@ -27740,6 +27745,17 @@ u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx)
kernel_loops_fixed = 1024;
}
if (hashconfig->hash_mode == 14000 && user_options->attack_mode == ATTACK_MODE_BF)
{
kernel_loops_fixed = 1024;
}
if (hashconfig->hash_mode == 14100 && user_options->attack_mode == ATTACK_MODE_BF)
{
kernel_loops_fixed = 1024;
}
}
if (hashconfig->hash_mode == 8900)
{
kernel_loops_fixed = 1;
@ -27755,16 +27771,6 @@ u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx)
kernel_loops_fixed = ROUNDS_RAR3 / 16;
}
if (hashconfig->hash_mode == 14000 && user_options->attack_mode == ATTACK_MODE_BF)
{
kernel_loops_fixed = 1024;
}
if (hashconfig->hash_mode == 14100 && user_options->attack_mode == ATTACK_MODE_BF)
{
kernel_loops_fixed = 1024;
}
if (hashconfig->hash_mode == 15700)
{
kernel_loops_fixed = 1;
@ -27827,6 +27833,12 @@ int hashconfig_get_pw_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_kern
#define PW_DICTMAX 31
if ((user_options->rp_files_cnt > 0) || (user_options->rp_gen > 0))
{
if (user_options->slow_candidates == true)
{
pw_max = MIN (pw_max, PW_DICTMAX);
}
else
{
switch (user_options_extra->attack_kern)
{
@ -27836,6 +27848,20 @@ int hashconfig_get_pw_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_kern
break;
}
}
}
else
{
if (user_options->slow_candidates == true)
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
pw_max = MIN (pw_max, PW_DICTMAX);
}
else
{
// If we have a NOOP rule then we can process words from wordlists > PW_DICTMAX for slow hashes
}
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
@ -27853,6 +27879,7 @@ int hashconfig_get_pw_max (hashcat_ctx_t *hashcat_ctx, const bool optimized_kern
// If we have a NOOP rule then we can process words from wordlists > PW_DICTMAX for slow hashes
}
}
}
switch (hashconfig->hash_mode)
{

View File

@ -39,10 +39,17 @@ static void mp_css_split_cnt (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_orig
{
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
const user_options_t *user_options = hashcat_ctx->user_options;
u32 css_cnt_l = mask_ctx->css_cnt;
u32 css_cnt_r;
if (user_options->slow_candidates == true)
{
css_cnt_r = 0;
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (css_cnt_orig < 6)
@ -96,6 +103,7 @@ static void mp_css_split_cnt (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_orig
}
*/
}
}
css_cnt_l -= css_cnt_r;

View File

@ -332,11 +332,17 @@ static int write_kernel_binary (hashcat_ctx_t *hashcat_ctx, char *kernel_file, c
return 0;
}
void generate_source_kernel_filename (const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *shared_dir, char *source_file)
void generate_source_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *shared_dir, char *source_file)
{
if (opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
if (attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (slow_candidates == true)
{
snprintf (source_file, 255, "%s/OpenCL/m%05d_a0-optimized.cl", shared_dir, (int) kern_type);
}
else
{
if (attack_kern == ATTACK_KERN_STRAIGHT)
snprintf (source_file, 255, "%s/OpenCL/m%05d_a0-optimized.cl", shared_dir, (int) kern_type);
@ -347,6 +353,7 @@ void generate_source_kernel_filename (const u32 attack_exec, const u32 attack_ke
else if (attack_kern == ATTACK_KERN_NONE)
snprintf (source_file, 255, "%s/OpenCL/m%05d_a0-optimized.cl", shared_dir, (int) kern_type);
}
}
else
{
snprintf (source_file, 255, "%s/OpenCL/m%05d-optimized.cl", shared_dir, (int) kern_type);
@ -355,6 +362,12 @@ void generate_source_kernel_filename (const u32 attack_exec, const u32 attack_ke
else
{
if (attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (slow_candidates == true)
{
snprintf (source_file, 255, "%s/OpenCL/m%05d_a0-pure.cl", shared_dir, (int) kern_type);
}
else
{
if (attack_kern == ATTACK_KERN_STRAIGHT)
snprintf (source_file, 255, "%s/OpenCL/m%05d_a0-pure.cl", shared_dir, (int) kern_type);
@ -365,6 +378,7 @@ void generate_source_kernel_filename (const u32 attack_exec, const u32 attack_ke
else if (attack_kern == ATTACK_KERN_NONE)
snprintf (source_file, 255, "%s/OpenCL/m%05d_a0-pure.cl", shared_dir, (int) kern_type);
}
}
else
{
snprintf (source_file, 255, "%s/OpenCL/m%05d-pure.cl", shared_dir, (int) kern_type);
@ -372,11 +386,17 @@ void generate_source_kernel_filename (const u32 attack_exec, const u32 attack_ke
}
}
void generate_cached_kernel_filename (const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *profile_dir, const char *device_name_chksum, char *cached_file)
void generate_cached_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *profile_dir, const char *device_name_chksum, char *cached_file)
{
if (opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
if (attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (slow_candidates == true)
{
snprintf (cached_file, 255, "%s/kernels/m%05d_a0-optimized.%s.kernel", profile_dir, (int) kern_type, device_name_chksum);
}
else
{
if (attack_kern == ATTACK_KERN_STRAIGHT)
snprintf (cached_file, 255, "%s/kernels/m%05d_a0-optimized.%s.kernel", profile_dir, (int) kern_type, device_name_chksum);
@ -387,6 +407,7 @@ void generate_cached_kernel_filename (const u32 attack_exec, const u32 attack_ke
else if (attack_kern == ATTACK_KERN_NONE)
snprintf (cached_file, 255, "%s/kernels/m%05d_a0-optimized.%s.kernel", profile_dir, (int) kern_type, device_name_chksum);
}
}
else
{
snprintf (cached_file, 255, "%s/kernels/m%05d-optimized.%s.kernel", profile_dir, (int) kern_type, device_name_chksum);
@ -395,6 +416,12 @@ void generate_cached_kernel_filename (const u32 attack_exec, const u32 attack_ke
else
{
if (attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (slow_candidates == true)
{
snprintf (cached_file, 255, "%s/kernels/m%05d_a0-pure.%s.kernel", profile_dir, (int) kern_type, device_name_chksum);
}
else
{
if (attack_kern == ATTACK_KERN_STRAIGHT)
snprintf (cached_file, 255, "%s/kernels/m%05d_a0-pure.%s.kernel", profile_dir, (int) kern_type, device_name_chksum);
@ -405,6 +432,7 @@ void generate_cached_kernel_filename (const u32 attack_exec, const u32 attack_ke
else if (attack_kern == ATTACK_KERN_NONE)
snprintf (cached_file, 255, "%s/kernels/m%05d_a0-pure.%s.kernel", profile_dir, (int) kern_type, device_name_chksum);
}
}
else
{
snprintf (cached_file, 255, "%s/kernels/m%05d-pure.%s.kernel", profile_dir, (int) kern_type, device_name_chksum);
@ -1192,6 +1220,11 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (user_options->attack_mode == ATTACK_MODE_BF)
{
if (user_options->slow_candidates == true)
{
}
else
{
if (hashconfig->opts_type & OPTS_TYPE_PT_BITSLICE)
{
@ -1210,6 +1243,7 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
if (CL_rc == -1) return -1;
}
}
}
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
@ -1251,9 +1285,15 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
if (CL_rc == -1) return -1;
if (user_options->slow_candidates == true)
{
}
else
{
CL_rc = run_kernel_amp (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1) return -1;
}
CL_rc = run_kernel (hashcat_ctx, device_param, KERN_RUN_1, pws_cnt, false, 0);
@ -2053,6 +2093,31 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const
}
#endif
if (user_options->slow_candidates == true)
{
int CL_rc;
CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_idx, CL_TRUE, 0, pws_cnt * sizeof (pw_idx_t), device_param->pws_idx, 0, NULL, NULL);
if (CL_rc == -1) return -1;
const pw_idx_t *pw_idx = device_param->pws_idx + pws_cnt;
const u32 off = pw_idx->off;
if (off)
{
CL_rc = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_comp_buf, CL_TRUE, 0, off * sizeof (u32), device_param->pws_comp, 0, NULL, NULL);
if (CL_rc == -1) return -1;
}
CL_rc = run_kernel_decompress (hashcat_ctx, device_param, pws_cnt);
if (CL_rc == -1) return -1;
}
else
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
int CL_rc;
@ -2197,6 +2262,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const
if (CL_rc == -1) return -1;
}
}
return 0;
}
@ -2216,6 +2282,19 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
u32 highest_pw_len = 0;
if (user_options->slow_candidates == true)
{
/*
for (u64 pws_idx = 0; pws_idx < pws_cnt; pws_idx++)
{
pw_idx_t *pw_idx = device_param->pws_idx + pws_idx;
highest_pw_len = MAX (highest_pw_len, pw_idx->len);
}
*/
}
else
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
}
@ -2227,6 +2306,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
highest_pw_len = device_param->kernel_params_mp_l_buf32[4]
+ device_param->kernel_params_mp_l_buf32[5];
}
}
// we make use of this in status view
@ -2249,22 +2329,36 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
FILE *combs_fp = device_param->combs_fp;
if (user_options->slow_candidates == true)
{
}
else
{
if ((user_options->attack_mode == ATTACK_MODE_COMBI) || (((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) && (user_options->attack_mode == ATTACK_MODE_HYBRID2)))
{
rewind (combs_fp);
}
}
// iteration type
u32 innerloop_step = 0;
u32 innerloop_cnt = 0;
if (user_options->slow_candidates == true)
{
innerloop_step = 1;
innerloop_cnt = 1;
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) innerloop_step = device_param->kernel_loops;
else innerloop_step = 1;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = (u32) straight_ctx->kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = (u32) combinator_ctx->combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = (u32) mask_ctx->bfs_cnt;
}
// innerloops
@ -2303,6 +2397,11 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
// initialize and copy amplifiers
if (user_options->slow_candidates == true)
{
}
else
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
const int CL_rc = hc_clEnqueueCopyBuffer (hashcat_ctx, device_param->command_queue, device_param->d_rules, device_param->d_rules_c, innerloop_pos * sizeof (kernel_rule_t), 0, innerloop_left * sizeof (kernel_rule_t), 0, NULL, NULL);
@ -2548,6 +2647,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
if (CL_rc == -1) return -1;
}
}
const int rc = choose_kernel (hashcat_ctx, device_param, highest_pw_len, pws_cnt, fast_iteration, salt_pos);
@ -3917,6 +4017,7 @@ void opencl_ctx_devices_kernel_loops (hashcat_ctx_t *hashcat_ctx)
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
if (opencl_ctx->enabled == false) return;
@ -3935,11 +4036,18 @@ void opencl_ctx_devices_kernel_loops (hashcat_ctx_t *hashcat_ctx)
u32 innerloop_cnt = 0;
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (user_options->slow_candidates == true)
{
innerloop_cnt = 1;
}
else
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = MIN (KERNEL_RULES, (u32) straight_ctx->kernel_rules_cnt);
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = MIN (KERNEL_COMBS, (u32) combinator_ctx->combs_cnt);
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = MIN (KERNEL_BFS, (u32) mask_ctx->bfs_cnt);
}
}
else
{
innerloop_cnt = hashes->salts_buf[0].salt_iter;
@ -4045,7 +4153,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
{
opencl_ctx->force_jit_compilation = 15700;
}
else if (hashconfig->hash_mode == 1500 && user_options->attack_mode == ATTACK_MODE_BF && hashes->salts_cnt == 1)
else if (hashconfig->hash_mode == 1500 && user_options->attack_mode == ATTACK_MODE_BF && hashes->salts_cnt == 1 && user_options->slow_candidates == false)
{
opencl_ctx->force_jit_compilation = 1500;
}
@ -4109,7 +4217,16 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
{
// tuning db
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);
tuning_db_entry_t *tuningdb_entry;
if (user_options->slow_candidates == true)
{
tuningdb_entry = tuning_db_search (hashcat_ctx, device_param->device_name, device_param->device_type, 0, hashconfig->hash_mode);
}
else
{
tuningdb_entry = tuning_db_search (hashcat_ctx, device_param->device_name, device_param->device_type, user_options->attack_mode, hashconfig->hash_mode);
}
if (tuningdb_entry == NULL || tuningdb_entry->vector_width == -1)
{
@ -4162,7 +4279,16 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->kernel_loops_min = 1;
device_param->kernel_loops_max = 1024;
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);
tuning_db_entry_t *tuningdb_entry;
if (user_options->slow_candidates == true)
{
tuningdb_entry = tuning_db_search (hashcat_ctx, device_param->device_name, device_param->device_type, 0, hashconfig->hash_mode);
}
else
{
tuningdb_entry = tuning_db_search (hashcat_ctx, device_param->device_name, device_param->device_type, user_options->attack_mode, hashconfig->hash_mode);
}
if (tuningdb_entry != NULL)
{
@ -4216,6 +4342,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->kernel_accel_max = MIN (device_param->kernel_accel_max, SCRYPT_MAX_ACCEL);
}
if (user_options->slow_candidates == true)
{
}
else
{
// we have some absolute limits for fast hashes (because of limit constant memory), make sure not to overstep
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
@ -4236,6 +4367,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->kernel_loops_max = MIN (device_param->kernel_loops_max, KERNEL_BFS);
}
}
}
/**
* device properties
@ -4700,7 +4832,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
char source_file[256] = { 0 };
generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, hashconfig->opti_type, folder_config->shared_dir, source_file);
generate_source_kernel_filename (user_options->slow_candidates, hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, hashconfig->opti_type, folder_config->shared_dir, source_file);
if (hc_path_read (source_file) == false)
{
@ -4715,7 +4847,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
char cached_file[256] = { 0 };
generate_cached_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, hashconfig->opti_type, folder_config->profile_dir, device_name_chksum, cached_file);
generate_cached_kernel_filename (user_options->slow_candidates, hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, hashconfig->opti_type, folder_config->profile_dir, device_name_chksum, cached_file);
bool cached = true;
@ -4897,6 +5029,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
* word generator kernel
*/
if (user_options->slow_candidates == true)
{
}
else
{
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT)
{
/**
@ -5029,11 +5166,17 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
hcfree (kernel_sources[0]);
}
}
/**
* amplifier kernel
*/
if (user_options->slow_candidates == true)
{
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
@ -5170,6 +5313,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
hcfree (kernel_sources[0]);
}
}
hcfree (device_name_chksum);
hcfree (device_name_chksum_amp_mp);
@ -5223,6 +5367,12 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
* special buffers
*/
if (user_options->slow_candidates == true)
{
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_rules_c, NULL, &device_param->d_rules_c); if (CL_rc == -1) return -1;
}
else
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_rules, NULL, &device_param->d_rules); if (CL_rc == -1) return -1;
@ -5245,6 +5395,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_root_css, NULL, &device_param->d_root_css_buf); if (CL_rc == -1) return -1;
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_ONLY, size_markov_css, NULL, &device_param->d_markov_css_buf); if (CL_rc == -1) return -1;
}
}
if (size_esalts)
{
@ -5326,6 +5477,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->kernel_params[33] = &device_param->kernel_params_buf32[33];
device_param->kernel_params[34] = &device_param->kernel_params_buf64[34];
if (user_options->slow_candidates == true)
{
}
else
{
device_param->kernel_params_mp_buf64[3] = 0;
device_param->kernel_params_mp_buf32[4] = 0;
device_param->kernel_params_mp_buf32[5] = 0;
@ -5411,6 +5567,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->kernel_params_tm[0] = &device_param->d_bfs_c;
device_param->kernel_params_tm[1] = &device_param->d_tm_c;
}
device_param->kernel_params_memset_buf32[1] = 0; // value
device_param->kernel_params_memset_buf64[2] = 0; // gid_max
@ -5612,6 +5769,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
}
}
if (user_options->slow_candidates == true)
{
}
else
{
if (user_options->attack_mode == ATTACK_MODE_BF)
{
if (hashconfig->opts_type & OPTS_TYPE_PT_BITSLICE)
@ -5636,6 +5798,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
}
}
}
}
else
{
// kernel1
@ -5951,6 +6114,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
// MP start
if (user_options->slow_candidates == true)
{
}
else
{
if (user_options->attack_mode == ATTACK_MODE_BF)
{
// mp_l
@ -6031,7 +6199,13 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (CL_rc == -1) return -1;
}
}
if (user_options->slow_candidates == true)
{
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
// nothing to do
@ -6082,6 +6256,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (CL_rc == -1) return -1;
}
}
}
// zero some data buffers
@ -6093,6 +6268,12 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
* special buffers
*/
if (user_options->slow_candidates == true)
{
CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_rules_c, size_rules_c); if (CL_rc == -1) return -1;
}
else
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_rules_c, size_rules_c); if (CL_rc == -1) return -1;
@ -6112,7 +6293,13 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_root_css_buf, size_root_css); if (CL_rc == -1) return -1;
CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_markov_css_buf, size_markov_css); if (CL_rc == -1) return -1;
}
}
if (user_options->slow_candidates == true)
{
}
else
{
if ((user_options->attack_mode == ATTACK_MODE_HYBRID1) || (user_options->attack_mode == ATTACK_MODE_HYBRID2))
{
/**
@ -6157,6 +6344,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
for (u32 i = 0; i < 3; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_l, i, sizeof (cl_mem), device_param->kernel_params_mp_l[i]); if (CL_rc == -1) return -1; }
for (u32 i = 0; i < 3; i++) { CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_mp_r, i, sizeof (cl_mem), device_param->kernel_params_mp_r[i]); if (CL_rc == -1) return -1; }
}
}
/**
* now everything that depends on threads and accel, basically dynamic workload
@ -6177,6 +6365,8 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
size_t size_pws_amp = 4;
size_t size_pws_comp = 4;
size_t size_pws_idx = 4;
size_t size_pws_pre = 4;
size_t size_pws_base = 4;
size_t size_tmps = 4;
size_t size_hooks = 4;
@ -6217,6 +6407,17 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
size_hooks = (size_t) kernel_power_max * hashconfig->hook_size;
if (user_options->slow_candidates == true)
{
// size_pws_pre
size_pws_pre = (size_t) kernel_power_max * sizeof (pw_pre_t);
// size_pws_base
size_pws_base = (size_t) kernel_power_max * sizeof (pw_pre_t);
}
// now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
// if not, decrease amplifier and try again
@ -6266,6 +6467,15 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if ((size_total + EXTRA_SPACE) > device_param->device_available_mem) memory_limit_hit = 1;
const size_t size_total_host
= size_pws_comp
+ size_pws_idx
+ size_hooks
+ size_pws_pre
+ size_pws_base;
if ((size_total_host + EXTRA_SPACE) > device_param->device_maxmem_alloc) memory_limit_hit = 1;
if (memory_limit_hit == 1)
{
kernel_accel_max--;
@ -6290,6 +6500,8 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->size_pws_amp = size_pws_amp;
device_param->size_pws_comp = size_pws_comp;
device_param->size_pws_idx = size_pws_idx;
device_param->size_pws_pre = size_pws_pre;
device_param->size_pws_base = size_pws_base;
device_param->size_tmps = size_tmps;
device_param->size_hooks = size_hooks;
@ -6331,6 +6543,14 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->scratch_buf = scratch_buf;
pw_pre_t *pws_pre_buf = (pw_pre_t *) hcmalloc (size_pws_pre);
device_param->pws_pre_buf = pws_pre_buf;
pw_pre_t *pws_base_buf = (pw_pre_t *) hcmalloc (size_pws_base);
device_param->pws_base_buf = pws_base_buf;
/**
* kernel args
*/
@ -6339,6 +6559,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->kernel_params[ 4] = &device_param->d_tmps;
device_param->kernel_params[ 5] = &device_param->d_hooks;
if (user_options->slow_candidates == true)
{
}
else
{
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
// nothing to do
@ -6376,7 +6601,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_amp, 0, sizeof (cl_mem), device_param->kernel_params_amp[0]); if (CL_rc == -1) return -1;
CL_rc = hc_clSetKernelArg (hashcat_ctx, device_param->kernel_amp, 1, sizeof (cl_mem), device_param->kernel_params_amp[1]); if (CL_rc == -1) return -1;
}
}
device_param->kernel_params_decompress[0] = &device_param->d_pws_idx;
device_param->kernel_params_decompress[1] = &device_param->d_pws_comp_buf;
@ -6432,6 +6657,8 @@ void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx)
hcfree (device_param->pws_comp);
hcfree (device_param->pws_idx);
hcfree (device_param->pws_pre_buf);
hcfree (device_param->pws_base_buf);
hcfree (device_param->combs_buf);
hcfree (device_param->hooks_buf);
hcfree (device_param->scratch_buf);
@ -6504,6 +6731,8 @@ void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx)
device_param->pws_comp = NULL;
device_param->pws_idx = NULL;
device_param->pws_pre_buf = NULL;
device_param->pws_base_buf = NULL;
device_param->combs_buf = NULL;
device_param->hooks_buf = NULL;
@ -6626,6 +6855,7 @@ int opencl_session_update_combinator (hashcat_ctx_t *hashcat_ctx)
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
if (opencl_ctx->enabled == false) return 0;
@ -6655,6 +6885,11 @@ int opencl_session_update_combinator (hashcat_ctx_t *hashcat_ctx)
// kernel_params_amp
if (user_options->slow_candidates == true)
{
}
else
{
device_param->kernel_params_amp_buf32[5] = combinator_ctx->combs_mode;
if (hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
@ -6666,6 +6901,7 @@ int opencl_session_update_combinator (hashcat_ctx_t *hashcat_ctx)
if (CL_rc == -1) return -1;
}
}
}
return 0;
}
@ -6674,9 +6910,12 @@ int opencl_session_update_mp (hashcat_ctx_t *hashcat_ctx)
{
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
if (opencl_ctx->enabled == false) return 0;
if (user_options->slow_candidates == true) return 0;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
@ -6702,9 +6941,12 @@ int opencl_session_update_mp_rl (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_l
{
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
if (opencl_ctx->enabled == false) return 0;
if (user_options->slow_candidates == true) return 0;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];

View File

@ -35,6 +35,20 @@ int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
u8 *plain_ptr = (u8 *) plain_buf;
if (user_options->slow_candidates == true)
{
pw_t pw;
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
if (rc == -1) return -1;
memcpy (plain_buf, pw.i, pw.pw_len);
plain_len = pw.pw_len;
}
else
{
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
pw_t pw;
@ -221,6 +235,7 @@ int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
}
}
}
}
const u32 pw_max = hashconfig_get_pw_max (hashcat_ctx, false);
@ -238,6 +253,7 @@ int build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
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_t *user_options = hashcat_ctx->user_options;
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
const u64 gidvid = plain->gidvid;
@ -245,6 +261,12 @@ int build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
u64 crackpos = device_param->words_off;
if (user_options->slow_candidates == true)
{
crackpos = gidvid;
}
else
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
crackpos += gidvid;
@ -263,6 +285,7 @@ int build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
crackpos *= mask_ctx->bfs_cnt;
crackpos += device_param->innerloop_pos + il_pos;
}
}
*out_pos = crackpos;
@ -284,6 +307,32 @@ int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if (debug_mode == 0) return 0;
if (user_options->slow_candidates == true)
{
pw_pre_t *pw_base = device_param->pws_base_buf + gidvid;
// save rule
if ((debug_mode == 1) || (debug_mode == 3) || (debug_mode == 4))
{
const int len = kernel_rule_to_cpu_rule ((char *) debug_rule_buf, &straight_ctx->kernel_rules_buf[pw_base->rule_idx]);
debug_rule_buf[len] = 0;
*debug_rule_len = len;
}
// save plain
if ((debug_mode == 2) || (debug_mode == 3) || (debug_mode == 4))
{
memcpy (debug_plain_ptr, pw_base->base_buf, pw_base->base_len);
debug_plain_ptr[pw_base->base_len] = 0;
*debug_plain_len = pw_base->base_len;
}
}
else
{
pw_t pw;
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
@ -313,6 +362,7 @@ int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
*debug_plain_len = plain_len;
}
}
return 0;
}

View File

@ -18,6 +18,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
cl_int CL_err;
@ -39,6 +40,29 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
u32 highest_pw_len = 0;
if (user_options->slow_candidates == true)
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
device_param->kernel_params_buf32[30] = 1;
}
pw_t pw; memset (&pw, 0, sizeof (pw));
char *pw_ptr = (char *) &pw.i;
const size_t pw_len = strlen (hashconfig->st_pass);
memcpy (pw_ptr, hashconfig->st_pass, pw_len);
pw.pw_len = (u32) pw_len;
CL_err = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL);
if (CL_err != CL_SUCCESS) return -1;
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
@ -286,6 +310,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if (CL_err != CL_SUCCESS) return -1;
}
}
// main : run the kernel
@ -479,6 +504,14 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_digests_shown, device_param->size_shown); if (CL_rc == -1) return -1;
CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_result, device_param->size_results); if (CL_rc == -1) return -1;
if (user_options->slow_candidates == true)
{
CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_rules_c, device_param->size_rules_c);
if (CL_rc == -1) return -1;
}
else
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
CL_rc = run_kernel_bzero (hashcat_ctx, device_param, device_param->d_rules_c, device_param->size_rules_c);
@ -497,6 +530,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if (CL_rc == -1) return -1;
}
}
// check return

163
src/slow_candidates.c Normal file
View File

@ -0,0 +1,163 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "common.h"
#include "types.h"
#include "rp.h"
#include "rp_cpu.h"
#include "rp_kernel_on_cpu.h"
#include "rp_kernel_on_cpu_optimized.h"
#include "wordlist.h"
#include "mpsp.h"
#include "slow_candidates.h"
void slow_candidates_seek (hashcat_ctx_t *hashcat_ctx, void *extra_info, const u64 cur, const u64 end)
{
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
const u32 attack_mode = user_options->attack_mode;
if (attack_mode == ATTACK_MODE_STRAIGHT)
{
extra_info_straight_t *extra_info_straight = (extra_info_straight_t *) extra_info;
FILE *fd = extra_info_straight->fd;
const u64 overlap = end % straight_ctx->kernel_rules_cnt;
const u64 init = end - overlap;
for (u64 i = cur; i < init; i += straight_ctx->kernel_rules_cnt)
{
char *line_buf;
u32 line_len;
while (1)
{
get_next_word (hashcat_ctx, fd, &line_buf, &line_len);
// post-process rule engine
char rule_buf_out[RP_PASSWORD_SIZE];
if (run_rule_engine ((int) user_options_extra->rule_len_l, user_options->rule_buf_l))
{
if (line_len >= RP_PASSWORD_SIZE) continue;
memset (rule_buf_out, 0, sizeof (rule_buf_out));
const int rule_len_out = _old_apply_rule (user_options->rule_buf_l, (int) user_options_extra->rule_len_l, line_buf, (int) line_len, rule_buf_out);
if (rule_len_out < 0) continue;
line_buf = rule_buf_out;
line_len = (u32) rule_len_out;
}
break;
}
memcpy (extra_info_straight->base_buf, line_buf, line_len);
extra_info_straight->base_len = line_len;
}
extra_info_straight->rule_pos_prev = overlap;
extra_info_straight->rule_pos = overlap;
}
else if (attack_mode == ATTACK_MODE_BF)
{
// nothing to do
}
}
void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
const u32 attack_mode = user_options->attack_mode;
if (attack_mode == ATTACK_MODE_STRAIGHT)
{
extra_info_straight_t *extra_info_straight = (extra_info_straight_t *) extra_info;
FILE *fd = extra_info_straight->fd;
if (extra_info_straight->rule_pos == 0)
{
char *line_buf;
u32 line_len;
while (1)
{
get_next_word (hashcat_ctx, fd, &line_buf, &line_len);
line_len = (u32) convert_from_hex (hashcat_ctx, line_buf, line_len);
// post-process rule engine
char rule_buf_out[RP_PASSWORD_SIZE];
if (run_rule_engine ((int) user_options_extra->rule_len_l, user_options->rule_buf_l))
{
if (line_len >= RP_PASSWORD_SIZE) continue;
memset (rule_buf_out, 0, sizeof (rule_buf_out));
const int rule_len_out = _old_apply_rule (user_options->rule_buf_l, (int) user_options_extra->rule_len_l, line_buf, (int) line_len, rule_buf_out);
if (rule_len_out < 0) continue;
line_buf = rule_buf_out;
line_len = (u32) rule_len_out;
}
break;
}
memcpy (extra_info_straight->base_buf, line_buf, line_len);
extra_info_straight->base_len = line_len;
}
memcpy (extra_info_straight->out_buf, extra_info_straight->base_buf, extra_info_straight->base_len);
extra_info_straight->out_len = extra_info_straight->base_len;
memset (extra_info_straight->out_buf + extra_info_straight->base_len, 0, sizeof (extra_info_straight->out_buf) - extra_info_straight->out_len);
u32 *out_ptr = (u32 *) extra_info_straight->out_buf;
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
extra_info_straight->out_len = apply_rules_optimized (straight_ctx->kernel_rules_buf[extra_info_straight->rule_pos].cmds, &out_ptr[0], &out_ptr[4], extra_info_straight->out_len);
}
else
{
extra_info_straight->out_len = apply_rules (straight_ctx->kernel_rules_buf[extra_info_straight->rule_pos].cmds, out_ptr, extra_info_straight->out_len);
}
extra_info_straight->rule_pos_prev = extra_info_straight->rule_pos;
extra_info_straight->rule_pos++;
if (extra_info_straight->rule_pos == straight_ctx->kernel_rules_cnt)
{
extra_info_straight->rule_pos = 0;
}
}
else if (attack_mode == ATTACK_MODE_BF)
{
extra_info_mask_t *extra_info_mask = (extra_info_mask_t *) extra_info;
sp_exec (extra_info_mask->pos, (char *) extra_info_mask->out_buf, mask_ctx->root_css_buf, mask_ctx->markov_css_buf, 0, mask_ctx->css_cnt);
}
}

View File

@ -141,6 +141,38 @@ void format_speed_display (double val, char *buf, size_t len)
}
}
void format_speed_display_1k (double val, char *buf, size_t len)
{
if (val <= 0)
{
buf[0] = '0';
buf[1] = ' ';
buf[2] = 0;
return;
}
u32 level = 0;
while (val > 999)
{
val /= 1000;
level++;
}
/* generate output */
if (level == 0)
{
snprintf (buf, len - 1, "%.0f ", val);
}
else
{
snprintf (buf, len - 1, "%.1f %c", val, UNITS[level]);
}
}
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries)
{
int exec_pos = (int) device_param->exec_pos - last_num_entries;

View File

@ -1216,7 +1216,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Speed.Dev.#%d.....: %9sH/s (%0.2fms) @ Accel:%d Loops:%d Thr:%d Vec:%d", device_id + 1,
"Speed.#%d.........: %9sH/s (%0.2fms) @ Accel:%d Loops:%d Thr:%d Vec:%d", device_id + 1,
device_info->speed_sec_dev,
device_info->exec_msec_dev,
device_info->kernel_accel_dev,
@ -1228,7 +1228,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->device_info_active > 1)
{
event_log_info (hashcat_ctx,
"Speed.Dev.#*.....: %9sH/s",
"Speed.#*.........: %9sH/s",
hashcat_status->speed_sec_all);
}
@ -1264,12 +1264,6 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
hashcat_status->progress_cur_relative_skip,
hashcat_status->progress_rejected_percent);
event_log_info (hashcat_ctx,
"Restore.Point....: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
hashcat_status->restore_point,
hashcat_status->restore_total,
hashcat_status->restore_percent);
break;
case PROGRESS_MODE_KEYSPACE_UNKNOWN:
@ -1282,6 +1276,23 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
"Rejected.........: %" PRIu64,
hashcat_status->progress_rejected);
break;
}
switch (hashcat_status->progress_mode)
{
case PROGRESS_MODE_KEYSPACE_KNOWN:
event_log_info (hashcat_ctx,
"Restore.Point....: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
hashcat_status->restore_point,
hashcat_status->restore_total,
hashcat_status->restore_percent);
break;
case PROGRESS_MODE_KEYSPACE_UNKNOWN:
event_log_info (hashcat_ctx,
"Restore.Point....: %" PRIu64,
hashcat_status->restore_point);
@ -1328,7 +1339,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (device_info->hwmon_dev == NULL) continue;
event_log_info (hashcat_ctx,
"HWMon.Dev.#%d.....: %s", device_id + 1,
"Hardware.Mon.#%d..: %s", device_id + 1,
device_info->hwmon_dev);
}
}
@ -1398,7 +1409,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Speed.Dev.#%d.....: %9sH/s (%0.2fms) @ Accel:%d Loops:%d Thr:%d Vec:%d", device_id + 1,
"Speed.#%d.........: %9sH/s (%0.2fms) @ Accel:%d Loops:%d Thr:%d Vec:%d", device_id + 1,
device_info->speed_sec_dev,
device_info->exec_msec_dev,
device_info->kernel_accel_dev,
@ -1410,7 +1421,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->device_info_active > 1)
{
event_log_info (hashcat_ctx,
"Speed.Dev.#*.....: %9sH/s",
"Speed.#*.........: %9sH/s",
hashcat_status->speed_sec_all);
}
@ -1475,7 +1486,7 @@ void status_speed (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Speed.Dev.#%d.....: %9sH/s (%0.2fms)", device_id + 1,
"Speed.#%d.........: %9sH/s (%0.2fms)", device_id + 1,
device_info->speed_sec_dev,
device_info->exec_msec_dev);
}
@ -1483,7 +1494,7 @@ void status_speed (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->device_info_active > 1)
{
event_log_info (hashcat_ctx,
"Speed.Dev.#*.....: %9sH/s",
"Speed.#*.........: %9sH/s",
hashcat_status->speed_sec_all);
}
@ -1548,7 +1559,7 @@ void status_progress (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Progress.Dev.#%d..: %" PRIu64, device_id + 1,
"Progress.#%d......: %" PRIu64, device_id + 1,
device_info->progress_dev);
}
@ -1559,7 +1570,7 @@ void status_progress (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Runtime.Dev.#%d...: %0.2fms", device_id + 1,
"Runtime.#%d.......: %0.2fms", device_id + 1,
device_info->runtime_msec_dev);
}

View File

@ -115,6 +115,7 @@ static const char *const USAGE_BIG[] =
" -i, --increment | | Enable mask increment mode |",
" --increment-min | Num | Start mask incrementing at X | --increment-min=4",
" --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
" -S, --slow-candidates | | Enable slower (but advanced) candidate generators |",
"",
"- [ Hash modes ] -",
"",

View File

@ -14,14 +14,14 @@
#include "outfile.h"
#include "user_options.h"
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:iIbw:O";
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:iIbw:OS";
static const struct option long_options[] =
{
{"advice-disable", no_argument, NULL, IDX_ADVICE_DISABLE},
{"attack-mode", required_argument, NULL, IDX_ATTACK_MODE},
{"benchmark", no_argument, NULL, IDX_BENCHMARK},
{"benchmark-all", no_argument, NULL, IDX_BENCHMARK_ALL},
{"benchmark", no_argument, NULL, IDX_BENCHMARK},
{"bitmap-max", required_argument, NULL, IDX_BITMAP_MAX},
{"bitmap-min", required_argument, NULL, IDX_BITMAP_MIN},
{"cpu-affinity", required_argument, NULL, IDX_CPU_AFFINITY},
@ -77,9 +77,9 @@ static const struct option long_options[] =
{"outfile-check-timer", required_argument, NULL, IDX_OUTFILE_CHECK_TIMER},
{"outfile-format", required_argument, NULL, IDX_OUTFILE_FORMAT},
{"outfile", required_argument, NULL, IDX_OUTFILE},
{"wordlist-autohex-disable", no_argument, NULL, IDX_WORDLIST_AUTOHEX_DISABLE},
{"potfile-disable", no_argument, NULL, IDX_POTFILE_DISABLE},
{"potfile-path", required_argument, NULL, IDX_POTFILE_PATH},
{"progress-only", no_argument, NULL, IDX_PROGRESS_ONLY},
{"quiet", no_argument, NULL, IDX_QUIET},
{"remove", no_argument, NULL, IDX_REMOVE},
{"remove-timer", required_argument, NULL, IDX_REMOVE_TIMER},
@ -91,23 +91,24 @@ static const struct option long_options[] =
{"rules-file", required_argument, NULL, IDX_RP_FILE},
{"runtime", required_argument, NULL, IDX_RUNTIME},
{"scrypt-tmto", required_argument, NULL, IDX_SCRYPT_TMTO},
{"self-test-disable", no_argument, NULL, IDX_SELF_TEST_DISABLE},
{"segment-size", required_argument, NULL, IDX_SEGMENT_SIZE},
{"self-test-disable", no_argument, NULL, IDX_SELF_TEST_DISABLE},
{"separator", required_argument, NULL, IDX_SEPARATOR},
{"seperator", required_argument, NULL, IDX_SEPARATOR},
{"session", required_argument, NULL, IDX_SESSION},
{"show", no_argument, NULL, IDX_SHOW},
{"skip", required_argument, NULL, IDX_SKIP},
{"slow-candidates", no_argument, NULL, IDX_SLOW_CANDIDATES},
{"speed-only", no_argument, NULL, IDX_SPEED_ONLY},
{"status", no_argument, NULL, IDX_STATUS},
{"status-timer", required_argument, NULL, IDX_STATUS_TIMER},
{"stdout", no_argument, NULL, IDX_STDOUT_FLAG},
{"speed-only", no_argument, NULL, IDX_SPEED_ONLY},
{"progress-only", no_argument, NULL, IDX_PROGRESS_ONLY},
{"truecrypt-keyfiles", required_argument, NULL, IDX_TRUECRYPT_KEYFILES},
{"username", no_argument, NULL, IDX_USERNAME},
{"veracrypt-keyfiles", required_argument, NULL, IDX_VERACRYPT_KEYFILES},
{"veracrypt-pim", required_argument, NULL, IDX_VERACRYPT_PIM},
{"version", no_argument, NULL, IDX_VERSION},
{"wordlist-autohex-disable", no_argument, NULL, IDX_WORDLIST_AUTOHEX_DISABLE},
{"workload-profile", required_argument, NULL, IDX_WORKLOAD_PROFILE},
{NULL, 0, NULL, 0 }
};
@ -128,8 +129,8 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->advice_disable = ADVICE_DISABLE;
user_options->attack_mode = ATTACK_MODE;
user_options->benchmark = BENCHMARK;
user_options->benchmark_all = BENCHMARK_ALL;
user_options->benchmark = BENCHMARK;
user_options->bitmap_max = BITMAP_MAX;
user_options->bitmap_min = BITMAP_MIN;
user_options->cpu_affinity = NULL;
@ -139,9 +140,9 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->custom_charset_4 = NULL;
user_options->debug_file = NULL;
user_options->debug_mode = DEBUG_MODE;
user_options->example_hashes = EXAMPLE_HASHES;
user_options->encoding_from = ENCODING_FROM;
user_options->encoding_to = ENCODING_TO;
user_options->example_hashes = EXAMPLE_HASHES;
user_options->force = FORCE;
user_options->gpu_temp_abort = GPU_TEMP_ABORT;
user_options->gpu_temp_disable = GPU_TEMP_DISABLE;
@ -154,9 +155,9 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->increment_max = INCREMENT_MAX;
user_options->increment_min = INCREMENT_MIN;
user_options->induction_dir = NULL;
user_options->keep_guessing = KEEP_GUESSING;
user_options->kernel_accel = KERNEL_ACCEL;
user_options->kernel_loops = KERNEL_LOOPS;
user_options->keep_guessing = KEEP_GUESSING;
user_options->keyspace = KEYSPACE;
user_options->left = LEFT;
user_options->limit = LIMIT;
@ -175,7 +176,6 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->opencl_platforms = NULL;
user_options->opencl_vector_width = OPENCL_VECTOR_WIDTH;
user_options->optimized_kernel_enable = OPTIMIZED_KERNEL_ENABLE;
user_options->wordlist_autohex_disable = WORDLIST_AUTOHEX_DISABLE;
user_options->outfile_autohex = OUTFILE_AUTOHEX;
user_options->outfile_check_dir = NULL;
user_options->outfile_check_timer = OUTFILE_CHECK_TIMER;
@ -183,6 +183,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->outfile = NULL;
user_options->potfile_disable = POTFILE_DISABLE;
user_options->potfile_path = NULL;
user_options->progress_only = PROGRESS_ONLY;
user_options->quiet = QUIET;
user_options->remove = REMOVE;
user_options->remove_timer = REMOVE_TIMER;
@ -198,23 +199,24 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->rule_buf_r = RULE_BUF_R;
user_options->runtime = RUNTIME;
user_options->scrypt_tmto = SCRYPT_TMTO;
user_options->self_test_disable = SELF_TEST_DISABLE;
user_options->segment_size = SEGMENT_SIZE;
user_options->self_test_disable = SELF_TEST_DISABLE;
user_options->separator = SEPARATOR;
user_options->session = PROGNAME;
user_options->show = SHOW;
user_options->skip = SKIP;
user_options->slow_candidates = SLOW_CANDIDATES;
user_options->speed_only = SPEED_ONLY;
user_options->status = STATUS;
user_options->status_timer = STATUS_TIMER;
user_options->stdout_flag = STDOUT_FLAG;
user_options->speed_only = SPEED_ONLY;
user_options->progress_only = PROGRESS_ONLY;
user_options->truecrypt_keyfiles = NULL;
user_options->usage = USAGE;
user_options->username = USERNAME;
user_options->veracrypt_keyfiles = NULL;
user_options->veracrypt_pim = 0;
user_options->version = VERSION;
user_options->wordlist_autohex_disable = WORDLIST_AUTOHEX_DISABLE;
user_options->workload_profile = WORKLOAD_PROFILE;
user_options->rp_files_cnt = 0;
user_options->rp_files = (char **) hccalloc (256, sizeof (char *));
@ -416,6 +418,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_CUSTOM_CHARSET_2: user_options->custom_charset_2 = optarg; break;
case IDX_CUSTOM_CHARSET_3: user_options->custom_charset_3 = optarg; break;
case IDX_CUSTOM_CHARSET_4: user_options->custom_charset_4 = optarg; break;
case IDX_SLOW_CANDIDATES: user_options->slow_candidates = true; break;
}
}
@ -445,6 +448,18 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->slow_candidates == true)
{
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
&& (user_options->attack_mode != ATTACK_MODE_BF))
{
event_log_error (hashcat_ctx, "Invalid attack mode (-a) value specified in slow-candidates mode.");
return -1;
}
}
else
{
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
&& (user_options->attack_mode != ATTACK_MODE_COMBI)
&& (user_options->attack_mode != ATTACK_MODE_BF)
@ -456,6 +471,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
}
if (user_options->hccapx_message_pair_chgd == true)
{
@ -1278,6 +1294,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
user_options->quiet = true;
}
if (user_options->slow_candidates == true)
{
user_options->opencl_vector_width = 1;
}
if (user_options->stdout_flag == true)
{
user_options->force = true;
@ -1646,8 +1667,15 @@ 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_t *user_options = hashcat_ctx->user_options;
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
if (user_options->slow_candidates == true)
{
return 1;
}
else
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
if (straight_ctx->kernel_rules_cnt)
@ -1669,6 +1697,7 @@ u64 user_options_extra_amplifier (hashcat_ctx_t *hashcat_ctx)
return mask_ctx->bfs_cnt;
}
}
}
return 1;
}
@ -2340,6 +2369,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_uint (user_options->scrypt_tmto);
logfile_top_uint (user_options->segment_size);
logfile_top_uint (user_options->self_test_disable);
logfile_top_uint (user_options->slow_candidates);
logfile_top_uint (user_options->show);
logfile_top_uint (user_options->speed_only);
logfile_top_uint (user_options->status);

View File

@ -238,6 +238,51 @@ void get_next_word (hashcat_ctx_t *hashcat_ctx, FILE *fd, char **out_buf, u32 *o
get_next_word (hashcat_ctx, fd, out_buf, out_len);
}
void pw_pre_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len, const u8 *base_buf, const int base_len, const int rule_idx)
{
if (device_param->pws_pre_cnt < device_param->kernel_power)
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + device_param->pws_pre_cnt;
memcpy (pw_pre->pw_buf, pw_buf, pw_len);
pw_pre->pw_len = pw_len;
if (base_buf != NULL)
{
memcpy (pw_pre->base_buf, base_buf, base_len);
pw_pre->base_len = base_len;
}
pw_pre->rule_idx = rule_idx;
device_param->pws_pre_cnt++;
}
else
{
fprintf (stdout, "BUG pw_pre_add()!!\n");
return;
}
}
void pw_base_add (hc_device_param_t *device_param, pw_pre_t *pw_pre)
{
if (device_param->pws_base_cnt < device_param->kernel_power)
{
memcpy (device_param->pws_base_buf + device_param->pws_base_cnt, pw_pre, sizeof (pw_pre_t));
device_param->pws_base_cnt++;
}
else
{
fprintf (stderr, "BUG pw_base_add()!!\n");
return;
}
}
void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len)
{
if (device_param->pws_cnt < device_param->kernel_power)