Introduce hashes_t; not finishe yet

pull/506/head
jsteube 8 years ago
parent 7ce2f2ff19
commit a0f6ed6832

@ -23,14 +23,6 @@
#include <windows.h>
#endif // _WIN
#if defined (__APPLE__)
typedef struct cpu_set
{
uint32_t count;
} cpu_set_t;
#endif
void set_cpu_affinity (char *cpu_affinity);
#endif // _AFFINITY_H

@ -11,13 +11,6 @@
#define BITMAP_MIN 16
#define BITMAP_MAX 24
typedef struct
{
uint bitmap_shift;
uint collisions;
} bitmap_result_t;
int sort_by_bitmap (const void *s1, const void *s2);
uint generate_bitmaps (const uint digests_cnt, const uint dgst_size, const uint dgst_shifts, char *digests_buf_ptr, const uint dgst_pos0, const uint dgst_pos1, const uint dgst_pos2, const uint dgst_pos3, const uint bitmap_mask, const uint bitmap_size, uint *bitmap_a, uint *bitmap_b, uint *bitmap_c, uint *bitmap_d, const u64 collisions_max);

@ -6,18 +6,6 @@
#ifndef _CPU_AES_H
#define _CPU_AES_H
/* AES context. */
typedef struct aes_context
{
u32 bits;
u32 rek[60];
u32 rdk[60];
} aes_context_t;
typedef aes_context_t aes_ctx;
#define AES_KEY aes_ctx
void AES_set_encrypt_key (const u8 *key, int keysize, AES_KEY *aes_key);
void AES_set_decrypt_key (const u8 *key, int keysize, AES_KEY *aes_key);

@ -20,226 +20,4 @@
attr = NULL; \
}
typedef struct
{
/**
* threads
*/
opencl_ctx_t *opencl_ctx;
uint shutdown_inner;
uint shutdown_outer;
/**
* workload specific
*/
uint hardware_power_all;
uint kernel_power_all;
u64 kernel_power_final; // we save that so that all divisions are done from the same base
/**
* attack specific
*/
uint wordlist_mode;
uint hashlist_mode;
uint hashlist_format;
uint attack_mode;
uint attack_kern;
uint kernel_rules_cnt;
kernel_rule_t *kernel_rules_buf;
uint combs_mode;
uint combs_cnt;
uint bfs_cnt;
uint css_cnt;
cs_t *css_buf;
cs_t *root_css_buf;
cs_t *markov_css_buf;
char *rule_buf_l;
char *rule_buf_r;
int rule_len_l;
int rule_len_r;
/**
* hardware watchdog
*/
#if defined (HAVE_HWMON)
void *hm_adl;
void *hm_nvml;
void *hm_nvapi;
void *hm_xnvctrl;
hm_attrs_t hm_device[DEVICES_MAX];
#endif
/**
* hashes
*/
uint digests_cnt;
uint digests_done;
uint digests_saved;
void *digests_buf;
uint *digests_shown;
uint *digests_shown_tmp;
uint salts_cnt;
uint salts_done;
salt_t *salts_buf;
uint *salts_shown;
void *esalts_buf;
uint scrypt_tmp_size;
uint scrypt_tmto_final;
/**
* logging
*/
uint logfile_disable;
char *logfile;
char *topid;
char *subid;
/**
* crack-per-time
*/
cpt_t cpt_buf[CPT_BUF];
int cpt_pos;
time_t cpt_start;
u64 cpt_total;
/**
* user
*/
char *dictfile;
char *dictfile2;
char *mask;
uint maskcnt;
uint maskpos;
char *session;
char *hashfile;
char *homedir;
char *install_dir;
char *profile_dir;
char *session_dir;
char *shared_dir;
uint outfile_check_timer;
char *eff_restore_file;
char *new_restore_file;
char *induction_directory;
char *outfile_check_directory;
uint loopback;
uint restore;
uint restore_timer;
uint restore_disable;
uint status;
uint status_timer;
uint machine_readable;
uint quiet;
uint force;
uint benchmark;
uint runtime;
uint remove;
uint remove_timer;
uint hex_charset;
uint hex_salt;
uint hex_wordlist;
uint pw_min;
uint pw_max;
uint powertune_enable;
uint scrypt_tmto;
uint segment_size;
char *truecrypt_keyfiles;
char *veracrypt_keyfiles;
uint veracrypt_pim;
char *custom_charset_1;
char *custom_charset_2;
char *custom_charset_3;
char *custom_charset_4;
hashconfig_t *hashconfig;
outfile_ctx_t *outfile_ctx;
potfile_ctx_t *potfile_ctx;
loopback_ctx_t *loopback_ctx;
debugfile_ctx_t *debugfile_ctx;
#if defined (HAVE_HWMON)
uint gpu_temp_disable;
uint gpu_temp_abort;
uint gpu_temp_retain;
#endif
char **rp_files;
uint rp_files_cnt;
uint rp_gen;
uint rp_gen_seed;
/**
* used for restore
*/
u64 skip;
u64 limit;
restore_data_t *rd;
u64 checkpoint_cur_words; // used for the "stop at next checkpoint" feature
/**
* status, timer
*/
time_t runtime_start;
time_t runtime_stop;
time_t prepare_time;
time_t proc_start;
time_t proc_stop;
u64 words_cnt;
u64 words_cur;
u64 words_base;
u64 *words_progress_done; // progress number of words done per salt
u64 *words_progress_rejected; // progress number of words rejected per salt
u64 *words_progress_restored; // progress number of words restored per salt
hc_timer_t timer_running; // timer on current dict
hc_timer_t timer_paused; // timer on current dict
double ms_paused; // timer on current dict
/**
* hash_info and username
*/
hashinfo_t **hash_info;
uint username;
} hc_global_data_t;
#endif // _DATA_H

@ -10,14 +10,6 @@
#define DEBUG_MODE 0
typedef struct
{
FILE *fp;
char *filename;
uint mode;
} debugfile_ctx_t;
int debugfile_init (debugfile_ctx_t *debugfile_ctx, const uint debug_mode, const char *debug_file);
void debugfile_destroy (debugfile_ctx_t *debugfile_ctx);
void debugfile_format_plain (debugfile_ctx_t *debugfile_ctx, const u8 *plain_ptr, const u32 plain_len);

@ -17,34 +17,6 @@
#define MAX_DICTSTAT 10000
typedef struct
{
u64 cnt;
#if defined (_POSIX)
struct stat stat;
#endif
#if defined (_WIN)
struct __stat64 stat;
#endif
} dictstat_t;
typedef struct
{
char *filename;
dictstat_t *base;
#if defined (_POSIX)
size_t cnt;
#else
uint cnt;
#endif
} dictstat_ctx_t;
int sort_by_dictstat (const void *s1, const void *s2);
void dictstat_init (dictstat_ctx_t *dictstat_ctx, char *profile_dir);

@ -17,6 +17,11 @@ void save_hash ();
void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, plain_t *plain);
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint salt_pos, hashconfig_t *hashconfig);
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, 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, char *hash_or_file, const uint keyspace, const uint quiet, const uint benchmark, const uint stdout_flag, const uint username, const uint remove, const uint show, const uint left);
int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, opencl_ctx_t *opencl_ctx, const uint username, const uint remove, const uint show);
void hashes_destroy (hashes_t *hashes);
#endif // _HASH_MANAGEMENT_H

@ -27,9 +27,9 @@ typedef enum hlfmt_name
char *strhlfmt (const uint hashfile_format);
void hlfmt_hash (uint hashfile_format, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len, hashconfig_t *hashconfig);
void hlfmt_user (uint hashfile_format, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len, hashconfig_t *hashconfig);
void hlfmt_hash (uint hashfile_format, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len, const hashconfig_t *hashconfig);
void hlfmt_user (uint hashfile_format, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len, const hashconfig_t *hashconfig);
uint hlfmt_detect (FILE *fp, uint max_check, hashconfig_t *hashconfig);
uint hlfmt_detect (FILE *fp, uint max_check, const hashconfig_t *hashconfig);
#endif // _HLFMT_H

@ -10,20 +10,6 @@
#define GPU_TEMP_ABORT 90
#define GPU_TEMP_RETAIN 75
typedef struct
{
HM_ADAPTER_ADL adl;
HM_ADAPTER_NVML nvml;
HM_ADAPTER_NVAPI nvapi;
HM_ADAPTER_XNVCTRL xnvctrl;
int od_version;
int fan_get_supported;
int fan_set_supported;
} hm_attrs_t;
int get_adapters_num_adl (void *adl, int *iNumberAdapters);
int hm_get_adapter_index_adl (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);

