Move loading rules into outer loop

pull/518/head
jsteube 8 years ago
parent ebe9f1c07f
commit 62b97a6fe6

@ -6,7 +6,7 @@
#ifndef _AUTOTUNE_H
#define _AUTOTUNE_H
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra);
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx);
void *thread_autotune (void *p);

@ -13,9 +13,9 @@ int sort_by_hash_no_salt (const void *v1, const void *v2);
void save_hash (const user_options_t *user_options, const hashconfig_t *hashconfig, const hashes_t *hashes);
void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, plain_t *plain);
void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, plain_t *plain);
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos);
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos);
int hashes_init_stage1 (hashes_t *hashes, const hashconfig_t *hashconfig, potfile_ctx_t *potfile_ctx, outfile_ctx_t *outfile_ctx, user_options_t *user_options, char *hash_or_file);
int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, opencl_ctx_t *opencl_ctx, user_options_t *user_options);

@ -23,99 +23,6 @@
#define LM_WEAK_HASH "\x4e\xcf\x0d\x0c\x0a\xe2\xfb\xc1"
#define LM_MASKED_PLAIN "[notfound]"
/**
* option types
*/
typedef enum salt_type
{
SALT_TYPE_NONE = 1,
SALT_TYPE_EMBEDDED = 2,
SALT_TYPE_INTERN = 3,
SALT_TYPE_EXTERN = 4,
SALT_TYPE_VIRTUAL = 5
} salt_type_t;
typedef enum opti_type
{
OPTI_TYPE_ZERO_BYTE = (1 << 1),
OPTI_TYPE_PRECOMPUTE_INIT = (1 << 2),
OPTI_TYPE_PRECOMPUTE_MERKLE = (1 << 3),
OPTI_TYPE_PRECOMPUTE_PERMUT = (1 << 4),
OPTI_TYPE_MEET_IN_MIDDLE = (1 << 5),
OPTI_TYPE_EARLY_SKIP = (1 << 6),
OPTI_TYPE_NOT_SALTED = (1 << 7),
OPTI_TYPE_NOT_ITERATED = (1 << 8),
OPTI_TYPE_PREPENDED_SALT = (1 << 9),
OPTI_TYPE_APPENDED_SALT = (1 << 10),
OPTI_TYPE_SINGLE_HASH = (1 << 11),
OPTI_TYPE_SINGLE_SALT = (1 << 12),
OPTI_TYPE_BRUTE_FORCE = (1 << 13),
OPTI_TYPE_RAW_HASH = (1 << 14),
OPTI_TYPE_SLOW_HASH_SIMD = (1 << 15),
OPTI_TYPE_USES_BITS_8 = (1 << 16),
OPTI_TYPE_USES_BITS_16 = (1 << 17),
OPTI_TYPE_USES_BITS_32 = (1 << 18),
OPTI_TYPE_USES_BITS_64 = (1 << 19)
} opti_type_t;
typedef enum opts_type
{
OPTS_TYPE_PT_UNICODE = (1 << 0),
OPTS_TYPE_PT_UPPER = (1 << 1),
OPTS_TYPE_PT_LOWER = (1 << 2),
OPTS_TYPE_PT_ADD01 = (1 << 3),
OPTS_TYPE_PT_ADD02 = (1 << 4),
OPTS_TYPE_PT_ADD80 = (1 << 5),
OPTS_TYPE_PT_ADDBITS14 = (1 << 6),
OPTS_TYPE_PT_ADDBITS15 = (1 << 7),
OPTS_TYPE_PT_GENERATE_LE = (1 << 8),
OPTS_TYPE_PT_GENERATE_BE = (1 << 9),
OPTS_TYPE_PT_NEVERCRACK = (1 << 10), // if we want all possible results
OPTS_TYPE_PT_BITSLICE = (1 << 11),
OPTS_TYPE_ST_UNICODE = (1 << 12),
OPTS_TYPE_ST_UPPER = (1 << 13),
OPTS_TYPE_ST_LOWER = (1 << 14),
OPTS_TYPE_ST_ADD01 = (1 << 15),
OPTS_TYPE_ST_ADD02 = (1 << 16),
OPTS_TYPE_ST_ADD80 = (1 << 17),
OPTS_TYPE_ST_ADDBITS14 = (1 << 18),
OPTS_TYPE_ST_ADDBITS15 = (1 << 19),
OPTS_TYPE_ST_GENERATE_LE = (1 << 20),
OPTS_TYPE_ST_GENERATE_BE = (1 << 21),
OPTS_TYPE_ST_HEX = (1 << 22),
OPTS_TYPE_ST_BASE64 = (1 << 23),
OPTS_TYPE_HASH_COPY = (1 << 24),
OPTS_TYPE_HOOK12 = (1 << 25),
OPTS_TYPE_HOOK23 = (1 << 26)
} opts_type_t;
typedef enum dgst_size
{
DGST_SIZE_4_2 = (2 * sizeof (uint)), // 8
DGST_SIZE_4_4 = (4 * sizeof (uint)), // 16
DGST_SIZE_4_5 = (5 * sizeof (uint)), // 20
DGST_SIZE_4_6 = (6 * sizeof (uint)), // 24
DGST_SIZE_4_8 = (8 * sizeof (uint)), // 32
DGST_SIZE_4_16 = (16 * sizeof (uint)), // 64 !!!
DGST_SIZE_4_32 = (32 * sizeof (uint)), // 128 !!!
DGST_SIZE_4_64 = (64 * sizeof (uint)), // 256
DGST_SIZE_8_8 = (8 * sizeof (u64)), // 64 !!!
DGST_SIZE_8_16 = (16 * sizeof (u64)), // 128 !!!
DGST_SIZE_8_25 = (25 * sizeof (u64)) // 200
} dgst_size_t;
typedef enum attack_exec
{
ATTACK_EXEC_OUTSIDE_KERNEL = 10,
ATTACK_EXEC_INSIDE_KERNEL = 11
} attack_exec_t;
/**
* algo specific
*/