@ -27,34 +27,6 @@
#define LM_WEAK_HASH "\x4e\xcf\x0d\x0c\x0a\xe2\xfb\xc1"
#define LM_MASKED_PLAIN "[notfound]"
/**
* types
*/
struct _hashconfig
{
char separator;
uint hash_mode;
uint hash_type;
uint salt_type;
uint attack_exec;
uint opts_type;
uint kern_type;
uint dgst_size;
uint esalt_size;
uint opti_type;
uint is_salted;
uint dgst_pos0;
uint dgst_pos1;
uint dgst_pos2;
uint dgst_pos3;
int (*parse_func) (char *, uint, hash_t *, const struct _hashconfig *);
};
typedef struct _hashconfig hashconfig_t;
/**
* option types
*/
@ -1660,17 +1632,17 @@ int opencart_parse_hash (char *input_buf, uint input_len, hash_t *hash
char *stroptitype (const uint opti_type);
char *strhashtype (const uint hash_mode);
char *strparser (const uint parser_status);
char *strparser (const uint parser_status);
void to_hccap_t (hccap_t *hccap, uint salt_pos, uint digest_pos, hashconfig_t *hashconfig, void *digests_buf, salt_t *salts_buf, void *esalts_buf);
void to_hccap_t (hccap_t *hccap, const uint salt_pos, const uint digest_pos, const hashconfig_t *hashconfig, const hashes_t *hashes);
void ascii_digest (char *out_buf, uint salt_pos, uint digest_pos, hashconfig_t *hashconfig, void *digests_buf, salt_t *salts_buf, void *esalts_buf, hashinfo_t **hash_info, char *hashfile);
void ascii_digest (char *out_buf, const uint salt_pos, const uint digest_pos, const hashconfig_t *hashconfig, const hashes_t *hashes);
int hashconfig_init (hashconfig_t *hashconfig, const uint hash_mode, const char separator, const uint hex_salt);
void hashconfig_destroy (hashconfig_t *hashconfig);
uint hashconfig_general_pw_min (hashconfig_t *hashconfig);
uint hashconfig_general_pw_max (hashconfig_t *hashconfig);
void hashconfig_general_defaults (hashconfig_t *hashconfig, salt_t *salts_buf, const int salts_cnt, void *esalts_buf, char *optional_param1);
void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, char *optional_param1);
void hashconfig_benchmark_defaults (hashconfig_t *hashconfig, salt_t *salt, void *esalt);
char *hashconfig_benchmark_mask (hashconfig_t *hashconfig);

@ -14,13 +14,6 @@
#define LOOPBACK 0
#define LOOPBACK_FILE "hashcat.loopback"
typedef struct
{
FILE *fp;
char *filename;
} loopback_ctx_t;
void loopback_init (loopback_ctx_t *loopback_ctx);
void loopback_destroy (loopback_ctx_t *loopback_ctx);
int loopback_write_open (loopback_ctx_t *loopback_ctx, const char *induction_directory);

@ -29,20 +29,6 @@
#define INCREMENT_MIN 1
#define INCREMENT_MAX PW_MAX
typedef struct
{
uint cs_buf[0x100];
uint cs_len;
} cs_t;
typedef struct
{
uint key;
u64 val;
} hcstat_table_t;
void mp_css_to_uniq_tbl (uint css_cnt, cs_t *css, uint uniq_tbls[SP_PW_MAX][CHARSIZ]);
void mp_cut_at (char *mask, uint max);
uint mp_get_length (char *mask);

@ -9,8 +9,6 @@
#include <stdio.h>
#include <errno.h>
#define PARAMCNT 64
#define KERNEL_ACCEL 0
#define KERNEL_LOOPS 0
#define KERNEL_RULES 1024
@ -45,229 +43,6 @@ typedef enum vendor_id
} vendor_id_t;
typedef struct __hc_device_param hc_device_param_t;
struct __hc_device_param
{
cl_device_id device;
cl_device_type device_type;
uint device_id;
uint platform_devices_id; // for mapping with hms devices
bool skipped;
uint sm_major;
uint sm_minor;
uint kernel_exec_timeout;
uint device_processors;
u64 device_maxmem_alloc;
u64 device_global_mem;
u32 device_maxclock_frequency;
size_t device_maxworkgroup_size;
uint vector_width;
uint kernel_threads;
uint kernel_loops;
uint kernel_accel;
uint kernel_loops_min;
uint kernel_loops_max;
uint kernel_accel_min;
uint kernel_accel_max;
uint kernel_power;
uint hardware_power;
size_t size_pws;
size_t size_tmps;
size_t size_hooks;
size_t size_bfs;
size_t size_combs;
size_t size_rules;
size_t size_rules_c;
size_t size_root_css;
size_t size_markov_css;
size_t size_digests;
size_t size_salts;
size_t size_shown;
size_t size_results;
size_t size_plains;
FILE *combs_fp;
comb_t *combs_buf;
void *hooks_buf;
pw_t *pws_buf;
uint pws_cnt;
u64 words_off;
u64 words_done;
uint outerloop_pos;
uint outerloop_left;
uint innerloop_pos;
uint innerloop_left;
uint exec_pos;
double exec_ms[EXEC_CACHE];
// workaround cpu spinning
double exec_us_prev1[EXPECTED_ITERATIONS];
double exec_us_prev2[EXPECTED_ITERATIONS];
double exec_us_prev3[EXPECTED_ITERATIONS];
// this is "current" speed
uint speed_pos;
u64 speed_cnt[SPEED_CACHE];
double speed_ms[SPEED_CACHE];
hc_timer_t timer_speed;
// device specific attributes starting
char *device_name;
char *device_vendor;
char *device_name_chksum;
char *device_version;
char *driver_version;
bool opencl_v12;
double nvidia_spin_damp;
cl_platform_id platform;
cl_uint device_vendor_id;
cl_uint platform_vendor_id;
cl_kernel kernel1;
cl_kernel kernel12;
cl_kernel kernel2;
cl_kernel kernel23;
cl_kernel kernel3;
cl_kernel kernel_mp;
cl_kernel kernel_mp_l;
cl_kernel kernel_mp_r;
cl_kernel kernel_amp;
cl_kernel kernel_tm;
cl_kernel kernel_weak;
cl_kernel kernel_memset;
cl_context context;
cl_program program;
cl_program program_mp;
cl_program program_amp;
cl_command_queue command_queue;
cl_mem d_pws_buf;
cl_mem d_pws_amp_buf;
cl_mem d_words_buf_l;
cl_mem d_words_buf_r;
cl_mem d_rules;
cl_mem d_rules_c;
cl_mem d_combs;
cl_mem d_combs_c;
cl_mem d_bfs;
cl_mem d_bfs_c;
cl_mem d_tm_c;
cl_mem d_bitmap_s1_a;
cl_mem d_bitmap_s1_b;
cl_mem d_bitmap_s1_c;
cl_mem d_bitmap_s1_d;
cl_mem d_bitmap_s2_a;
cl_mem d_bitmap_s2_b;
cl_mem d_bitmap_s2_c;
cl_mem d_bitmap_s2_d;
cl_mem d_plain_bufs;
cl_mem d_digests_buf;
cl_mem d_digests_shown;
cl_mem d_salt_bufs;
cl_mem d_esalt_bufs;
cl_mem d_bcrypt_bufs;
cl_mem d_tmps;
cl_mem d_hooks;
cl_mem d_result;
cl_mem d_scryptV0_buf;
cl_mem d_scryptV1_buf;
cl_mem d_scryptV2_buf;
cl_mem d_scryptV3_buf;
cl_mem d_root_css_buf;
cl_mem d_markov_css_buf;
void *kernel_params[PARAMCNT];
void *kernel_params_mp[PARAMCNT];
void *kernel_params_mp_r[PARAMCNT];
void *kernel_params_mp_l[PARAMCNT];
void *kernel_params_amp[PARAMCNT];
void *kernel_params_tm[PARAMCNT];
void *kernel_params_memset[PARAMCNT];
u32 kernel_params_buf32[PARAMCNT];
u32 kernel_params_mp_buf32[PARAMCNT];
u64 kernel_params_mp_buf64[PARAMCNT];
u32 kernel_params_mp_r_buf32[PARAMCNT];
u64 kernel_params_mp_r_buf64[PARAMCNT];
u32 kernel_params_mp_l_buf32[PARAMCNT];
u64 kernel_params_mp_l_buf64[PARAMCNT];
u32 kernel_params_amp_buf32[PARAMCNT];
u32 kernel_params_memset_buf32[PARAMCNT];
};
typedef struct
{
int disable;
void *ocl;
cl_uint platforms_cnt;
cl_platform_id *platforms;
cl_uint platform_devices_cnt;
cl_device_id *platform_devices;
u32 devices_cnt;
u32 devices_active;
hc_device_param_t *devices_param;
u32 devices_status;
u32 opencl_platforms_filter;
u32 devices_filter;
cl_device_type device_types_filter;
u32 opencl_vector_width;
u32 opencl_vector_width_chgd;
u32 nvidia_spin_damp;
u32 nvidia_spin_damp_chgd;
uint kernel_loops;
uint kernel_loops_chgd;
uint kernel_accel;
uint kernel_accel_chgd;
uint workload_profile;
int need_adl;
int need_nvml;
int need_nvapi;
int need_xnvctrl;
} opencl_ctx_t;
void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources);
void writeProgramBin (char *dst, u8 *binary, size_t binary_size);
@ -283,7 +58,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 uint pws_cnt);
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, 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 uint pws_cnt);
int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const char *opencl_platforms, const char *opencl_devices, const char *opencl_device_types, const uint opencl_vector_width, const uint opencl_vector_width_chgd, const uint nvidia_spin_damp, const uint nvidia_spin_damp_chgd, const uint workload_profile, const uint kernel_accel, const uint kernel_accel_chgd, const uint kernel_loops, const uint kernel_loops_chgd, const uint keyspace, const uint stdout_flag);
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx);

@ -22,22 +22,12 @@ typedef enum outfile_fmt
} outfile_fmt_t;
typedef struct
{
char *filename;
FILE *fp;
uint outfile_format;
uint outfile_autohex;
} outfile_ctx_t;
void outfile_init (outfile_ctx_t *outfile_ctx, char *outfile, const uint outfile_format, const uint outfile_autohex);
void outfile_destroy (outfile_ctx_t *outfile_ctx);
void outfile_format_plain (outfile_ctx_t *outfile_ctx, const unsigned char *plain_ptr, const uint plain_len);
void outfile_write_open (outfile_ctx_t *outfile_ctx);
void outfile_write_close (outfile_ctx_t *outfile_ctx);
void outfile_write (outfile_ctx_t *outfile_ctx, const char *out_buf, const unsigned char *plain_ptr, const uint plain_len, const u64 crackpos, const unsigned char *username, const uint user_len, const hashconfig_t *hashconfig);
void outfile_init (outfile_ctx_t *outfile_ctx, char *outfile, const uint outfile_format, const uint outfile_autohex);
void outfile_destroy (outfile_ctx_t *outfile_ctx);
void outfile_format_plain (outfile_ctx_t *outfile_ctx, const unsigned char *plain_ptr, const uint plain_len);
void outfile_write_open (outfile_ctx_t *outfile_ctx);
void outfile_write_close (outfile_ctx_t *outfile_ctx);
void outfile_write (outfile_ctx_t *outfile_ctx, const char *out_buf, const unsigned char *plain_ptr, const uint plain_len, const u64 crackpos, const unsigned char *username, const uint user_len, const hashconfig_t *hashconfig);
int outfile_and_hashfile (outfile_ctx_t *outfile_ctx, hashes_t *hashes);
#endif // _OUTFILE_H

@ -8,6 +8,8 @@
#define OUTFILE_CHECK_TIMER 5
#define OUTFILES_DIR "outfiles"
void *thread_outfile_remove (void *p);
#endif // _OUTFILE_CHECK_H

@ -15,30 +15,6 @@
#define INCR_POT 1000
typedef struct
{
char plain_buf[HCBUFSIZ_TINY];
int plain_len;
hash_t hash;
} pot_t;
typedef struct
{
int disable;
FILE *fp;
char *filename;
pot_t *pot;
uint pot_cnt;
uint pot_avail;
uint pot_hashes_avail;
} potfile_ctx_t;
int sort_by_pot (const void *v1, const void *v2);
int sort_by_salt_buf (const void *v1, const void *v2);
int sort_by_hash_t_salt (const void *v1, const void *v2);
@ -58,7 +34,7 @@ void potfile_show_request (potfile_ctx_t *potfile_ctx, const hashconfig_t *h
void potfile_left_request (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hashes_buf, int (*sort_by_pot) (const void *, const void *));
void potfile_show_request_lm (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *));
void potfile_left_request_lm (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *));
int potfile_remove_parse (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, const hash_t *hashes_buf, const uint hashes_cnt);
int potfile_remove_parse (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes);
void potfile_destroy (potfile_ctx_t *potfile_ctx);
#endif // _POTFILE_H

@ -31,22 +31,6 @@
#define LIMIT 0
#define KEYSPACE 0
typedef struct
{
int version;
char cwd[256];
u32 pid;
u32 dictpos;
u32 maskpos;
u64 words_cur;
u32 argc;
char **argv;
} restore_data_t;
u64 get_lowest_words_done (opencl_ctx_t *opencl_ctx);
restore_data_t *init_restore (int argc, char **argv);

@ -80,20 +80,6 @@
#define RULE_BUF_R ":"
#define INCR_RULES 10000
typedef struct
{
uint len;
char buf[0x100];
} cpu_rule_t;
typedef struct
{
uint cmds[0x100];
} kernel_rule_t;
int generate_random_rule (char rule_buf[RP_RULE_BUFSIZ], u32 rp_gen_func_min, u32 rp_gen_func_max);
int _old_apply_rule (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len, char out[BLOCK_SIZE]);

@ -31,9 +31,9 @@ typedef enum status_rc
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);
void status_display (opencl_ctx_t *opencl_ctx);
void status_benchmark_automate (opencl_ctx_t *opencl_ctx);
void status_benchmark (opencl_ctx_t *opencl_ctx);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes);
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes);
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);
#endif // _STATUS_H

@ -22,15 +22,6 @@
#define STDOUT_FLAG 0
typedef struct
{
FILE *fp;
char buf[BUFSIZ];
int len;
} out_t;
void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint pws_cnt);
#endif // _STDOUT_H

@ -6,20 +6,6 @@
#ifndef _TIMER_H
#define _TIMER_H
#if defined (_POSIX)
#include <sys/time.h>
#endif
#if defined (_WIN)
#include <windows.h>
#endif
#if defined (_WIN)
typedef LARGE_INTEGER hc_timer_t;
#elif defined (_POSIX)
typedef struct timeval hc_timer_t;
#endif
#if defined (_WIN)
#define hc_timer_get(a,r) { hc_timer_t hr_freq; QueryPerformanceFrequency (&hr_freq); hc_timer_t hr_tmp; hc_timer_set (&hr_tmp); (r) = (double) ((double) (hr_tmp.QuadPart - (a).QuadPart) / (double) (hr_freq.QuadPart / 1000)); }

@ -11,35 +11,6 @@
#define TUNING_DB_FILE "hashcat.hctune"
typedef struct
{
char *device_name;
char *alias_name;
} tuning_db_alias_t;
typedef struct
{
char *device_name;
int attack_mode;
int hash_type;
int workload_profile;
int vector_width;
int kernel_accel;
int kernel_loops;
} tuning_db_entry_t;
typedef struct
{
tuning_db_alias_t *alias_buf;
int alias_cnt;
tuning_db_entry_t *entry_buf;
int entry_cnt;
} tuning_db_t;
void tuning_db_destroy (tuning_db_t *tuning_db);
tuning_db_t *tuning_db_alloc (FILE *fp);
tuning_db_t *tuning_db_init (const char *tuning_db_file);