@ -18,44 +18,6 @@ static const char CL_VENDOR_MESA[] = "Mesa";
static const char CL_VENDOR_NV[] = "NVIDIA Corporation";
static const char CL_VENDOR_POCL[] = "The pocl project";
typedef enum amplifier_count
{
KERNEL_BFS = 1024,
KERNEL_COMBS = 1024,
KERNEL_RULES = 1024,
KERNEL_THREADS_MAX = 256,
KERNEL_THREADS_MAX_CPU = 1
} amplifier_count_t;
typedef enum vendor_id
{
VENDOR_ID_AMD = (1 << 0),
VENDOR_ID_APPLE = (1 << 1),
VENDOR_ID_INTEL_BEIGNET = (1 << 2),
VENDOR_ID_INTEL_SDK = (1 << 3),
VENDOR_ID_MESA = (1 << 4),
VENDOR_ID_NV = (1 << 5),
VENDOR_ID_POCL = (1 << 6),
VENDOR_ID_AMD_USE_INTEL = (1 << 7),
VENDOR_ID_GENERIC = (1 << 31)
} vendor_id_t;
typedef enum status_rc
{
STATUS_INIT = 0,
STATUS_AUTOTUNE = 1,
STATUS_RUNNING = 2,
STATUS_PAUSED = 3,
STATUS_EXHAUSTED = 4,
STATUS_CRACKED = 5,
STATUS_ABORTED = 6,
STATUS_QUIT = 7,
STATUS_BYPASS = 8,
} status_rc_t;
static const char ST_0000[] = "Initializing";
static const char ST_0001[] = "Autotuning";
static const char ST_0002[] = "Running";
@ -73,7 +35,7 @@ void writeProgramBin (char *dst, u8 *binary, size_t binary_size);
int gidd_to_pw_t (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw);
int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, hashconfig_t *hashconfig, const uint attack_exec, const uint attack_mode, const uint opts_type, const salt_t *salt_buf, const uint highest_pw_len, const uint pws_cnt, const uint fast_iteration);
int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const rules_ctx_t *rules_ctx, hashconfig_t *hashconfig, const uint attack_exec, const uint attack_mode, const uint opts_type, const salt_t *salt_buf, const uint highest_pw_len, const uint pws_cnt, const uint fast_iteration);
int run_kernel (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num, const uint event_update, const uint iteration, hashconfig_t *hashconfig, const user_options_t *user_options);
int run_kernel_mp (const uint kern_run, opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint num);
int run_kernel_tm (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param);
@ -83,7 +45,7 @@ int run_kernel_bzero (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const uint pws_cnt);
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const uint pws_cnt);
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, const uint pws_cnt);
int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options);
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx);
@ -91,7 +53,7 @@ void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx);
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options);
void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx);
int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const session_ctx_t *session_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db);
int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const rules_ctx_t *rules_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db);
int opencl_session_destroy (opencl_ctx_t *opencl_ctx);
#endif // _OPENCL_H

@ -12,7 +12,8 @@
#define INCR_RULES 10000
#define MAX_KERNEL_RULES 31
#define RULES_MAX 32
#define MAX_KERNEL_RULES (RULES_MAX - 1)
bool class_num (const u8 c);
bool class_lower (const u8 c);
@ -27,4 +28,7 @@ int generate_random_rule (char rule_buf[RP_RULE_BUFSIZ], u32 rp_gen_func_min, u3
int cpu_rule_to_kernel_rule (char *rule_buf, uint rule_len, kernel_rule_t *rule);
int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule);
int rules_ctx_init (rules_ctx_t *rules_ctx, const user_options_t *user_options);
void rules_ctx_destroy (rules_ctx_t *rules_ctx);
#endif // _RP_H

@ -6,7 +6,7 @@
#ifndef _SESSION_H
#define _SESSION_H
void session_ctx_init (session_ctx_t *session_ctx, const u32 kernel_rules_cnt, kernel_rule_t *kernel_rules_buf);
void session_ctx_init (session_ctx_t *session_ctx);
void session_ctx_destroy (session_ctx_t *session_ctx);

@ -11,8 +11,8 @@
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra);
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx);
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx);
void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig);
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const user_options_t *user_options);

@ -20,6 +20,6 @@
#include <pwd.h>
#endif // _POSIX
void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const uint pws_cnt);
void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const rules_ctx_t *rules_ctx, const uint pws_cnt);
#endif // _STDOUT_H

@ -62,6 +62,44 @@ typedef pthread_mutex_t hc_thread_mutex_t;
// enums
typedef enum amplifier_count
{
KERNEL_BFS = 1024,
KERNEL_COMBS = 1024,
KERNEL_RULES = 1024,
KERNEL_THREADS_MAX = 256,
KERNEL_THREADS_MAX_CPU = 1
} amplifier_count_t;
typedef enum vendor_id
{
VENDOR_ID_AMD = (1 << 0),
VENDOR_ID_APPLE = (1 << 1),
VENDOR_ID_INTEL_BEIGNET = (1 << 2),
VENDOR_ID_INTEL_SDK = (1 << 3),
VENDOR_ID_MESA = (1 << 4),
VENDOR_ID_NV = (1 << 5),
VENDOR_ID_POCL = (1 << 6),
VENDOR_ID_AMD_USE_INTEL = (1 << 7),
VENDOR_ID_GENERIC = (1 << 31)
} vendor_id_t;
typedef enum status_rc
{
STATUS_INIT = 0,
STATUS_AUTOTUNE = 1,
STATUS_RUNNING = 2,
STATUS_PAUSED = 3,
STATUS_EXHAUSTED = 4,
STATUS_CRACKED = 5,
STATUS_ABORTED = 6,
STATUS_QUIT = 7,
STATUS_BYPASS = 8,
} status_rc_t;
typedef enum wl_mode
{
WL_MODE_STDIN = 1,
@ -187,6 +225,95 @@ typedef enum rule_functions
} rule_functions_t;
typedef enum salt_type
{
SALT_TYPE_NONE = 1,
SALT_TYPE_EMBEDDED = 2,
SALT_TYPE_INTERN = 3,
SALT_TYPE_EXTERN = 4,
SALT_TYPE_VIRTUAL = 5
} salt_type_t;
typedef enum opti_type
{
OPTI_TYPE_ZERO_BYTE = (1 << 1),
OPTI_TYPE_PRECOMPUTE_INIT = (1 << 2),
OPTI_TYPE_PRECOMPUTE_MERKLE = (1 << 3),
OPTI_TYPE_PRECOMPUTE_PERMUT = (1 << 4),
OPTI_TYPE_MEET_IN_MIDDLE = (1 << 5),
OPTI_TYPE_EARLY_SKIP = (1 << 6),
OPTI_TYPE_NOT_SALTED = (1 << 7),
OPTI_TYPE_NOT_ITERATED = (1 << 8),
OPTI_TYPE_PREPENDED_SALT = (1 << 9),
OPTI_TYPE_APPENDED_SALT = (1 << 10),
OPTI_TYPE_SINGLE_HASH = (1 << 11),
OPTI_TYPE_SINGLE_SALT = (1 << 12),
OPTI_TYPE_BRUTE_FORCE = (1 << 13),
OPTI_TYPE_RAW_HASH = (1 << 14),
OPTI_TYPE_SLOW_HASH_SIMD = (1 << 15),
OPTI_TYPE_USES_BITS_8 = (1 << 16),
OPTI_TYPE_USES_BITS_16 = (1 << 17),
OPTI_TYPE_USES_BITS_32 = (1 << 18),
OPTI_TYPE_USES_BITS_64 = (1 << 19)
} opti_type_t;
typedef enum opts_type
{
OPTS_TYPE_PT_UNICODE = (1 << 0),
OPTS_TYPE_PT_UPPER = (1 << 1),
OPTS_TYPE_PT_LOWER = (1 << 2),
OPTS_TYPE_PT_ADD01 = (1 << 3),
OPTS_TYPE_PT_ADD02 = (1 << 4),
OPTS_TYPE_PT_ADD80 = (1 << 5),
OPTS_TYPE_PT_ADDBITS14 = (1 << 6),
OPTS_TYPE_PT_ADDBITS15 = (1 << 7),
OPTS_TYPE_PT_GENERATE_LE = (1 << 8),
OPTS_TYPE_PT_GENERATE_BE = (1 << 9),
OPTS_TYPE_PT_NEVERCRACK = (1 << 10), // if we want all possible results
OPTS_TYPE_PT_BITSLICE = (1 << 11),
OPTS_TYPE_ST_UNICODE = (1 << 12),
OPTS_TYPE_ST_UPPER = (1 << 13),
OPTS_TYPE_ST_LOWER = (1 << 14),
OPTS_TYPE_ST_ADD01 = (1 << 15),
OPTS_TYPE_ST_ADD02 = (1 << 16),
OPTS_TYPE_ST_ADD80 = (1 << 17),
OPTS_TYPE_ST_ADDBITS14 = (1 << 18),
OPTS_TYPE_ST_ADDBITS15 = (1 << 19),
OPTS_TYPE_ST_GENERATE_LE = (1 << 20),
OPTS_TYPE_ST_GENERATE_BE = (1 << 21),
OPTS_TYPE_ST_HEX = (1 << 22),
OPTS_TYPE_ST_BASE64 = (1 << 23),
OPTS_TYPE_HASH_COPY = (1 << 24),
OPTS_TYPE_HOOK12 = (1 << 25),
OPTS_TYPE_HOOK23 = (1 << 26)
} opts_type_t;
typedef enum dgst_size
{
DGST_SIZE_4_2 = (2 * sizeof (uint)), // 8
DGST_SIZE_4_4 = (4 * sizeof (uint)), // 16
DGST_SIZE_4_5 = (5 * sizeof (uint)), // 20
DGST_SIZE_4_6 = (6 * sizeof (uint)), // 24
DGST_SIZE_4_8 = (8 * sizeof (uint)), // 32
DGST_SIZE_4_16 = (16 * sizeof (uint)), // 64 !!!
DGST_SIZE_4_32 = (32 * sizeof (uint)), // 128 !!!
DGST_SIZE_4_64 = (64 * sizeof (uint)), // 256
DGST_SIZE_8_8 = (8 * sizeof (u64)), // 64 !!!
DGST_SIZE_8_16 = (16 * sizeof (u64)), // 128 !!!
DGST_SIZE_8_25 = (25 * sizeof (u64)) // 200
} dgst_size_t;
typedef enum attack_exec
{
ATTACK_EXEC_OUTSIDE_KERNEL = 10,
ATTACK_EXEC_INSIDE_KERNEL = 11
} attack_exec_t;
/**
* structs
*/
@ -926,8 +1053,6 @@ typedef struct
typedef struct
{
u32 kernel_rules_cnt;
kernel_rule_t *kernel_rules_buf;
} session_ctx_t;
@ -981,6 +1106,13 @@ typedef struct
} outcheck_ctx_t;
typedef struct
{
u32 kernel_rules_cnt;
kernel_rule_t *kernel_rules_buf;
} rules_ctx_t;
typedef struct
{
/**
@ -1002,9 +1134,6 @@ typedef struct
* attack specific
*/
u32 kernel_rules_cnt;
kernel_rule_t *kernel_rules_buf;
u32 combs_mode;
u32 combs_cnt;
@ -1063,6 +1192,7 @@ typedef struct
induct_ctx_t *induct_ctx;
outcheck_ctx_t *outcheck_ctx;
logfile_ctx_t *logfile_ctx;
rules_ctx_t *rules_ctx;
/**
* used for restore
@ -1097,7 +1227,6 @@ typedef struct
} hc_global_data_t;
#define RULES_MAX 32
#define PW_DICTMAX 31
#define PW_DICTMAX1 (PW_DICTMAX + 1)

@ -6,6 +6,6 @@
#ifndef _WEAK_HASH_H
#define _WEAK_HASH_H
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos);
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos);
#endif // _WEAK_HASH_H

@ -18,7 +18,7 @@ void get_next_word (wl_data_t *wl_data, const user_options_t *user_options, cons
void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len);
u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const user_options_extra_t *user_options_extra, FILE *fd, const char *dictfile, dictstat_ctx_t *dictstat_ctx);
u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, FILE *fd, const char *dictfile, dictstat_ctx_t *dictstat_ctx);
void wl_data_init (wl_data_t *wl_data, const user_options_t *user_options, const hashconfig_t *hashconfig);
void wl_data_destroy (wl_data_t *wl_data);

@ -163,7 +163,7 @@ LFLAGS_CROSS_WIN := -lpsapi
## Objects
##
OBJS_ALL := affinity attack_mode autotune benchmark bitmap bitops common convert cpu_aes cpu_crc32 cpu_des cpu_md5 cpu_sha1 cpu_sha256 data debugfile dictstat dispatch dynloader ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_xnvctrl filehandling filenames folder hash_management hlfmt hwmon induct interface locking logfile logging loopback memory monitor mpsp opencl outfile_check outfile potfile powertune remove restore rp rp_cpu rp_kernel_on_cpu runtime session shared status stdout terminal thread timer tuningdb usage user_options version weak_hash wordlist
OBJS_ALL := affinity attack_mode autotune benchmark bitmap bitops common convert cpu_aes cpu_crc32 cpu_des cpu_md5 cpu_sha1 cpu_sha256 data debugfile dictstat dispatch dynloader ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_xnvctrl filehandling filenames folder hash_management hlfmt hwmon induct interface locking logfile logging loopback memory monitor mpsp opencl outfile_check outfile potfile powertune remove restore rp rp_cpu rp_kernel_on_cpu runtime shared status stdout terminal thread timer tuningdb usage user_options version weak_hash wordlist
NATIVE_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.o)

@ -5,29 +5,10 @@
#include "common.h"
#include "types.h"
#include "data.h"
#include "logging.h"
#include "interface.h"
#include "timer.h"
#include "ext_OpenCL.h"
#include "ext_ADL.h"
#include "ext_nvapi.h"
#include "ext_nvml.h"
#include "ext_xnvctrl.h"
#include "mpsp.h"
#include "rp_cpu.h"
#include "tuningdb.h"
#include "thread.h"
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "outfile.h"
#include "potfile.h"
#include "debugfile.h"
#include "loopback.h"
#include "data.h"
#include "status.h"
#include "terminal.h"
#include "autotune.h"
extern hc_global_data_t data;
@ -54,7 +35,7 @@ static double try_run (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param
return exec_ms_prev;
}
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra)
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx)
{
const double target_ms = opencl_ctx->target_ms;
@ -121,7 +102,7 @@ int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (data.kernel_rules_cnt > 1)
if (rules_ctx->kernel_rules_cnt > 1)
{
cl_int CL_err = hc_clEnqueueCopyBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_rules, device_param->d_rules_c, 0, 0, MIN (kernel_loops_max, KERNEL_RULES) * sizeof (kernel_rule_t), 0, NULL, NULL);
@ -320,10 +301,10 @@ void *thread_autotune (void *p)
user_options_t *user_options = data.user_options;
user_options_extra_t *user_options_extra = data.user_options_extra;
hashconfig_t *hashconfig = data.hashconfig;
rules_ctx_t *rules_ctx = data.rules_ctx;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
autotune (opencl_ctx, device_param, hashconfig, user_options, user_options_extra);
autotune (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, rules_ctx);
return NULL;
}

@ -119,6 +119,7 @@ void *thread_calc_stdin (void *p)
user_options_extra_t *user_options_extra = data.user_options_extra;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
rules_ctx_t *rules_ctx = data.rules_ctx;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
char *buf = (char *) mymalloc (HCBUFSIZ_LARGE);
@ -182,7 +183,7 @@ void *thread_calc_stdin (void *p)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += data.kernel_rules_cnt;
data.words_progress_rejected[salt_pos] += rules_ctx->kernel_rules_cnt;
}
hc_thread_mutex_unlock (opencl_ctx->mux_counter);
@ -210,7 +211,7 @@ void *thread_calc_stdin (void *p)
{
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, rules_ctx, pws_cnt);
device_param->pws_cnt = 0;
@ -246,6 +247,7 @@ void *thread_calc (void *p)
user_options_extra_t *user_options_extra = data.user_options_extra;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
rules_ctx_t *rules_ctx = data.rules_ctx;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
const uint attack_mode = user_options->attack_mode;
@ -270,7 +272,7 @@ void *thread_calc (void *p)
{
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, rules_ctx, pws_cnt);
device_param->pws_cnt = 0;
@ -412,7 +414,7 @@ void *thread_calc (void *p)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += data.kernel_rules_cnt;
data.words_progress_rejected[salt_pos] += rules_ctx->kernel_rules_cnt;
}
hc_thread_mutex_unlock (opencl_ctx->mux_counter);
@ -462,7 +464,7 @@ void *thread_calc (void *p)
{
run_copy (opencl_ctx, device_param, hashconfig, user_options, user_options_extra, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, user_options, user_options_extra, rules_ctx, pws_cnt);
device_param->pws_cnt = 0;

@ -222,7 +222,7 @@ void save_hash (const user_options_t *user_options, const hashconfig_t *hashconf
unlink (old_hashfile);
}
void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, plain_t *plain)
void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, plain_t *plain)
{
debugfile_ctx_t *debugfile_ctx = data.debugfile_ctx;
loopback_ctx_t *loopback_ctx = data.loopback_ctx;
@ -289,7 +289,7 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cons
{
memset (debug_rule_buf, 0, sizeof (debug_rule_buf));
debug_rule_len = kernel_rule_to_cpu_rule ((char *) debug_rule_buf, &data.kernel_rules_buf[off]);
debug_rule_len = kernel_rule_to_cpu_rule ((char *) debug_rule_buf, &rules_ctx->kernel_rules_buf[off]);
}
// save plain
@ -303,10 +303,10 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cons
}
}
plain_len = apply_rules (data.kernel_rules_buf[off].cmds, &plain_buf[0], &plain_buf[4], plain_len);
plain_len = apply_rules (rules_ctx->kernel_rules_buf[off].cmds, &plain_buf[0], &plain_buf[4], plain_len);
crackpos += gidvid;
crackpos *= data.kernel_rules_cnt;
crackpos *= rules_ctx->kernel_rules_cnt;
crackpos += device_param->innerloop_pos + il_pos;
if (plain_len > data.pw_max) plain_len = data.pw_max;
@ -506,7 +506,7 @@ void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, cons
}
}
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos)
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos)
{
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
@ -570,7 +570,7 @@ int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, co
if (hashes->salts_done == hashes->salts_cnt) mycracked (opencl_ctx);
check_hash (opencl_ctx, device_param, user_options, user_options_extra, &cracked[i]);
check_hash (opencl_ctx, device_param, user_options, user_options_extra, rules_ctx, &cracked[i]);
}
hc_thread_mutex_unlock (mux_display);

@ -191,7 +191,7 @@ static void setup_seeding (const user_options_t *user_options, const time_t proc
}
}
static int outer_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, int myargc, char **myargv, folder_config_t *folder_config, logfile_ctx_t *logfile_ctx, tuning_db_t *tuning_db, induct_ctx_t *induct_ctx, outcheck_ctx_t *outcheck_ctx, opencl_ctx_t *opencl_ctx)
static int outer_loop (user_options_t *user_options, user_options_extra_t *user_options_extra, int myargc, char **myargv, folder_config_t *folder_config, logfile_ctx_t *logfile_ctx, tuning_db_t *tuning_db, induct_ctx_t *induct_ctx, outcheck_ctx_t *outcheck_ctx, rules_ctx_t *rules_ctx, opencl_ctx_t *opencl_ctx)
{
opencl_ctx->devices_status = STATUS_INIT;
@ -398,230 +398,16 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
uint pw_min = hashconfig_general_pw_min (hashconfig);
uint pw_max = hashconfig_general_pw_max (hashconfig);
/**
* charsets : keep them together for more easy maintainnce
*/
cs_t mp_sys[6] = { { { 0 }, 0 } };
cs_t mp_usr[4] = { { { 0 }, 0 } };
mp_setup_sys (mp_sys);
if (user_options->custom_charset_1) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_1, 0, hashconfig, user_options);
if (user_options->custom_charset_2) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_2, 1, hashconfig, user_options);
if (user_options->custom_charset_3) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_3, 2, hashconfig, user_options);
if (user_options->custom_charset_4) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_4, 3, hashconfig, user_options);
/**
* load rules
*/
uint *all_kernel_rules_cnt = NULL;
kernel_rule_t **all_kernel_rules_buf = NULL;
if (user_options->rp_files_cnt)
{
all_kernel_rules_cnt = (uint *) mycalloc (user_options->rp_files_cnt, sizeof (uint));
all_kernel_rules_buf = (kernel_rule_t **) mycalloc (user_options->rp_files_cnt, sizeof (kernel_rule_t *));
}
char *rule_buf = (char *) mymalloc (HCBUFSIZ_LARGE);
int rule_len = 0;
for (uint i = 0; i < user_options->rp_files_cnt; i++)
{
uint kernel_rules_avail = 0;
uint kernel_rules_cnt = 0;
kernel_rule_t *kernel_rules_buf = NULL;
char *rp_file = user_options->rp_files[i];
char in[BLOCK_SIZE] = { 0 };
char out[BLOCK_SIZE] = { 0 };
FILE *fp = NULL;
uint rule_line = 0;
if ((fp = fopen (rp_file, "rb")) == NULL)
{
log_error ("ERROR: %s: %s", rp_file, strerror (errno));
return -1;
}
while (!feof (fp))
{
memset (rule_buf, 0, HCBUFSIZ_LARGE);
rule_len = fgetl (fp, rule_buf);
rule_line++;
if (rule_len == 0) continue;
if (rule_buf[0] == '#') continue;
if (kernel_rules_avail == kernel_rules_cnt)
{
kernel_rules_buf = (kernel_rule_t *) myrealloc (kernel_rules_buf, kernel_rules_avail * sizeof (kernel_rule_t), INCR_RULES * sizeof (kernel_rule_t));
kernel_rules_avail += INCR_RULES;
}
memset (in, 0, BLOCK_SIZE);
memset (out, 0, BLOCK_SIZE);
int result = _old_apply_rule (rule_buf, rule_len, in, 1, out);
if (result == -1)
{
log_info ("WARNING: Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file, rule_line, rule_buf);
continue;
}
if (cpu_rule_to_kernel_rule (rule_buf, rule_len, &kernel_rules_buf[kernel_rules_cnt]) == -1)
{
log_info ("WARNING: Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file, rule_line, rule_buf);
memset (&kernel_rules_buf[kernel_rules_cnt], 0, sizeof (kernel_rule_t)); // needs to be cleared otherwise we could have some remaining data
continue;
}
kernel_rules_cnt++;
}
fclose (fp);
all_kernel_rules_cnt[i] = kernel_rules_cnt;
all_kernel_rules_buf[i] = kernel_rules_buf;
}
/**
* merge rules or automatic rule generator
*/
uint kernel_rules_cnt = 0;
kernel_rule_t *kernel_rules_buf = NULL;
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
if (user_options->rp_files_cnt)
{
kernel_rules_cnt = 1;
uint *repeats = (uint *) mycalloc (user_options->rp_files_cnt + 1, sizeof (uint));
repeats[0] = kernel_rules_cnt;
for (uint i = 0; i < user_options->rp_files_cnt; i++)
{
kernel_rules_cnt *= all_kernel_rules_cnt[i];
repeats[i + 1] = kernel_rules_cnt;
}
kernel_rules_buf = (kernel_rule_t *) mycalloc (kernel_rules_cnt, sizeof (kernel_rule_t));
memset (kernel_rules_buf, 0, kernel_rules_cnt * sizeof (kernel_rule_t));
for (uint i = 0; i < kernel_rules_cnt; i++)
{
uint out_pos = 0;
kernel_rule_t *out = &kernel_rules_buf[i];
for (uint j = 0; j < user_options->rp_files_cnt; j++)
{
uint in_off = (i / repeats[j]) % all_kernel_rules_cnt[j];
uint in_pos;
kernel_rule_t *in = &all_kernel_rules_buf[j][in_off];
for (in_pos = 0; in->cmds[in_pos]; in_pos++, out_pos++)
{
if (out_pos == RULES_MAX - 1)
{
// log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
break;
}
out->cmds[out_pos] = in->cmds[in_pos];
}
}
}
local_free (repeats);
}
else if (user_options->rp_gen)
{
uint kernel_rules_avail = 0;
while (kernel_rules_cnt < user_options->rp_gen)
{
if (kernel_rules_avail == kernel_rules_cnt)
{
kernel_rules_buf = (kernel_rule_t *) myrealloc (kernel_rules_buf, kernel_rules_avail * sizeof (kernel_rule_t), INCR_RULES * sizeof (kernel_rule_t));
kernel_rules_avail += INCR_RULES;
}
memset (rule_buf, 0, HCBUFSIZ_LARGE);
rule_len = (int) generate_random_rule (rule_buf, user_options->rp_gen_func_min, user_options->rp_gen_func_max);
if (cpu_rule_to_kernel_rule (rule_buf, rule_len, &kernel_rules_buf[kernel_rules_cnt]) == -1) continue;
kernel_rules_cnt++;
}
}
}
myfree (rule_buf);
/**
* generate NOP rules
*/
if ((user_options->rp_files_cnt == 0) && (user_options->rp_gen == 0))
{
kernel_rules_buf = (kernel_rule_t *) mymalloc (sizeof (kernel_rule_t));
kernel_rules_buf[kernel_rules_cnt].cmds[0] = RULE_OP_MANGLE_NOOP;
kernel_rules_cnt++;
}
data.kernel_rules_cnt = kernel_rules_cnt;
data.kernel_rules_buf = kernel_rules_buf;
if (kernel_rules_cnt == 0)
{
log_error ("ERROR: No valid rules left");
return -1;
}
/**
* If we have a NOOP rule then we can process words from wordlists > length 32 for slow hashes
*/
int has_noop = 0;
for (uint kernel_rules_pos = 0; kernel_rules_pos < kernel_rules_cnt; kernel_rules_pos++)
for (uint kernel_rules_pos = 0; kernel_rules_pos < rules_ctx->kernel_rules_cnt; kernel_rules_pos++)
{
if (kernel_rules_buf[kernel_rules_pos].cmds[0] != RULE_OP_MANGLE_NOOP) continue;
if (kernel_rules_buf[kernel_rules_pos].cmds[1] != 0) continue;
if (rules_ctx->kernel_rules_buf[kernel_rules_pos].cmds[0] != RULE_OP_MANGLE_NOOP) continue;
if (rules_ctx->kernel_rules_buf[kernel_rules_pos].cmds[1] != 0) continue;
has_noop = 1;
}
@ -654,6 +440,20 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
}
}
/**
* charsets : keep them together for more easy maintainnce
*/
cs_t mp_sys[6] = { { { 0 }, 0 } };
cs_t mp_usr[4] = { { { 0 }, 0 } };
mp_setup_sys (mp_sys);
if (user_options->custom_charset_1) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_1, 0, hashconfig, user_options);
if (user_options->custom_charset_2) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_2, 1, hashconfig, user_options);
if (user_options->custom_charset_3) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_3, 2, hashconfig, user_options);
if (user_options->custom_charset_4) mp_setup_usr (mp_sys, mp_usr, user_options->custom_charset_4, 3, hashconfig, user_options);
/**
* HM devices: init
*/
@ -856,7 +656,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
log_info ("Rules: %u", kernel_rules_cnt);
log_info ("Rules: %u", rules_ctx->kernel_rules_cnt);
}
if (hashconfig->opti_type)
@ -1140,13 +940,15 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
if (user_options->quiet == false) log_info_nn ("Initializing device kernels and memory...");
/*
session_ctx_t *session_ctx = (session_ctx_t *) mymalloc (sizeof (session_ctx_t));
data.session_ctx = session_ctx;
session_ctx_init (session_ctx, kernel_rules_cnt, kernel_rules_buf);
session_ctx_init (session_ctx);
*/
opencl_session_begin (opencl_ctx, hashconfig, hashes, session_ctx, user_options, user_options_extra, folder_config, bitmap_ctx, tuning_db);
opencl_session_begin (opencl_ctx, hashconfig, hashes, rules_ctx, user_options, user_options_extra, folder_config, bitmap_ctx, tuning_db);
if (user_options->quiet == false) log_info_nn ("");
@ -1442,7 +1244,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
data.combs_cnt = 1;
const u64 words1_cnt = count_words (wl_data, user_options, user_options_extra, fp1, dictfile1, dictstat_ctx);
const u64 words1_cnt = count_words (wl_data, user_options, user_options_extra, rules_ctx, fp1, dictfile1, dictstat_ctx);
if (words1_cnt == 0)
{
@ -1456,7 +1258,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
data.combs_cnt = 1;
const u64 words2_cnt = count_words (wl_data, user_options, user_options_extra, fp2, dictfile2, dictstat_ctx);
const u64 words2_cnt = count_words (wl_data, user_options, user_options_extra, rules_ctx, fp2, dictfile2, dictstat_ctx);
if (words2_cnt == 0)
{
@ -2033,7 +1835,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
weak_hash_check (opencl_ctx, device_param, user_options, user_options_extra, hashconfig, hashes, salt_pos);
weak_hash_check (opencl_ctx, device_param, user_options, user_options_extra, rules_ctx, hashconfig, hashes, salt_pos);
}
}
@ -2484,7 +2286,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
return -1;
}
data.words_cnt = count_words (wl_data, user_options, user_options_extra, fd2, dictfile, dictstat_ctx);
data.words_cnt = count_words (wl_data, user_options, user_options_extra, rules_ctx, fd2, dictfile, dictstat_ctx);
fclose (fd2);
@ -2515,7 +2317,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
return -1;
}
data.words_cnt = count_words (wl_data, user_options, user_options_extra, fd2, dictfile, dictstat_ctx);
data.words_cnt = count_words (wl_data, user_options, user_options_extra, rules_ctx, fd2, dictfile, dictstat_ctx);
fclose (fd2);
}
@ -2530,7 +2332,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
return -1;
}
data.words_cnt = count_words (wl_data, user_options, user_options_extra, fd2, dictfile2, dictstat_ctx);
data.words_cnt = count_words (wl_data, user_options, user_options_extra, rules_ctx, fd2, dictfile2, dictstat_ctx);
fclose (fd2);
}
@ -2571,7 +2373,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
return -1;
}
data.words_cnt = count_words (wl_data, user_options, user_options_extra, fd2, dictfile, dictstat_ctx);
data.words_cnt = count_words (wl_data, user_options, user_options_extra, rules_ctx, fd2, dictfile, dictstat_ctx);
fclose (fd2);
@ -2830,9 +2632,9 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
if (data.kernel_rules_cnt)
if (rules_ctx->kernel_rules_cnt)
{
words_base /= data.kernel_rules_cnt;
words_base /= rules_ctx->kernel_rules_cnt;
}
}
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
@ -2872,7 +2674,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
{
for (uint i = 0; i < hashes->salts_cnt; i++)
{
data.words_progress_restored[i] = data.words_cur * data.kernel_rules_cnt;
data.words_progress_restored[i] = data.words_cur * rules_ctx->kernel_rules_cnt;
}
}
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
@ -2925,7 +2727,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = data.kernel_rules_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = rules_ctx->kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = data.bfs_cnt;
}
@ -3090,7 +2892,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
log_info ("");
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra);
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra, rules_ctx);
log_info ("");
}
@ -3098,7 +2900,7 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
{
if (user_options->status == true)
{
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra);
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra, rules_ctx);
}
}
}
@ -3402,15 +3204,10 @@ static int outer_loop (user_options_t *user_options, user_options_extra_t *user_
hashconfig_destroy (hashconfig);
local_free (all_kernel_rules_cnt);
local_free (all_kernel_rules_buf);
local_free (od_clock_mem_status);
local_free (od_power_control_status);
local_free (nvml_power_limit);
global_free (kernel_rules_buf);
global_free (root_css_buf);
global_free (markov_css_buf);
@ -3634,6 +3431,18 @@ int main (int argc, char **argv)
set_cpu_affinity (user_options->cpu_affinity);
}
/**
* rules
*/
rules_ctx_t *rules_ctx = (rules_ctx_t *) mymalloc (sizeof (rules_ctx_t));
data.rules_ctx = rules_ctx;
const int rc_rules_init = rules_ctx_init (rules_ctx, user_options);
if (rc_rules_init == -1) return -1;
/**
* Init OpenCL library loader
*/
@ -3694,7 +3503,7 @@ int main (int argc, char **argv)
if (user_options->hash_mode_chgd == true)
{
const int rc = outer_loop (user_options, user_options_extra, myargc, myargv, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, opencl_ctx);
const int rc = outer_loop (user_options, user_options_extra, myargc, myargv, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, rules_ctx, opencl_ctx);
if (rc == -1) return -1;
}
@ -3704,7 +3513,7 @@ int main (int argc, char **argv)
{
user_options->hash_mode = DEFAULT_BENCHMARK_ALGORITHMS_BUF[algorithm_pos];
const int rc = outer_loop (user_options, user_options_extra, myargc, myargv, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, opencl_ctx);
const int rc = outer_loop (user_options, user_options_extra, myargc, myargv, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, rules_ctx, opencl_ctx);
if (rc == -1) return -1;
}
@ -3712,7 +3521,7 @@ int main (int argc, char **argv)
}
else
{
const int rc = outer_loop (user_options, user_options_extra, myargc, myargv, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, opencl_ctx);
const int rc = outer_loop (user_options, user_options_extra, myargc, myargv, folder_config, logfile_ctx, tuning_db, induct_ctx, outcheck_ctx, rules_ctx, opencl_ctx);
if (rc == -1) return -1;
}
@ -3740,6 +3549,8 @@ int main (int argc, char **argv)
local_free (rd);
rules_ctx_destroy (rules_ctx);
tuning_db_destroy (tuning_db);
induct_ctx_destroy (induct_ctx);