@ -7,11 +7,50 @@
#define _TYPES_H
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <sys/time.h>
#if defined (_WIN)
#include <windows.h>
#if defined (_BASETSD_H)
#else
typedef UINT8 uint8_t;
typedef UINT16 uint16_t;
typedef UINT32 uint32_t;
typedef UINT64 uint64_t;
typedef INT8 int8_t;
typedef INT16 int16_t;
typedef INT32 int32_t;
typedef INT64 int64_t;
#endif
#endif // _WIN
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef uint32_t uint; // we need to get rid of this sooner or later, for consistency
#include "ext_OpenCL.h"
#include "ext_ADL.h"
#include "ext_nvapi.h"
#include "ext_nvml.h"
#include "ext_xnvctrl.h"
// timer
#if defined (_WIN)
typedef LARGE_INTEGER hc_timer_t;
#elif defined (_POSIX)
typedef struct timeval hc_timer_t;
#endif
#define OUTFILES_DIR "outfiles"
typedef enum wl_mode
{
@ -89,38 +128,36 @@ typedef enum kern_run_mp
/**
* status
* structs
*/
typedef struct
{
uint salt_buf[16];
uint salt_buf_pc[8];
u32 salt_buf[16];
u32 salt_buf_pc[8];
uint salt_len;
uint salt_iter;
uint salt_sign[2];
u32 salt_len;
u32 salt_iter;
u32 salt_sign[2];
uint keccak_mdlen;
uint truecrypt_mdlen;
u32 keccak_mdlen;
u32 truecrypt_mdlen;
uint digests_cnt;
uint digests_done;
u32 digests_cnt;
u32 digests_done;
uint digests_offset;
u32 digests_offset;
uint scrypt_N;
uint scrypt_r;
uint scrypt_p;
u32 scrypt_N;
u32 scrypt_r;
u32 scrypt_p;
} salt_t;
typedef struct
{
char *user_name;
uint user_len;
u32 user_len;
} user_t;
@ -141,9 +178,59 @@ typedef struct
} hash_t;
typedef struct
{
char *hashfile;
u32 hashlist_mode;
u32 hashlist_format;
u32 digests_cnt;
u32 digests_done;
u32 digests_saved;
void *digests_buf;
u32 *digests_shown;
u32 *digests_shown_tmp;
u32 salts_cnt;
u32 salts_done;
salt_t *salts_buf;
u32 *salts_shown;
void *esalts_buf;
u32 hashes_cnt;
hash_t *hashes_buf;
hashinfo_t **hash_info;
} hashes_t;
struct _hashconfig
{
char separator;
u32 hash_mode;
u32 hash_type;
u32 salt_type;
u32 attack_exec;
u32 opts_type;
u32 kern_type;
u32 dgst_size;
u32 esalt_size;
u32 opti_type;
u32 is_salted;
u32 dgst_pos0;
u32 dgst_pos1;
u32 dgst_pos2;
u32 dgst_pos3;
int (*parse_func) (char *, u32, hash_t *, const struct _hashconfig *);
};
typedef struct _hashconfig hashconfig_t;
typedef struct
{
@ -159,61 +246,697 @@ typedef struct
typedef struct
{
uint i;
u32 i;
} bf_t;
typedef struct
{
uint b[32];
u32 b[32];
} bs_word_t;
typedef struct
{
uint i[8];
u32 i[8];
uint pw_len;
u32 pw_len;
} comb_t;
#define CPT_BUF 0x20000
typedef struct
{
uint cracked;
u32 cracked;
time_t timestamp;
} cpt_t;
typedef struct
{
uint salt_pos;
uint digest_pos;
uint hash_pos;
uint gidvid;
uint il_pos;
u32 salt_pos;
u32 digest_pos;
u32 hash_pos;
u32 gidvid;
u32 il_pos;
} plain_t;
typedef struct
{
uint word_buf[16];
u32 word_buf[16];
} wordl_t;
typedef struct
{
uint word_buf[1];
u32 word_buf[1];
} wordr_t;
#define PARAMCNT 64
typedef struct __hc_device_param hc_device_param_t;
struct __hc_device_param
{
cl_device_id device;
cl_device_type device_type;
u32 device_id;
u32 platform_devices_id; // for mapping with hms devices
bool skipped;
u32 sm_major;
u32 sm_minor;
u32 kernel_exec_timeout;
u32 device_processors;
u64 device_maxmem_alloc;
u64 device_global_mem;
u32 device_maxclock_frequency;
size_t device_maxworkgroup_size;
u32 vector_width;
u32 kernel_threads;
u32 kernel_loops;
u32 kernel_accel;
u32 kernel_loops_min;
u32 kernel_loops_max;
u32 kernel_accel_min;
u32 kernel_accel_max;
u32 kernel_power;
u32 hardware_power;
size_t size_pws;
size_t size_tmps;
size_t size_hooks;
size_t size_bfs;
size_t size_combs;
size_t size_rules;
size_t size_rules_c;
size_t size_root_css;
size_t size_markov_css;
size_t size_digests;
size_t size_salts;
size_t size_shown;
size_t size_results;
size_t size_plains;
FILE *combs_fp;
comb_t *combs_buf;
void *hooks_buf;
pw_t *pws_buf;
u32 pws_cnt;
u64 words_off;
u64 words_done;
u32 outerloop_pos;
u32 outerloop_left;
u32 innerloop_pos;
u32 innerloop_left;
u32 exec_pos;
double exec_ms[EXEC_CACHE];
// workaround cpu spinning
double exec_us_prev1[EXPECTED_ITERATIONS];
double exec_us_prev2[EXPECTED_ITERATIONS];
double exec_us_prev3[EXPECTED_ITERATIONS];
// this is "current" speed
u32 speed_pos;
u64 speed_cnt[SPEED_CACHE];
double speed_ms[SPEED_CACHE];
hc_timer_t timer_speed;
// device specific attributes starting
char *device_name;
char *device_vendor;
char *device_name_chksum;
char *device_version;
char *driver_version;
bool opencl_v12;
double nvidia_spin_damp;
cl_platform_id platform;
cl_uint device_vendor_id;
cl_uint platform_vendor_id;
cl_kernel kernel1;
cl_kernel kernel12;
cl_kernel kernel2;
cl_kernel kernel23;
cl_kernel kernel3;
cl_kernel kernel_mp;
cl_kernel kernel_mp_l;
cl_kernel kernel_mp_r;
cl_kernel kernel_amp;
cl_kernel kernel_tm;
cl_kernel kernel_weak;
cl_kernel kernel_memset;
cl_context context;
cl_program program;
cl_program program_mp;
cl_program program_amp;
cl_command_queue command_queue;
cl_mem d_pws_buf;
cl_mem d_pws_amp_buf;
cl_mem d_words_buf_l;
cl_mem d_words_buf_r;
cl_mem d_rules;
cl_mem d_rules_c;
cl_mem d_combs;
cl_mem d_combs_c;
cl_mem d_bfs;
cl_mem d_bfs_c;
cl_mem d_tm_c;
cl_mem d_bitmap_s1_a;
cl_mem d_bitmap_s1_b;
cl_mem d_bitmap_s1_c;
cl_mem d_bitmap_s1_d;
cl_mem d_bitmap_s2_a;
cl_mem d_bitmap_s2_b;
cl_mem d_bitmap_s2_c;
cl_mem d_bitmap_s2_d;
cl_mem d_plain_bufs;
cl_mem d_digests_buf;
cl_mem d_digests_shown;
cl_mem d_salt_bufs;
cl_mem d_esalt_bufs;
cl_mem d_bcrypt_bufs;
cl_mem d_tmps;
cl_mem d_hooks;
cl_mem d_result;
cl_mem d_scryptV0_buf;
cl_mem d_scryptV1_buf;
cl_mem d_scryptV2_buf;
cl_mem d_scryptV3_buf;
cl_mem d_root_css_buf;
cl_mem d_markov_css_buf;
void *kernel_params[PARAMCNT];
void *kernel_params_mp[PARAMCNT];
void *kernel_params_mp_r[PARAMCNT];
void *kernel_params_mp_l[PARAMCNT];
void *kernel_params_amp[PARAMCNT];
void *kernel_params_tm[PARAMCNT];
void *kernel_params_memset[PARAMCNT];
u32 kernel_params_buf32[PARAMCNT];
u32 kernel_params_mp_buf32[PARAMCNT];
u64 kernel_params_mp_buf64[PARAMCNT];
u32 kernel_params_mp_r_buf32[PARAMCNT];
u64 kernel_params_mp_r_buf64[PARAMCNT];
u32 kernel_params_mp_l_buf32[PARAMCNT];
u64 kernel_params_mp_l_buf64[PARAMCNT];
u32 kernel_params_amp_buf32[PARAMCNT];
u32 kernel_params_memset_buf32[PARAMCNT];
};
typedef struct
{
int disable;
void *ocl;
cl_uint platforms_cnt;
cl_platform_id *platforms;
cl_uint platform_devices_cnt;
cl_device_id *platform_devices;
u32 devices_cnt;
u32 devices_active;
hc_device_param_t *devices_param;
u32 devices_status;
u32 opencl_platforms_filter;
u32 devices_filter;
cl_device_type device_types_filter;
u32 opencl_vector_width;
u32 opencl_vector_width_chgd;
u32 nvidia_spin_damp;
u32 nvidia_spin_damp_chgd;
u32 kernel_loops;
u32 kernel_loops_chgd;
u32 kernel_accel;
u32 kernel_accel_chgd;
u32 workload_profile;
int need_adl;
int need_nvml;
int need_nvapi;
int need_xnvctrl;
} opencl_ctx_t;
#if defined (__APPLE__)
typedef struct cpu_set
{
u32 count;
} cpu_set_t;
#endif
typedef struct
{
u32 bitmap_shift;
u32 collisions;
} bitmap_result_t;
/* AES context. */
typedef struct aes_context
{
u32 bits;
u32 rek[60];
u32 rdk[60];
} aes_context_t;
typedef aes_context_t aes_ctx;
typedef struct
{
FILE *fp;
char *filename;
u32 mode;
} debugfile_ctx_t;
typedef struct
{
u64 cnt;
#if defined (_POSIX)
struct stat stat;
#endif
#if defined (_WIN)
struct __stat64 stat;
#endif
} dictstat_t;
typedef struct
{
char *filename;
dictstat_t *base;
#if defined (_POSIX)
size_t cnt;
#else
u32 cnt;
#endif
} dictstat_ctx_t;
typedef struct
{
HM_ADAPTER_ADL adl;
HM_ADAPTER_NVML nvml;
HM_ADAPTER_NVAPI nvapi;
HM_ADAPTER_XNVCTRL xnvctrl;
int od_version;
int fan_get_supported;
int fan_set_supported;
} hm_attrs_t;
typedef struct
{
FILE *fp;
char *filename;
} loopback_ctx_t;
typedef struct
{
u32 cs_buf[0x100];
u32 cs_len;
} cs_t;
typedef struct
{
u32 key;
u64 val;
} hcstat_table_t;
typedef struct
{
char *filename;
FILE *fp;
u32 outfile_format;
u32 outfile_autohex;
} outfile_ctx_t;
typedef struct
{
char plain_buf[HCBUFSIZ_TINY];
int plain_len;
hash_t hash;
} pot_t;
typedef struct
{
int disable;
FILE *fp;
char *filename;
pot_t *pot;
u32 pot_cnt;
u32 pot_avail;
u32 pot_hashes_avail;
} potfile_ctx_t;
typedef struct
{
int version;
char cwd[256];
u32 pid;
u32 dictpos;
u32 maskpos;
u64 words_cur;
u32 argc;
char **argv;
} restore_data_t;
typedef struct
{
u32 len;
char buf[0x100];
} cpu_rule_t;
typedef struct
{
u32 cmds[0x100];
} kernel_rule_t;
typedef struct
{
FILE *fp;
char buf[BUFSIZ];
int len;
} out_t;
typedef struct
{
char *device_name;
char *alias_name;
} tuning_db_alias_t;
typedef struct
{
char *device_name;
int attack_mode;
int hash_type;
int workload_profile;
int vector_width;
int kernel_accel;
int kernel_loops;
} tuning_db_entry_t;
typedef struct
{
tuning_db_alias_t *alias_buf;
int alias_cnt;
tuning_db_entry_t *entry_buf;
int entry_cnt;
} tuning_db_t;
typedef struct
{
char *buf;
u32 incr;
u32 avail;
u32 cnt;
u32 pos;
} wl_data_t;
typedef struct
{
/**
* threads
*/
opencl_ctx_t *opencl_ctx;
u32 shutdown_inner;
u32 shutdown_outer;
/**
* workload specific
*/
u32 hardware_power_all;
u32 kernel_power_all;
u64 kernel_power_final; // we save that so that all divisions are done from the same base
/**
* attack specific
*/
u32 wordlist_mode;
u32 attack_mode;
u32 attack_kern;
u32 kernel_rules_cnt;
kernel_rule_t *kernel_rules_buf;
u32 combs_mode;
u32 combs_cnt;
u32 bfs_cnt;
u32 css_cnt;
cs_t *css_buf;
cs_t *root_css_buf;
cs_t *markov_css_buf;
char *rule_buf_l;
char *rule_buf_r;
int rule_len_l;
int rule_len_r;
/**
* hardware watchdog
*/
#if defined (HAVE_HWMON)
void *hm_adl;
void *hm_nvml;
void *hm_nvapi;
void *hm_xnvctrl;
hm_attrs_t hm_device[DEVICES_MAX];
#endif
/**
* hashes
*/
u32 scrypt_tmp_size;
u32 scrypt_tmto_final;
/**
* logging
*/
u32 logfile_disable;
char *logfile;
char *topid;
char *subid;
/**
* crack-per-time
*/
cpt_t cpt_buf[CPT_BUF];
int cpt_pos;
time_t cpt_start;
u64 cpt_total;
/**
* user
*/
char *dictfile;
char *dictfile2;
char *mask;
u32 maskcnt;
u32 maskpos;
char *session;
char *homedir;
char *install_dir;
char *profile_dir;
char *session_dir;
char *shared_dir;
u32 outfile_check_timer;
char *eff_restore_file;
char *new_restore_file;
char *induction_directory;
char *outfile_check_directory;
u32 loopback;
u32 restore;
u32 restore_timer;
u32 restore_disable;
u32 status;
u32 status_timer;
u32 machine_readable;
u32 quiet;
u32 force;
u32 benchmark;
u32 runtime;
u32 remove;
u32 remove_timer;
u32 hex_charset;
u32 hex_salt;
u32 hex_wordlist;
u32 pw_min;
u32 pw_max;
u32 powertune_enable;
u32 scrypt_tmto;
u32 segment_size;
char *truecrypt_keyfiles;
char *veracrypt_keyfiles;
u32 veracrypt_pim;
char *custom_charset_1;
char *custom_charset_2;
char *custom_charset_3;
char *custom_charset_4;
hashconfig_t *hashconfig;
hashes_t *hashes;
outfile_ctx_t *outfile_ctx;
potfile_ctx_t *potfile_ctx;
loopback_ctx_t *loopback_ctx;
debugfile_ctx_t *debugfile_ctx;
#if defined (HAVE_HWMON)
u32 gpu_temp_disable;
u32 gpu_temp_abort;
u32 gpu_temp_retain;
#endif
char **rp_files;
u32 rp_files_cnt;
u32 rp_gen;
u32 rp_gen_seed;
/**
* used for restore
*/
u64 skip;
u64 limit;
restore_data_t *rd;
u64 checkpoint_cur_words; // used for the "stop at next checkpoint" feature
/**
* status, timer
*/
time_t runtime_start;
time_t runtime_stop;
time_t prepare_time;
time_t proc_start;
time_t proc_stop;
u64 words_cnt;
u64 words_cur;
u64 words_base;
u64 *words_progress_done; // progress number of words done per salt
u64 *words_progress_rejected; // progress number of words rejected per salt
u64 *words_progress_restored; // progress number of words restored per salt
hc_timer_t timer_running; // timer on current dict
hc_timer_t timer_paused; // timer on current dict
double ms_paused; // timer on current dict
/**
* hash_info and username
*/
hashinfo_t **hash_info;
u32 username;
} hc_global_data_t;
#define RULES_MAX 256
#define PW_DICTMAX 31
#define PW_DICTMAX1 (PW_DICTMAX + 1)

@ -1,34 +0,0 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _TYPES_INT_H
#define _TYPES_INT_H
#include <stdint.h>
#include <stdbool.h>
#if defined (_WIN)
#include <windows.h>
#if defined (_BASETSD_H)
#else
typedef UINT8 uint8_t;
typedef UINT16 uint16_t;
typedef UINT32 uint32_t;
typedef UINT64 uint64_t;
typedef INT8 int8_t;
typedef INT16 int16_t;
typedef INT32 int32_t;
typedef INT64 int64_t;
#endif
#endif // _WIN
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef uint32_t uint; // we need to get rid of this sooner or later, for consistency
#endif // _TYPES_INT_H

@ -8,6 +8,6 @@
#define WEAK_HASH_THRESHOLD 100
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint salt_pos);
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos);
#endif // _WEAK_HASH_H

@ -9,16 +9,6 @@
#define HEX_WORDLIST 0
#define SEGMENT_SIZE 32
typedef struct
{
char *buf;
u32 incr;
u32 avail;
u32 cnt;
u32 pos;
} wl_data_t;
uint convert_from_hex (char *line_buf, const uint line_len);
void load_segment (wl_data_t *wl_data, FILE *fd);

@ -8,7 +8,7 @@
#endif
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "affinity.h"

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "logging.h"
#include "interface.h"
@ -20,6 +19,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "outfile.h"
#include "potfile.h"
#include "debugfile.h"

@ -4,7 +4,7 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "bitmap.h"
int sort_by_bitmap (const void *p1, const void *p2)

@ -4,7 +4,7 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "bitops.h"
u32 is_power_of_2 (const u32 v)

@ -4,7 +4,7 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "convert.h"
int is_valid_hex_char (const u8 c)

@ -6,7 +6,7 @@
#define IS_GENERIC
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "bitops.h"
#include "inc_hash_constants.h"
#include "inc_hash_functions.cl"

@ -4,9 +4,9 @@
*/
#include "common.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "types_int.h"
#include "cpu_crc32.h"
static const uint crc32tab[256] =

@ -6,7 +6,7 @@
#define IS_GENERIC
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "bitops.h"
#include "inc_hash_constants.h"
#include "inc_hash_functions.cl"

@ -6,7 +6,7 @@
#define IS_GENERIC
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "bitops.h"
#include "inc_hash_constants.h"
#include "inc_hash_functions.cl"

@ -6,7 +6,7 @@
#define IS_GENERIC
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "bitops.h"
#include "inc_hash_constants.h"
#include "inc_hash_functions.cl"

@ -6,7 +6,7 @@
#define IS_GENERIC
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "bitops.h"
#include "inc_hash_constants.h"
#include "inc_hash_functions.cl"

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -19,6 +18,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "outfile.h"
#include "potfile.h"
#include "debugfile.h"

@ -4,7 +4,7 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "logging.h"
#include "debugfile.h"