@ -44,6 +44,7 @@ void *thread_monitor (void *p)
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
rules_ctx_t *rules_ctx = data.rules_ctx;
bool runtime_check = false;
bool remove_check = false;
@ -343,7 +344,7 @@ void *thread_monitor (void *p)
if (user_options->quiet == false) log_info ("");
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra);
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra, rules_ctx);
if (user_options->quiet == false) log_info ("");

@ -244,13 +244,13 @@ int gidd_to_pw_t (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, con
return 0;
}
int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, hashconfig_t *hashconfig, const uint attack_exec, const uint attack_mode, const uint opts_type, const salt_t *salt_buf, const uint highest_pw_len, const uint pws_cnt, const uint fast_iteration)
int choose_kernel (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const rules_ctx_t *rules_ctx, hashconfig_t *hashconfig, const uint attack_exec, const uint attack_mode, const uint opts_type, const salt_t *salt_buf, const uint highest_pw_len, const uint pws_cnt, const uint fast_iteration)
{
cl_int CL_err = CL_SUCCESS;
if (hashconfig->hash_mode == 2000)
{
process_stdout (opencl_ctx, device_param, user_options, pws_cnt);
process_stdout (opencl_ctx, device_param, user_options, rules_ctx, pws_cnt);
return 0;
}
@ -957,7 +957,7 @@ int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashcon
return 0;
}
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const uint pws_cnt)
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, const uint pws_cnt)
{
char *line_buf = (char *) mymalloc (HCBUFSIZ_LARGE);
@ -1022,7 +1022,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
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 = data.kernel_rules_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = rules_ctx->kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = data.bfs_cnt;
@ -1234,7 +1234,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
hc_timer_set (&device_param->timer_speed);
}
int rc = choose_kernel (opencl_ctx, device_param, user_options, hashconfig, hashconfig->attack_exec, user_options->attack_mode, hashconfig->opts_type, salt_buf, highest_pw_len, pws_cnt, fast_iteration);
int rc = choose_kernel (opencl_ctx, device_param, user_options, rules_ctx, hashconfig, hashconfig->attack_exec, user_options->attack_mode, hashconfig->opts_type, salt_buf, highest_pw_len, pws_cnt, fast_iteration);
if (rc == -1) return -1;
@ -1244,7 +1244,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
if (user_options->benchmark == false)
{
check_cracked (opencl_ctx, device_param, user_options, user_options_extra, hashconfig, hashes, salt_pos);
check_cracked (opencl_ctx, device_param, user_options, user_options_extra, rules_ctx, hashconfig, hashes, salt_pos);
}
/**
@ -2413,7 +2413,7 @@ void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx)
opencl_ctx->need_xnvctrl = 0;
}
int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const session_ctx_t *session_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db)
int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const rules_ctx_t *rules_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const folder_config_t *folder_config, const bitmap_ctx_t *bitmap_ctx, const tuning_db_t *tuning_db)
{
/**
* Some algorithm, like descrypt, can benefit from JIT compilation
@ -2643,8 +2643,8 @@ int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconf
device_param->size_results = size_results;
size_t size_rules = session_ctx->kernel_rules_cnt * sizeof (kernel_rule_t);
size_t size_rules_c = KERNEL_RULES * sizeof (kernel_rule_t);
size_t size_rules = rules_ctx->kernel_rules_cnt * sizeof (kernel_rule_t);
size_t size_rules_c = KERNEL_RULES * sizeof (kernel_rule_t);
size_t size_plains = hashes->digests_cnt * sizeof (plain_t);
size_t size_salts = hashes->salts_cnt * sizeof (salt_t);
@ -3819,7 +3819,7 @@ int opencl_session_begin (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconf
return -1;
}
CL_err = hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_rules, CL_TRUE, 0, size_rules, session_ctx->kernel_rules_buf, 0, NULL, NULL);
CL_err = hc_clEnqueueWriteBuffer (opencl_ctx->ocl, device_param->command_queue, device_param->d_rules, CL_TRUE, 0, size_rules, rules_ctx->kernel_rules_buf, 0, NULL, NULL);
if (CL_err != CL_SUCCESS)
{

@ -9,8 +9,12 @@
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "shared.h"
#include "filehandling.h"
#include "rp.h"
#include "rp_cpu.h"
static const char grp_op_nop[] =
{
@ -696,3 +700,221 @@ int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule)
return -1;
}
int rules_ctx_init (rules_ctx_t *rules_ctx, const user_options_t *user_options)
{
/**
* load rules
*/
uint *all_kernel_rules_cnt = NULL;
kernel_rule_t **all_kernel_rules_buf = NULL;
if (user_options->rp_files_cnt)
{
all_kernel_rules_cnt = (uint *) mycalloc (user_options->rp_files_cnt, sizeof (uint));
all_kernel_rules_buf = (kernel_rule_t **) mycalloc (user_options->rp_files_cnt, sizeof (kernel_rule_t *));
}
char *rule_buf = (char *) mymalloc (HCBUFSIZ_LARGE);
int rule_len = 0;
for (uint i = 0; i < user_options->rp_files_cnt; i++)
{
uint kernel_rules_avail = 0;
uint kernel_rules_cnt = 0;
kernel_rule_t *kernel_rules_buf = NULL;
char *rp_file = user_options->rp_files[i];
char in[BLOCK_SIZE] = { 0 };
char out[BLOCK_SIZE] = { 0 };
FILE *fp = NULL;
uint rule_line = 0;
if ((fp = fopen (rp_file, "rb")) == NULL)
{
log_error ("ERROR: %s: %s", rp_file, strerror (errno));
return -1;
}
while (!feof (fp))
{
memset (rule_buf, 0, HCBUFSIZ_LARGE);
rule_len = fgetl (fp, rule_buf);
rule_line++;
if (rule_len == 0) continue;
if (rule_buf[0] == '#') continue;
if (kernel_rules_avail == kernel_rules_cnt)
{
kernel_rules_buf = (kernel_rule_t *) myrealloc (kernel_rules_buf, kernel_rules_avail * sizeof (kernel_rule_t), INCR_RULES * sizeof (kernel_rule_t));
kernel_rules_avail += INCR_RULES;
}
memset (in, 0, BLOCK_SIZE);
memset (out, 0, BLOCK_SIZE);
int result = _old_apply_rule (rule_buf, rule_len, in, 1, out);
if (result == -1)
{
log_info ("WARNING: Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file, rule_line, rule_buf);
continue;
}
if (cpu_rule_to_kernel_rule (rule_buf, rule_len, &kernel_rules_buf[kernel_rules_cnt]) == -1)
{
log_info ("WARNING: Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file, rule_line, rule_buf);
memset (&kernel_rules_buf[kernel_rules_cnt], 0, sizeof (kernel_rule_t)); // needs to be cleared otherwise we could have some remaining data
continue;
}
kernel_rules_cnt++;
}
fclose (fp);
all_kernel_rules_cnt[i] = kernel_rules_cnt;
all_kernel_rules_buf[i] = kernel_rules_buf;
}
/**
* merge rules or automatic rule generator
*/
uint kernel_rules_cnt = 0;
kernel_rule_t *kernel_rules_buf = NULL;
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
if (user_options->rp_files_cnt)
{
kernel_rules_cnt = 1;
uint *repeats = (uint *) mycalloc (user_options->rp_files_cnt + 1, sizeof (uint));
repeats[0] = kernel_rules_cnt;
for (uint i = 0; i < user_options->rp_files_cnt; i++)
{
kernel_rules_cnt *= all_kernel_rules_cnt[i];
repeats[i + 1] = kernel_rules_cnt;
}
kernel_rules_buf = (kernel_rule_t *) mycalloc (kernel_rules_cnt, sizeof (kernel_rule_t));
memset (kernel_rules_buf, 0, kernel_rules_cnt * sizeof (kernel_rule_t));
for (uint i = 0; i < kernel_rules_cnt; i++)
{
uint out_pos = 0;
kernel_rule_t *out = &kernel_rules_buf[i];
for (uint j = 0; j < user_options->rp_files_cnt; j++)
{
uint in_off = (i / repeats[j]) % all_kernel_rules_cnt[j];
uint in_pos;
kernel_rule_t *in = &all_kernel_rules_buf[j][in_off];
for (in_pos = 0; in->cmds[in_pos]; in_pos++, out_pos++)
{
if (out_pos == RULES_MAX - 1)
{
// log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
break;
}
out->cmds[out_pos] = in->cmds[in_pos];
}
}
}
myfree (repeats);
}
else if (user_options->rp_gen)
{
uint kernel_rules_avail = 0;
while (kernel_rules_cnt < user_options->rp_gen)
{
if (kernel_rules_avail == kernel_rules_cnt)
{
kernel_rules_buf = (kernel_rule_t *) myrealloc (kernel_rules_buf, kernel_rules_avail * sizeof (kernel_rule_t), INCR_RULES * sizeof (kernel_rule_t));
kernel_rules_avail += INCR_RULES;
}
memset (rule_buf, 0, HCBUFSIZ_LARGE);
rule_len = (int) generate_random_rule (rule_buf, user_options->rp_gen_func_min, user_options->rp_gen_func_max);
if (cpu_rule_to_kernel_rule (rule_buf, rule_len, &kernel_rules_buf[kernel_rules_cnt]) == -1) continue;
kernel_rules_cnt++;
}
}
}
myfree (rule_buf);
/**
* generate NOP rules
*/
if ((user_options->rp_files_cnt == 0) && (user_options->rp_gen == 0))
{
kernel_rules_buf = (kernel_rule_t *) mymalloc (sizeof (kernel_rule_t));
kernel_rules_buf[kernel_rules_cnt].cmds[0] = RULE_OP_MANGLE_NOOP;
kernel_rules_cnt++;
}
rules_ctx->kernel_rules_cnt = kernel_rules_cnt;
rules_ctx->kernel_rules_buf = kernel_rules_buf;
if (kernel_rules_cnt == 0)
{
log_error ("ERROR: No valid rules left");
return -1;
}
myfree (all_kernel_rules_cnt);
myfree (all_kernel_rules_buf);
return 0;
}
void rules_ctx_destroy (rules_ctx_t *rules_ctx)
{
myfree (rules_ctx->kernel_rules_buf);
rules_ctx->kernel_rules_buf = NULL;
rules_ctx->kernel_rules_cnt = 0;
myfree (rules_ctx);
}

@ -7,14 +7,10 @@
#include "types.h"
#include "session.h"
void session_ctx_init (session_ctx_t *session_ctx, const u32 kernel_rules_cnt, kernel_rule_t *kernel_rules_buf)
void session_ctx_init (session_ctx_t *session_ctx)
{
session_ctx->kernel_rules_cnt = kernel_rules_cnt;
session_ctx->kernel_rules_buf = kernel_rules_buf;
}
void session_ctx_destroy (session_ctx_t *session_ctx)
{
session_ctx->kernel_rules_buf = NULL;
session_ctx->kernel_rules_cnt = 0;
}

@ -137,7 +137,7 @@ double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_en
return exec_ms_sum / exec_ms_cnt;
}
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra)
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx)
{
if (opencl_ctx->devices_status == STATUS_INIT)
{
@ -228,7 +228,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *
{
progress_skip = MIN (user_options->skip, data.words_base) * hashes->salts_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= data.kernel_rules_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= rules_ctx->kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_skip *= data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_skip *= data.bfs_cnt;
}
@ -237,7 +237,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *
{
progress_end = MIN (user_options->limit, data.words_base) * hashes->salts_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= data.kernel_rules_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= rules_ctx->kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_end *= data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_end *= data.bfs_cnt;
}
@ -286,7 +286,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *
fflush (out);
}
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra)
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx)
{
if (opencl_ctx->devices_status == STATUS_INIT)
{
@ -300,7 +300,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
if (user_options->machine_readable == true)
{
status_display_machine_readable (opencl_ctx, hashes, user_options, user_options_extra);
status_display_machine_readable (opencl_ctx, hashes, user_options, user_options_extra, rules_ctx);
return;
}
@ -701,7 +701,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
{
progress_skip = MIN (user_options->skip, data.words_base) * hashes->salts_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= data.kernel_rules_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= rules_ctx->kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_skip *= data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_skip *= data.bfs_cnt;
}
@ -710,7 +710,7 @@ void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, c
{
progress_end = MIN (user_options->limit, data.words_base) * hashes->salts_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= data.kernel_rules_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= rules_ctx->kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_end *= data.combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_end *= data.bfs_cnt;
}

@ -59,7 +59,7 @@ static void out_push (out_t *out, const u8 *pw_buf, const int pw_len)
}
}
void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const uint pws_cnt)
void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const rules_ctx_t *rules_ctx, const uint pws_cnt)
{
out_t out;
@ -112,7 +112,7 @@ void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
plain_len = pw.pw_len;
plain_len = apply_rules (data.kernel_rules_buf[pos + il_pos].cmds, &plain_buf[0], &plain_buf[4], plain_len);
plain_len = apply_rules (rules_ctx->kernel_rules_buf[pos + il_pos].cmds, &plain_buf[0], &plain_buf[4], plain_len);
if (plain_len > data.pw_max) plain_len = data.pw_max;

@ -67,6 +67,7 @@ void *thread_keypress (void *p)
user_options_extra_t *user_options_extra = data.user_options_extra;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
rules_ctx_t *rules_ctx = data.rules_ctx;
uint quiet = user_options->quiet;
@ -97,7 +98,7 @@ void *thread_keypress (void *p)
log_info ("");
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra);
status_display (opencl_ctx, hashconfig, hashes, user_options, user_options_extra, rules_ctx);
log_info ("");