@ -4,7 +4,7 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "memory.h"
#include "filenames.h"
#include "logging.h"

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "memory.h"
#include "filehandling.h"
@ -20,6 +19,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "rp_cpu.h"
#include "terminal.h"
@ -122,6 +122,7 @@ void *thread_calc_stdin (void *p)
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
char *buf = (char *) mymalloc (HCBUFSIZ_LARGE);
@ -182,7 +183,7 @@ void *thread_calc_stdin (void *p)
{
hc_thread_mutex_lock (mux_counter);
for (uint salt_pos = 0; salt_pos < data.salts_cnt; salt_pos++)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += data.kernel_rules_cnt;
}
@ -218,7 +219,7 @@ void *thread_calc_stdin (void *p)
{
run_copy (opencl_ctx, device_param, hashconfig, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, pws_cnt);
device_param->pws_cnt = 0;
@ -253,6 +254,7 @@ void *thread_calc (void *p)
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
const uint attack_mode = data.attack_mode;
const uint attack_kern = data.attack_kern;
@ -276,7 +278,7 @@ void *thread_calc (void *p)
{
run_copy (opencl_ctx, device_param, hashconfig, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, pws_cnt);
device_param->pws_cnt = 0;
@ -427,7 +429,7 @@ void *thread_calc (void *p)
hc_thread_mutex_lock (mux_counter);
for (uint salt_pos = 0; salt_pos < data.salts_cnt; salt_pos++)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += data.kernel_rules_cnt;
}
@ -448,7 +450,7 @@ void *thread_calc (void *p)
hc_thread_mutex_lock (mux_counter);
for (uint salt_pos = 0; salt_pos < data.salts_cnt; salt_pos++)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
data.words_progress_rejected[salt_pos] += data.combs_cnt;
}
@ -494,7 +496,7 @@ void *thread_calc (void *p)
{
run_copy (opencl_ctx, device_param, hashconfig, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, pws_cnt);
run_cracker (opencl_ctx, device_param, hashconfig, hashes, pws_cnt);
device_param->pws_cnt = 0;

@ -4,7 +4,7 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "dynloader.h"

@ -4,7 +4,7 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "memory.h"
#include "filehandling.h"

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "filenames.h"

@ -8,11 +8,11 @@
#endif
#include "common.h"
#include "types.h"
#include "memory.h"
#include "folder.h"
#if defined (__APPLE__)
#include "types_int.h"
#include "logging.h"
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -23,6 +22,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "filehandling.h"
#include "rp_cpu.h"
@ -51,7 +51,7 @@ static const char HLFMT_TEXT_NSLDAPS[] = "nsldaps";
// hlfmt hashcat
static void hlfmt_hash_hashcat (char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len, hashconfig_t *hashconfig)
static void hlfmt_hash_hashcat (char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len, const hashconfig_t *hashconfig)
{
if (data.username == 0)
{
@ -80,7 +80,7 @@ static void hlfmt_hash_hashcat (char *line_buf, int line_len, char **hashbuf_pos
}
}
static void hlfmt_user_hashcat (char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len, hashconfig_t *hashconfig)
static void hlfmt_user_hashcat (char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len, const hashconfig_t *hashconfig)
{
char *pos = NULL;
int len = 0;
@ -135,7 +135,7 @@ static int hlfmt_detect_pwdump (char *line_buf, int line_len)
return 0;
}
static void hlfmt_hash_pwdump (char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len, hashconfig_t *hashconfig)
static void hlfmt_hash_pwdump (char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len, const hashconfig_t *hashconfig)
{
char *pos = NULL;
int len = 0;
@ -333,7 +333,7 @@ char *strhlfmt (const uint hashfile_format)
return ((char *) "Unknown");
}
void hlfmt_hash (uint hashfile_format, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len, hashconfig_t *hashconfig)
void hlfmt_hash (uint hashfile_format, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len, const hashconfig_t *hashconfig)
{
switch (hashfile_format)
{
@ -344,7 +344,7 @@ void hlfmt_hash (uint hashfile_format, char *line_buf, int line_len, char **hash
}
}
void hlfmt_user (uint hashfile_format, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len, hashconfig_t *hashconfig)
void hlfmt_user (uint hashfile_format, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len, const hashconfig_t *hashconfig)
{
switch (hashfile_format)
{
@ -355,7 +355,7 @@ void hlfmt_user (uint hashfile_format, char *line_buf, int line_len, char **user
}
}
uint hlfmt_detect (FILE *fp, uint max_check, hashconfig_t *hashconfig)
uint hlfmt_detect (FILE *fp, uint max_check, const hashconfig_t *hashconfig)
{
// Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -21,6 +20,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "outfile.h"
#include "potfile.h"

@ -8,7 +8,6 @@
#endif
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "bitops.h"
#include "memory.h"
@ -13110,11 +13109,15 @@ char *strparser (const uint parser_status)
return ((char *) PA_255);
}
void to_hccap_t (hccap_t *hccap, uint salt_pos, uint digest_pos, hashconfig_t *hashconfig, void *digests_buf, salt_t *salts_buf, void *esalts_buf)
void to_hccap_t (hccap_t *hccap, const uint salt_pos, const uint digest_pos, const hashconfig_t *hashconfig, const hashes_t *hashes)
{
const void *digests_buf = hashes->digests_buf;
const salt_t *salts_buf = hashes->salts_buf;
const void *esalts_buf = hashes->esalts_buf;
memset (hccap, 0, sizeof (hccap_t));
salt_t *salt = &salts_buf[salt_pos];
const salt_t *salt = &salts_buf[salt_pos];
memcpy (hccap->essid, salt->salt_buf, salt->salt_len);
@ -13169,14 +13172,20 @@ void to_hccap_t (hccap_t *hccap, uint salt_pos, uint digest_pos, hashconfig_t *h
}
}
void ascii_digest (char *out_buf, uint salt_pos, uint digest_pos, hashconfig_t *hashconfig, void *digests_buf, salt_t *salts_buf, void *esalts_buf, hashinfo_t **hash_info, char *hashfile)
void ascii_digest (char *out_buf, const uint salt_pos, const uint digest_pos, const hashconfig_t *hashconfig, const hashes_t *hashes)
{
uint hash_type = hashconfig->hash_type;
uint hash_mode = hashconfig->hash_mode;
uint salt_type = hashconfig->salt_type;
uint opts_type = hashconfig->opts_type;
uint opti_type = hashconfig->opti_type;
uint dgst_size = hashconfig->dgst_size;
void *digests_buf = hashes->digests_buf;
salt_t *salts_buf = hashes->salts_buf;
void *esalts_buf = hashes->esalts_buf;
hashinfo_t **hash_info = hashes->hash_info;
char *hashfile = hashes->hashfile;
const uint hash_type = hashconfig->hash_type;
const uint hash_mode = hashconfig->hash_mode;
const uint salt_type = hashconfig->salt_type;
const uint opts_type = hashconfig->opts_type;
const uint opti_type = hashconfig->opti_type;
const uint dgst_size = hashconfig->dgst_size;
uint len = 4096;
@ -20000,13 +20009,16 @@ uint hashconfig_general_pw_max (hashconfig_t *hashconfig)
return pw_max;
}
void hashconfig_general_defaults (hashconfig_t *hashconfig, salt_t *salts_buf, const int salts_cnt, void *esalts_buf, char *optional_param1)
void hashconfig_general_defaults (hashconfig_t *hashconfig, hashes_t *hashes, char *optional_param1)
{
salt_t *salts_buf = hashes->salts_buf;
void *esalts_buf = hashes->esalts_buf;
/**
* special modification not set from parser
*/
for (int salts_pos = 0; salts_pos < salts_cnt; salts_pos++)
for (uint salts_pos = 0; salts_pos < hashes->salts_cnt; salts_pos++)
{
switch (hashconfig->hash_mode)
{

@ -8,7 +8,6 @@
#endif
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -17,7 +16,6 @@
#include "ext_nvapi.h"
#include "ext_nvml.h"
#include "ext_xnvctrl.h"
#include "types.h"
#include "memory.h"
#include "rp_cpu.h"
#include "mpsp.h"
@ -25,6 +23,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "outfile.h"
#include "potfile.h"
#include "debugfile.h"

@ -4,7 +4,7 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "memory.h"
#include "logging.h"
#include "shared.h"

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "logging.h"
#include "memory.h"
@ -21,6 +20,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "outfile.h"
#include "potfile.h"
@ -31,7 +31,6 @@
#include "shared.h"
#include "terminal.h"
#include "monitor.h"
#include "hash_management.h"
extern hc_global_data_t data;
@ -50,6 +49,8 @@ void *thread_monitor (void *p)
uint status_left = data.status_timer;
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
#if defined (HAVE_HWMON)
uint hwmon_check = 0;
@ -85,7 +86,7 @@ void *thread_monitor (void *p)
restore_check = 1;
}
if ((data.remove == 1) && (data.hashlist_mode == HL_MODE_FILE))
if ((data.remove == 1) && (hashes->hashlist_mode == HL_MODE_FILE))
{
remove_check = 1;
}
@ -330,9 +331,9 @@ void *thread_monitor (void *p)
if (remove_left == 0)
{
if (data.digests_saved != data.digests_done)
if (hashes->digests_saved != hashes->digests_done)
{
data.digests_saved = data.digests_done;
hashes->digests_saved = hashes->digests_done;
save_hash ();
}
@ -353,7 +354,7 @@ void *thread_monitor (void *p)
if (data.quiet == 0) log_info ("");
status_display (opencl_ctx);
status_display (opencl_ctx, hashconfig, hashes);
if (data.quiet == 0) log_info ("");

@ -8,7 +8,6 @@
#endif
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -25,6 +24,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "mpsp.h"
#include "rp_cpu.h"

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "timer.h"
#include "memory.h"
@ -21,6 +20,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "status.h"
#include "stdout.h"
@ -36,7 +36,6 @@
#include "convert.h"
#include "dictstat.h"
#include "wordlist.h"
#include "hash_management.h"
extern hc_global_data_t data;
@ -940,7 +939,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, 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 uint pws_cnt)
{
char *line_buf = (char *) mymalloc (HCBUFSIZ_LARGE);
@ -992,7 +991,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
// loop start: most outer loop = salt iteration, then innerloops (if multi)
for (uint salt_pos = 0; salt_pos < data.salts_cnt; salt_pos++)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
while (opencl_ctx->devices_status == STATUS_PAUSED) hc_sleep (1);
@ -1003,7 +1002,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
if (opencl_ctx->devices_status == STATUS_QUIT) break;
if (opencl_ctx->devices_status == STATUS_BYPASS) break;
salt_t *salt_buf = &data.salts_buf[salt_pos];
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
device_param->kernel_params_buf32[27] = salt_pos;
device_param->kernel_params_buf32[31] = salt_buf->digests_cnt;
@ -1053,7 +1052,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
continue;
}
if (data.salts_shown[salt_pos] == 1)
if (hashes->salts_shown[salt_pos] == 1)
{
data.words_progress_done[salt_pos] += (u64) pws_cnt * (u64) innerloop_left;
@ -1248,7 +1247,7 @@ int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hash
if (data.benchmark == 0)
{
check_cracked (opencl_ctx, device_param, salt_pos, hashconfig);
check_cracked (opencl_ctx, device_param, hashconfig, hashes, salt_pos);
}
/**

@ -4,10 +4,10 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "logging.h"
#include "interface.h"
#include "hash_management.h"
#include "outfile.h"
void outfile_init (outfile_ctx_t *outfile_ctx, char *outfile, const uint outfile_format, const uint outfile_autohex)
@ -155,3 +155,101 @@ void outfile_write (outfile_ctx_t *outfile_ctx, const char *out_buf, const unsig
fputs (EOL, outfile_ctx->fp);
}
int outfile_and_hashfile (outfile_ctx_t *outfile_ctx, hashes_t *hashes)
{
char *outfile = outfile_ctx->filename;
if (outfile == NULL) return 0;
char *hashfile = hashes->hashfile;
if (hashfile == NULL) return 0;
#if defined (_POSIX)
struct stat tmpstat_outfile;
struct stat tmpstat_hashfile;
#endif
#if defined (_WIN)
struct stat64 tmpstat_outfile;
struct stat64 tmpstat_hashfile;
#endif
FILE *tmp_outfile_fp = fopen (outfile, "r");
if (tmp_outfile_fp)
{
#if defined (_POSIX)
fstat (fileno (tmp_outfile_fp), &tmpstat_outfile);
#endif
#if defined (_WIN)
_fstat64 (fileno (tmp_outfile_fp), &tmpstat_outfile);
#endif
fclose (tmp_outfile_fp);
}
FILE *tmp_hashfile_fp = fopen (hashfile, "r");
if (tmp_hashfile_fp)
{
#if defined (_POSIX)
fstat (fileno (tmp_hashfile_fp), &tmpstat_hashfile);
#endif
#if defined (_WIN)
_fstat64 (fileno (tmp_hashfile_fp), &tmpstat_hashfile);
#endif
fclose (tmp_hashfile_fp);
}
if (tmp_outfile_fp && tmp_outfile_fp)
{
tmpstat_outfile.st_mode = 0;
tmpstat_outfile.st_nlink = 0;
tmpstat_outfile.st_uid = 0;
tmpstat_outfile.st_gid = 0;
tmpstat_outfile.st_rdev = 0;
tmpstat_outfile.st_atime = 0;
tmpstat_hashfile.st_mode = 0;
tmpstat_hashfile.st_nlink = 0;
tmpstat_hashfile.st_uid = 0;
tmpstat_hashfile.st_gid = 0;
tmpstat_hashfile.st_rdev = 0;
tmpstat_hashfile.st_atime = 0;
#if defined (_POSIX)
tmpstat_outfile.st_blksize = 0;
tmpstat_outfile.st_blocks = 0;
tmpstat_hashfile.st_blksize = 0;
tmpstat_hashfile.st_blocks = 0;
#endif
#if defined (_POSIX)
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat)) == 0)
{
log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
return -1;
}
#endif
#if defined (_WIN)
if (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (struct stat64)) == 0)
{
log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
return -1;
}
#endif
}
return 0;
}

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "memory.h"
#include "interface.h"
@ -21,6 +20,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "outfile.h"
#include "potfile.h"
#include "debugfile.h"
@ -29,7 +29,6 @@
#include "status.h"
#include "convert.h"
#include "shared.h"
#include "hash_management.h"
#include "outfile_check.h"
extern hc_global_data_t data;
@ -39,8 +38,8 @@ void *thread_outfile_remove (void *p)
// some hash-dependent constants
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
uint dgst_size = hashconfig->dgst_size;
uint is_salted = hashconfig->is_salted;
@ -193,17 +192,17 @@ void *thread_outfile_remove (void *p)
if (parser_status == PARSER_OK)
{
for (uint salt_pos = 0; (found == 0) && (salt_pos < data.salts_cnt); salt_pos++)
for (uint salt_pos = 0; (found == 0) && (salt_pos < hashes->salts_cnt); salt_pos++)
{
if (data.salts_shown[salt_pos] == 1) continue;
if (hashes->salts_shown[salt_pos] == 1) continue;
salt_t *salt_buf = &data.salts_buf[salt_pos];
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
for (uint digest_pos = 0; (found == 0) && (digest_pos < salt_buf->digests_cnt); digest_pos++)
{
uint idx = salt_buf->digests_offset + digest_pos;
if (data.digests_shown[idx] == 1) continue;
if (hashes->digests_shown[idx] == 1) continue;
uint cracked = 0;
@ -227,7 +226,7 @@ void *thread_outfile_remove (void *p)
char *mac1_pos = line_buf + salt_buf->salt_len + 1;
char *mac2_pos = mac1_pos + 12 + 1;
wpa_t *wpas = (wpa_t *) data.esalts_buf;
wpa_t *wpas = (wpa_t *) hashes->esalts_buf;
wpa_t *wpa = &wpas[salt_pos];
// compare hex string(s) vs binary MAC address(es)
@ -258,9 +257,9 @@ void *thread_outfile_remove (void *p)
}
else
{
char *digests_buf_ptr = (char *) data.digests_buf;
char *digests_buf_ptr = (char *) hashes->digests_buf;
memcpy (digest_buf, digests_buf_ptr + (data.salts_buf[salt_pos].digests_offset * dgst_size) + (digest_pos * dgst_size), dgst_size);
memcpy (digest_buf, digests_buf_ptr + (hashes->salts_buf[salt_pos].digests_offset * dgst_size) + (digest_pos * dgst_size), dgst_size);
cracked = (sort_by_digest_p0p1 (digest_buf, hash_buf.digest) == 0);
}
@ -269,19 +268,19 @@ void *thread_outfile_remove (void *p)
{
found = 1;
data.digests_shown[idx] = 1;
hashes->digests_shown[idx] = 1;
data.digests_done++;
hashes->digests_done++;
salt_buf->digests_done++;
if (salt_buf->digests_done == salt_buf->digests_cnt)
{
data.salts_shown[salt_pos] = 1;
hashes->salts_shown[salt_pos] = 1;
data.salts_done++;
hashes->salts_done++;
if (data.salts_done == data.salts_cnt) opencl_ctx->devices_status = STATUS_CRACKED;
if (hashes->salts_done == hashes->salts_cnt) opencl_ctx->devices_status = STATUS_CRACKED;
}
}
}

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "convert.h"
#include "memory.h"
@ -192,6 +191,8 @@ void potfile_read_parse (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashcon
{
if (potfile_ctx->disable == 1) return;
if (potfile_ctx->fp == NULL) return;
potfile_ctx->pot_avail = count_lines (potfile_ctx->fp);
potfile_ctx->pot = (pot_t *) mycalloc (potfile_ctx->pot_avail, sizeof (pot_t));
@ -297,6 +298,8 @@ void potfile_read_close (potfile_ctx_t *potfile_ctx)
{
if (potfile_ctx->disable == 1) return;
if (potfile_ctx->fp == NULL) return;
fclose (potfile_ctx->fp);
}
@ -655,10 +658,13 @@ void potfile_left_request_lm (potfile_ctx_t *potfile_ctx, const hashconfig_t *ha
if (weak_hash_found == 1) myfree (pot_right_ptr);
}
int potfile_remove_parse (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, const hash_t *hashes_buf, const uint hashes_cnt)
int potfile_remove_parse (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes)
{
if (potfile_ctx->disable == 1) return 0;
hash_t *hashes_buf = hashes->hashes_buf;
uint hashes_cnt = hashes->hashes_cnt;
// no solution for these special hash types (for instane because they use hashfile in output etc)
if (hashconfig->hash_mode == 5200)

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -19,6 +18,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "rp_cpu.h"
#include "mpsp.h"

@ -8,7 +8,6 @@
#endif
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -24,6 +23,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "rp_cpu.h"
#include "terminal.h"

@ -7,7 +7,7 @@
#pragma GCC diagnostic ignored "-Wunused-function"
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "rp_cpu.h"
#include "rp_kernel_on_cpu.h"

@ -4,7 +4,7 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "shared.h"
u32 get_random_num (const u32 min, const u32 max)

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -19,6 +18,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "rp_cpu.h"
#include "terminal.h"
@ -170,7 +170,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)
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes)
{
FILE *out = stdout;
@ -232,13 +232,13 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx)
* counter
*/
u64 progress_total = data.words_cnt * data.salts_cnt;
u64 progress_total = data.words_cnt * hashes->salts_cnt;
u64 all_done = 0;
u64 all_rejected = 0;
u64 all_restored = 0;
for (uint salt_pos = 0; salt_pos < data.salts_cnt; salt_pos++)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
all_done += data.words_progress_done[salt_pos];
all_rejected += data.words_progress_rejected[salt_pos];
@ -252,7 +252,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx)
if (data.skip)
{
progress_skip = MIN (data.skip, data.words_base) * data.salts_cnt;
progress_skip = MIN (data.skip, data.words_base) * hashes->salts_cnt;
if (data.attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= data.kernel_rules_cnt;
else if (data.attack_kern == ATTACK_KERN_COMBI) progress_skip *= data.combs_cnt;
@ -261,7 +261,7 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx)
if (data.limit)
{
progress_end = MIN (data.limit, data.words_base) * data.salts_cnt;
progress_end = MIN (data.limit, data.words_base) * hashes->salts_cnt;
if (data.attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= data.kernel_rules_cnt;
else if (data.attack_kern == ATTACK_KERN_COMBI) progress_end *= data.combs_cnt;
@ -277,8 +277,8 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx)
* cracks
*/
fprintf (out, "RECHASH\t%u\t%u\t", data.digests_done, data.digests_cnt);
fprintf (out, "RECSALT\t%u\t%u\t", data.salts_done, data.salts_cnt);
fprintf (out, "RECHASH\t%u\t%u\t", hashes->digests_done, hashes->digests_cnt);
fprintf (out, "RECSALT\t%u\t%u\t", hashes->salts_done, hashes->salts_cnt);
/**
* temperature
@ -314,24 +314,17 @@ void status_display_machine_readable (opencl_ctx_t *opencl_ctx)
fflush (out);
}
void status_display (opencl_ctx_t *opencl_ctx)
void status_display (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes)
{
if (opencl_ctx->devices_status == STATUS_INIT) return;
if (opencl_ctx->devices_status == STATUS_STARTING) return;
hashconfig_t *hashconfig = data.hashconfig;
void *digests_buf = data.digests_buf;
salt_t *salts_buf = data.salts_buf;
void *esalts_buf = data.esalts_buf;
hashinfo_t **hash_info = data.hash_info;
char *hashfile = data.hashfile;
// in this case some required buffers are free'd, ascii_digest() would run into segfault
if (data.shutdown_inner == 1) return;
if (data.machine_readable == 1)
{
status_display_machine_readable (opencl_ctx);
status_display_machine_readable (opencl_ctx, hashes);
return;
}
@ -416,7 +409,7 @@ void status_display (opencl_ctx_t *opencl_ctx)
{
if (hashconfig->opti_type & OPTI_TYPE_APPENDED_SALT)
{
mask_len -= data.salts_buf[0].salt_len;
mask_len -= hashes->salts_buf[0].salt_len;
}
}
@ -527,14 +520,14 @@ void status_display (opencl_ctx_t *opencl_ctx)
}
}
if (data.digests_cnt == 1)
if (hashes->digests_cnt == 1)
{
if (hashconfig->hash_mode == 2500)
{
wpa_t *wpa = (wpa_t *) data.esalts_buf;
wpa_t *wpa = (wpa_t *) hashes->esalts_buf;
log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
(char *) data.salts_buf[0].salt_buf,
(char *) hashes->salts_buf[0].salt_buf,
wpa->orig_mac1[0],
wpa->orig_mac1[1],
wpa->orig_mac1[2],
@ -550,25 +543,25 @@ void status_display (opencl_ctx_t *opencl_ctx)
}
else if (hashconfig->hash_mode == 5200)
{
log_info ("Hash.Target....: File (%s)", data.hashfile);
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
}
else if (hashconfig->hash_mode == 9000)
{
log_info ("Hash.Target....: File (%s)", data.hashfile);
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
}
else if ((hashconfig->hash_mode >= 6200) && (hashconfig->hash_mode <= 6299))
{
log_info ("Hash.Target....: File (%s)", data.hashfile);
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
}
else if ((hashconfig->hash_mode >= 13700) && (hashconfig->hash_mode <= 13799))
{
log_info ("Hash.Target....: File (%s)", data.hashfile);
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
}
else
{
char out_buf[HCBUFSIZ_LARGE] = { 0 };
ascii_digest (out_buf, 0, 0, hashconfig, digests_buf, salts_buf, esalts_buf, hash_info, hashfile);
ascii_digest (out_buf, 0, 0, hashconfig, hashes);
// limit length
if (strlen (out_buf) > 40)
@ -589,14 +582,14 @@ void status_display (opencl_ctx_t *opencl_ctx)
char out_buf1[32] = { 0 };
char out_buf2[32] = { 0 };
ascii_digest (out_buf1, 0, 0, hashconfig, digests_buf, salts_buf, esalts_buf, hash_info, hashfile);
ascii_digest (out_buf2, 0, 1, hashconfig, digests_buf, salts_buf, esalts_buf, hash_info, hashfile);
ascii_digest (out_buf1, 0, 0, hashconfig, hashes);
ascii_digest (out_buf2, 0, 1, hashconfig, hashes);
log_info ("Hash.Target....: %s, %s", out_buf1, out_buf2);
}
else
{
log_info ("Hash.Target....: File (%s)", data.hashfile);
log_info ("Hash.Target....: File (%s)", hashes->hashfile);
}
}
@ -739,7 +732,7 @@ void status_display (opencl_ctx_t *opencl_ctx)
* counters
*/
u64 progress_total = data.words_cnt * data.salts_cnt;
u64 progress_total = data.words_cnt * hashes->salts_cnt;
u64 all_done = 0;
u64 all_rejected = 0;
@ -747,7 +740,7 @@ void status_display (opencl_ctx_t *opencl_ctx)
u64 progress_noneed = 0;
for (uint salt_pos = 0; salt_pos < data.salts_cnt; salt_pos++)
for (uint salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
all_done += data.words_progress_done[salt_pos];
all_rejected += data.words_progress_rejected[salt_pos];
@ -755,7 +748,7 @@ void status_display (opencl_ctx_t *opencl_ctx)
// Important for ETA only
if (data.salts_shown[salt_pos] == 1)
if (hashes->salts_shown[salt_pos] == 1)
{
const u64 all = data.words_progress_done[salt_pos]
+ data.words_progress_rejected[salt_pos]
@ -774,7 +767,7 @@ void status_display (opencl_ctx_t *opencl_ctx)
if (data.skip)
{
progress_skip = MIN (data.skip, data.words_base) * data.salts_cnt;
progress_skip = MIN (data.skip, data.words_base) * hashes->salts_cnt;
if (data.attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= data.kernel_rules_cnt;
else if (data.attack_kern == ATTACK_KERN_COMBI) progress_skip *= data.combs_cnt;
@ -783,7 +776,7 @@ void status_display (opencl_ctx_t *opencl_ctx)
if (data.limit)
{
progress_end = MIN (data.limit, data.words_base) * data.salts_cnt;
progress_end = MIN (data.limit, data.words_base) * hashes->salts_cnt;
if (data.attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= data.kernel_rules_cnt;
else if (data.attack_kern == ATTACK_KERN_COMBI) progress_end *= data.combs_cnt;
@ -922,14 +915,14 @@ void status_display (opencl_ctx_t *opencl_ctx)
if (opencl_ctx->devices_active > 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur);
const double digests_percent = (double) data.digests_done / data.digests_cnt;
const double salts_percent = (double) data.salts_done / data.salts_cnt;
const double digests_percent = (double) hashes->digests_done / hashes->digests_cnt;
const double salts_percent = (double) hashes->salts_done / hashes->salts_cnt;
log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", data.digests_done, data.digests_cnt, digests_percent * 100, data.salts_done, data.salts_cnt, salts_percent * 100);
log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", hashes->digests_done, hashes->digests_cnt, digests_percent * 100, hashes->salts_done, hashes->salts_cnt, salts_percent * 100);
// crack-per-time
if (data.digests_cnt > 100)
if (hashes->digests_cnt > 100)
{
time_t now = time (NULL);
@ -1154,10 +1147,8 @@ void status_display (opencl_ctx_t *opencl_ctx)
#endif // HAVE_HWMON
}
void status_benchmark_automate (opencl_ctx_t *opencl_ctx)
void status_benchmark_automate (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig)
{
hashconfig_t *hashconfig = data.hashconfig;
u64 speed_cnt[DEVICES_MAX] = { 0 };
double speed_ms[DEVICES_MAX] = { 0 };
@ -1197,7 +1188,7 @@ void status_benchmark_automate (opencl_ctx_t *opencl_ctx)
}
}
void status_benchmark (opencl_ctx_t *opencl_ctx)
void status_benchmark (opencl_ctx_t *opencl_ctx, const hashconfig_t *hashconfig)
{
if (opencl_ctx->devices_status == STATUS_INIT) return;
if (opencl_ctx->devices_status == STATUS_STARTING) return;
@ -1206,7 +1197,7 @@ void status_benchmark (opencl_ctx_t *opencl_ctx)
if (data.machine_readable == 1)
{
status_benchmark_automate (opencl_ctx);
status_benchmark_automate (opencl_ctx, hashconfig);
return;
}

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -21,6 +20,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "locking.h"
#include "rp_cpu.h"

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "logging.h"
#include "interface.h"
@ -20,6 +19,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "outfile.h"
#include "potfile.h"
@ -59,6 +59,8 @@ void clear_prompt ()
void *thread_keypress (void *p)
{
opencl_ctx_t *opencl_ctx = data.opencl_ctx;
hashconfig_t *hashconfig = data.hashconfig;
hashes_t *hashes = data.hashes;
uint quiet = data.quiet;
@ -89,7 +91,7 @@ void *thread_keypress (void *p)
log_info ("");
status_display (opencl_ctx);
status_display (opencl_ctx, hashconfig, hashes);
log_info ("");

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "memory.h"
#include "filehandling.h"
@ -20,6 +19,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "rp_cpu.h"
#include "terminal.h"

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -14,6 +13,7 @@
#include "ext_OpenCL.h"
#include "tuningdb.h"
#include "opencl.h"
#include "hash_management.h"
static int sort_by_tuning_db_alias (const void *v1, const void *v2)
{

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -20,17 +19,17 @@
#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 "hash_management.h"
#include "weak_hash.h"
extern hc_global_data_t data;
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const uint salt_pos)
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, const uint salt_pos)
{
if (device_param == NULL)
{
@ -39,7 +38,7 @@ void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
exit (-1);
}
salt_t *salt_buf = &data.salts_buf[salt_pos];
salt_t *salt_buf = &hashes->salts_buf[salt_pos];
device_param->kernel_params_buf32[27] = salt_pos;
device_param->kernel_params_buf32[30] = 1;
@ -93,7 +92,7 @@ void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
* result
*/
check_cracked (opencl_ctx, device_param, salt_pos, hashconfig);
check_cracked (opencl_ctx, device_param, hashconfig, hashes, salt_pos);
/**
* cleanup

@ -4,7 +4,6 @@
*/
#include "common.h"
#include "types_int.h"
#include "types.h"
#include "interface.h"
#include "timer.h"
@ -21,6 +20,7 @@
#include "opencl.h"
#include "hwmon.h"
#include "restore.h"
#include "hash_management.h"
#include "thread.h"
#include "locking.h"
#include "rp_cpu.h"

Loading…
Cancel
Save