@ -30,7 +30,7 @@
extern hc_global_data_t data;
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos)
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos)
{
if (device_param == NULL)
{
@ -54,9 +54,9 @@ void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
data.dictfile = (char *) weak_hash_check;
uint cmd0_rule_old = data.kernel_rules_buf[0].cmds[0];
uint cmd0_rule_old = rules_ctx->kernel_rules_buf[0].cmds[0];
data.kernel_rules_buf[0].cmds[0] = 0;
rules_ctx->kernel_rules_buf[0].cmds[0] = 0;
/**
* run the kernel
@ -93,7 +93,7 @@ void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
* result
*/
check_cracked (opencl_ctx, device_param, user_options, user_options_extra, hashconfig, hashes, salt_pos);
check_cracked (opencl_ctx, device_param, user_options, user_options_extra, rules_ctx, hashconfig, hashes, salt_pos);
/**
* cleanup
@ -110,5 +110,5 @@ void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
data.dictfile = dictfile_old;
data.kernel_rules_buf[0].cmds[0] = cmd0_rule_old;
rules_ctx->kernel_rules_buf[0].cmds[0] = cmd0_rule_old;
}

@ -285,7 +285,7 @@ void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len
//}
}
u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const user_options_extra_t *user_options_extra, FILE *fd, const char *dictfile, dictstat_ctx_t *dictstat_ctx)
u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const rules_ctx_t *rules_ctx, FILE *fd, const char *dictfile, dictstat_ctx_t *dictstat_ctx)
{
hc_signal (NULL);
@ -325,7 +325,7 @@ u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const u
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
keyspace *= data.kernel_rules_cnt;
keyspace *= rules_ctx->kernel_rules_cnt;
}
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{
@ -388,7 +388,7 @@ u64 count_words (wl_data_t *wl_data, const user_options_t *user_options, const u
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
{
cnt += data.kernel_rules_cnt;
cnt += rules_ctx->kernel_rules_cnt;
}
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
{

Loading…
Cancel
Save