2015-12-04 14:47:52 +00:00
/**
2016-09-11 20:20:15 +00:00
* Author . . . . . . : See docs / credits . txt
2015-12-04 14:47:52 +00:00
* License . . . . . : MIT
*/
2016-09-06 16:44:05 +00:00
# ifndef _TYPES_H
# define _TYPES_H
2016-09-05 19:47:26 +00:00
2016-10-25 10:25:53 +00:00
# include "common.h"
2016-09-05 19:47:26 +00:00
# include <stdio.h>
2016-09-16 15:01:18 +00:00
# include <stdint.h>
# include <stdbool.h>
# include <string.h>
2016-09-05 19:47:26 +00:00
# include <sys/types.h>
# include <sys/stat.h>
2016-09-16 15:01:18 +00:00
# include <sys/time.h>
2016-10-31 10:28:06 +00:00
# include <unistd.h>
2017-04-19 10:58:25 +00:00
# if defined (_WIN)
# define WINICONV_CONST
# endif
2017-04-14 14:36:28 +00:00
# include <iconv.h>
2016-09-16 15:01:18 +00:00
# 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 ;
// timer
# if defined (_WIN)
2016-09-20 11:18:47 +00:00
typedef LARGE_INTEGER hc_timer_t ;
2017-02-23 23:55:06 +00:00
# else
2016-09-20 11:18:47 +00:00
typedef struct timeval hc_timer_t ;
2016-09-16 15:01:18 +00:00
# endif
2016-09-20 11:18:47 +00:00
// thread
2015-12-04 14:47:52 +00:00
2016-09-30 20:52:44 +00:00
# if defined (_POSIX)
# include <pthread.h>
# endif
2016-09-20 11:18:47 +00:00
# if defined (_WIN)
typedef HANDLE hc_thread_t ;
typedef CRITICAL_SECTION hc_thread_mutex_t ;
2017-02-23 23:55:06 +00:00
# else
2016-09-20 11:18:47 +00:00
typedef pthread_t hc_thread_t ;
typedef pthread_mutex_t hc_thread_mutex_t ;
# endif
2016-10-01 12:22:50 +00:00
// stat
# if defined (_WIN)
2016-10-31 10:28:06 +00:00
typedef struct _stat64 hc_stat_t ;
2017-02-23 23:55:06 +00:00
# else
typedef struct stat hc_stat_t ;
2016-10-01 12:22:50 +00:00
# endif
2016-09-20 11:18:47 +00:00
// enums
2016-09-08 07:21:25 +00:00
2016-10-15 14:12:20 +00:00
typedef enum loglevel
{
LOGLEVEL_INFO = 0 ,
LOGLEVEL_WARNING = 1 ,
LOGLEVEL_ERROR = 2 ,
2017-03-25 19:50:37 +00:00
LOGLEVEL_ADVICE = 3 ,
2016-10-15 14:12:20 +00:00
} loglevel_t ;
2016-10-07 14:56:44 +00:00
typedef enum event_identifier
{
2016-10-25 10:03:20 +00:00
EVENT_AUTOTUNE_FINISHED = 0x00000000 ,
EVENT_AUTOTUNE_STARTING = 0x00000001 ,
EVENT_BITMAP_INIT_POST = 0x00000010 ,
EVENT_BITMAP_INIT_PRE = 0x00000011 ,
EVENT_CALCULATED_WORDS_BASE = 0x00000020 ,
EVENT_CRACKER_FINISHED = 0x00000030 ,
EVENT_CRACKER_HASH_CRACKED = 0x00000031 ,
EVENT_CRACKER_STARTING = 0x00000032 ,
EVENT_HASHLIST_COUNT_LINES_POST = 0x00000040 ,
EVENT_HASHLIST_COUNT_LINES_PRE = 0x00000041 ,
EVENT_HASHLIST_PARSE_HASH = 0x00000042 ,
EVENT_HASHLIST_SORT_HASH_POST = 0x00000043 ,
EVENT_HASHLIST_SORT_HASH_PRE = 0x00000044 ,
EVENT_HASHLIST_SORT_SALT_POST = 0x00000045 ,
EVENT_HASHLIST_SORT_SALT_PRE = 0x00000046 ,
EVENT_HASHLIST_UNIQUE_HASH_POST = 0x00000047 ,
EVENT_HASHLIST_UNIQUE_HASH_PRE = 0x00000048 ,
EVENT_INNERLOOP1_FINISHED = 0x00000050 ,
EVENT_INNERLOOP1_STARTING = 0x00000051 ,
EVENT_INNERLOOP2_FINISHED = 0x00000060 ,
EVENT_INNERLOOP2_STARTING = 0x00000061 ,
EVENT_LOG_ERROR = 0x00000070 ,
EVENT_LOG_INFO = 0x00000071 ,
EVENT_LOG_WARNING = 0x00000072 ,
2017-03-25 19:50:37 +00:00
EVENT_LOG_ADVICE = 0x00000073 ,
2016-10-25 10:03:20 +00:00
EVENT_MONITOR_RUNTIME_LIMIT = 0x00000080 ,
EVENT_MONITOR_STATUS_REFRESH = 0x00000081 ,
EVENT_MONITOR_TEMP_ABORT = 0x00000082 ,
EVENT_MONITOR_THROTTLE1 = 0x00000083 ,
EVENT_MONITOR_THROTTLE2 = 0x00000084 ,
EVENT_MONITOR_THROTTLE3 = 0x00000085 ,
2016-11-21 17:30:36 +00:00
EVENT_MONITOR_PERFORMANCE_HINT = 0x00000086 ,
2016-10-25 10:03:20 +00:00
EVENT_OPENCL_SESSION_POST = 0x00000090 ,
EVENT_OPENCL_SESSION_PRE = 0x00000091 ,
EVENT_OUTERLOOP_FINISHED = 0x000000a0 ,
EVENT_OUTERLOOP_MAINSCREEN = 0x000000a1 ,
EVENT_OUTERLOOP_STARTING = 0x000000a2 ,
EVENT_POTFILE_ALL_CRACKED = 0x000000b0 ,
EVENT_POTFILE_HASH_LEFT = 0x000000b1 ,
EVENT_POTFILE_HASH_SHOW = 0x000000b2 ,
EVENT_POTFILE_NUM_CRACKED = 0x000000b3 ,
EVENT_POTFILE_REMOVE_PARSE_POST = 0x000000b4 ,
EVENT_POTFILE_REMOVE_PARSE_PRE = 0x000000b5 ,
2017-06-13 17:07:08 +00:00
EVENT_SELFTEST_FINISHED = 0x000000c0 ,
EVENT_SELFTEST_STARTING = 0x000000c1 ,
EVENT_SET_KERNEL_POWER_FINAL = 0x000000d0 ,
EVENT_WEAK_HASH_POST = 0x000000e0 ,
EVENT_WEAK_HASH_PRE = 0x000000e1 ,
EVENT_WEAK_HASH_ALL_CRACKED = 0x000000e2 ,
EVENT_WORDLIST_CACHE_GENERATE = 0x000000f0 ,
EVENT_WORDLIST_CACHE_HIT = 0x000000f1 ,
2016-10-07 14:56:44 +00:00
// there will be much more event types soon
} event_identifier_t ;
2016-09-24 10:05:56 +00:00
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
{
2016-10-26 22:32:38 +00:00
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 )
2016-09-24 10:05:56 +00:00
} vendor_id_t ;
typedef enum status_rc
{
2017-01-06 07:45:40 +00:00
STATUS_INIT = 0 ,
STATUS_AUTOTUNE = 1 ,
2017-06-13 17:07:08 +00:00
STATUS_SELFTEST = 2 ,
STATUS_RUNNING = 3 ,
STATUS_PAUSED = 4 ,
STATUS_EXHAUSTED = 5 ,
STATUS_CRACKED = 6 ,
STATUS_ABORTED = 7 ,
STATUS_QUIT = 8 ,
STATUS_BYPASS = 9 ,
STATUS_ABORTED_CHECKPOINT = 10 ,
STATUS_ABORTED_RUNTIME = 11 ,
2016-09-24 10:05:56 +00:00
} status_rc_t ;
2016-09-08 07:21:25 +00:00
typedef enum wl_mode
{
2016-10-02 21:30:31 +00:00
WL_MODE_NONE = 0 ,
2016-09-08 07:21:25 +00:00
WL_MODE_STDIN = 1 ,
WL_MODE_FILE = 2 ,
WL_MODE_MASK = 3
} wl_mode_t ;
typedef enum hl_mode
{
HL_MODE_FILE = 4 ,
HL_MODE_ARG = 5
} hl_mode_t ;
typedef enum attack_mode
{
ATTACK_MODE_STRAIGHT = 0 ,
ATTACK_MODE_COMBI = 1 ,
ATTACK_MODE_TOGGLE = 2 ,
ATTACK_MODE_BF = 3 ,
ATTACK_MODE_PERM = 4 ,
ATTACK_MODE_TABLE = 5 ,
ATTACK_MODE_HYBRID1 = 6 ,
ATTACK_MODE_HYBRID2 = 7 ,
ATTACK_MODE_NONE = 100
} attack_mode_t ;
typedef enum attack_kern
{
ATTACK_KERN_STRAIGHT = 0 ,
ATTACK_KERN_COMBI = 1 ,
ATTACK_KERN_BF = 3 ,
ATTACK_KERN_NONE = 100
} attack_kern_t ;
typedef enum combinator_mode
{
COMBINATOR_MODE_BASE_LEFT = 10001 ,
COMBINATOR_MODE_BASE_RIGHT = 10002
} combinator_mode_t ;
typedef enum kern_run
{
2017-01-26 20:16:29 +00:00
KERN_RUN_1 = 1000 ,
KERN_RUN_12 = 1500 ,
KERN_RUN_2 = 2000 ,
KERN_RUN_23 = 2500 ,
KERN_RUN_3 = 3000 ,
2017-06-29 10:19:05 +00:00
KERN_RUN_4 = 4000 ,
KERN_RUN_INIT2 = 5000 ,
KERN_RUN_LOOP2 = 6000
2016-09-08 07:21:25 +00:00
} kern_run_t ;
typedef enum kern_run_mp
{
KERN_RUN_MP = 101 ,
KERN_RUN_MP_L = 102 ,
KERN_RUN_MP_R = 103
} kern_run_mp_t ;
2016-09-24 09:08:35 +00:00
typedef enum rule_functions
{
RULE_OP_MANGLE_NOOP = ' : ' ,
RULE_OP_MANGLE_LREST = ' l ' ,
RULE_OP_MANGLE_UREST = ' u ' ,
RULE_OP_MANGLE_LREST_UFIRST = ' c ' ,
RULE_OP_MANGLE_UREST_LFIRST = ' C ' ,
RULE_OP_MANGLE_TREST = ' t ' ,
RULE_OP_MANGLE_TOGGLE_AT = ' T ' ,
RULE_OP_MANGLE_REVERSE = ' r ' ,
RULE_OP_MANGLE_DUPEWORD = ' d ' ,
RULE_OP_MANGLE_DUPEWORD_TIMES = ' p ' ,
RULE_OP_MANGLE_REFLECT = ' f ' ,
RULE_OP_MANGLE_ROTATE_LEFT = ' { ' ,
RULE_OP_MANGLE_ROTATE_RIGHT = ' } ' ,
RULE_OP_MANGLE_APPEND = ' $ ' ,
RULE_OP_MANGLE_PREPEND = ' ^ ' ,
RULE_OP_MANGLE_DELETE_FIRST = ' [ ' ,
RULE_OP_MANGLE_DELETE_LAST = ' ] ' ,
RULE_OP_MANGLE_DELETE_AT = ' D ' ,
RULE_OP_MANGLE_EXTRACT = ' x ' ,
RULE_OP_MANGLE_OMIT = ' O ' ,
RULE_OP_MANGLE_INSERT = ' i ' ,
RULE_OP_MANGLE_OVERSTRIKE = ' o ' ,
RULE_OP_MANGLE_TRUNCATE_AT = ' \' ' ,
RULE_OP_MANGLE_REPLACE = ' s ' ,
RULE_OP_MANGLE_PURGECHAR = ' @ ' ,
RULE_OP_MANGLE_TOGGLECASE_REC = ' a ' ,
RULE_OP_MANGLE_DUPECHAR_FIRST = ' z ' ,
RULE_OP_MANGLE_DUPECHAR_LAST = ' Z ' ,
RULE_OP_MANGLE_DUPECHAR_ALL = ' q ' ,
RULE_OP_MANGLE_EXTRACT_MEMORY = ' X ' ,
RULE_OP_MANGLE_APPEND_MEMORY = ' 4 ' ,
RULE_OP_MANGLE_PREPEND_MEMORY = ' 6 ' ,
2017-04-30 13:23:39 +00:00
RULE_OP_MANGLE_TITLE_SEP = ' e ' ,
2016-09-24 09:08:35 +00:00
RULE_OP_MEMORIZE_WORD = ' M ' ,
RULE_OP_REJECT_LESS = ' < ' ,
RULE_OP_REJECT_GREATER = ' > ' ,
2017-05-19 12:13:07 +00:00
RULE_OP_REJECT_EQUAL = ' _ ' ,
2016-09-24 09:08:35 +00:00
RULE_OP_REJECT_CONTAIN = ' ! ' ,
RULE_OP_REJECT_NOT_CONTAIN = ' / ' ,
RULE_OP_REJECT_EQUAL_FIRST = ' ( ' ,
RULE_OP_REJECT_EQUAL_LAST = ' ) ' ,
RULE_OP_REJECT_EQUAL_AT = ' = ' ,
RULE_OP_REJECT_CONTAINS = ' % ' ,
RULE_OP_REJECT_MEMORY = ' Q ' ,
2017-05-14 15:50:45 +00:00
RULE_LAST_REJECTED_SAVED_POS = ' p ' ,
2016-09-24 09:08:35 +00:00
RULE_OP_MANGLE_SWITCH_FIRST = ' k ' ,
RULE_OP_MANGLE_SWITCH_LAST = ' K ' ,
RULE_OP_MANGLE_SWITCH_AT = ' * ' ,
RULE_OP_MANGLE_CHR_SHIFTL = ' L ' ,
RULE_OP_MANGLE_CHR_SHIFTR = ' R ' ,
RULE_OP_MANGLE_CHR_INCR = ' + ' ,
RULE_OP_MANGLE_CHR_DECR = ' - ' ,
RULE_OP_MANGLE_REPLACE_NP1 = ' . ' ,
RULE_OP_MANGLE_REPLACE_NM1 = ' , ' ,
RULE_OP_MANGLE_DUPEBLOCK_FIRST = ' y ' ,
RULE_OP_MANGLE_DUPEBLOCK_LAST = ' Y ' ,
RULE_OP_MANGLE_TITLE = ' E ' ,
} rule_functions_t ;
2015-12-04 14:47:52 +00:00
2016-09-24 10:05:56 +00:00
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
{
2017-06-18 21:31:40 +00:00
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_INIT = ( 1 < < 15 ) ,
OPTI_TYPE_SLOW_HASH_SIMD_LOOP = ( 1 < < 16 ) ,
OPTI_TYPE_SLOW_HASH_SIMD_COMP = ( 1 < < 17 ) ,
OPTI_TYPE_USES_BITS_8 = ( 1 < < 18 ) ,
OPTI_TYPE_USES_BITS_16 = ( 1 < < 19 ) ,
OPTI_TYPE_USES_BITS_32 = ( 1 < < 20 ) ,
OPTI_TYPE_USES_BITS_64 = ( 1 < < 21 )
2016-09-24 10:05:56 +00:00
} opti_type_t ;
typedef enum opts_type
{
2017-06-05 10:15:28 +00:00
OPTS_TYPE_PT_UTF16LE = ( 1ULL < < 0 ) ,
OPTS_TYPE_PT_UTF16BE = ( 1ULL < < 1 ) ,
2017-06-04 20:46:05 +00:00
OPTS_TYPE_PT_UPPER = ( 1ULL < < 2 ) ,
OPTS_TYPE_PT_LOWER = ( 1ULL < < 3 ) ,
OPTS_TYPE_PT_ADD01 = ( 1ULL < < 4 ) ,
OPTS_TYPE_PT_ADD02 = ( 1ULL < < 5 ) ,
OPTS_TYPE_PT_ADD80 = ( 1ULL < < 6 ) ,
OPTS_TYPE_PT_ADDBITS14 = ( 1ULL < < 7 ) ,
OPTS_TYPE_PT_ADDBITS15 = ( 1ULL < < 8 ) ,
OPTS_TYPE_PT_GENERATE_LE = ( 1ULL < < 9 ) ,
OPTS_TYPE_PT_GENERATE_BE = ( 1ULL < < 10 ) ,
OPTS_TYPE_PT_NEVERCRACK = ( 1ULL < < 11 ) , // if we want all possible results
OPTS_TYPE_PT_BITSLICE = ( 1ULL < < 12 ) ,
OPTS_TYPE_PT_ALWAYS_ASCII = ( 1ULL < < 13 ) ,
2017-06-05 10:15:28 +00:00
OPTS_TYPE_ST_UTF16LE = ( 1ULL < < 14 ) ,
OPTS_TYPE_ST_UTF16BE = ( 1ULL < < 15 ) ,
OPTS_TYPE_ST_UPPER = ( 1ULL < < 16 ) ,
OPTS_TYPE_ST_LOWER = ( 1ULL < < 17 ) ,
OPTS_TYPE_ST_ADD01 = ( 1ULL < < 18 ) ,
OPTS_TYPE_ST_ADD02 = ( 1ULL < < 19 ) ,
OPTS_TYPE_ST_ADD80 = ( 1ULL < < 20 ) ,
OPTS_TYPE_ST_ADDBITS14 = ( 1ULL < < 21 ) ,
OPTS_TYPE_ST_ADDBITS15 = ( 1ULL < < 22 ) ,
OPTS_TYPE_ST_GENERATE_LE = ( 1ULL < < 23 ) ,
OPTS_TYPE_ST_GENERATE_BE = ( 1ULL < < 24 ) ,
OPTS_TYPE_ST_HEX = ( 1ULL < < 25 ) ,
OPTS_TYPE_ST_BASE64 = ( 1ULL < < 26 ) ,
OPTS_TYPE_ST_HASH_MD5 = ( 1ULL < < 27 ) ,
OPTS_TYPE_HASH_COPY = ( 1ULL < < 28 ) ,
OPTS_TYPE_HASH_SPLIT = ( 1ULL < < 29 ) ,
OPTS_TYPE_HOOK12 = ( 1ULL < < 30 ) ,
OPTS_TYPE_HOOK23 = ( 1ULL < < 31 ) ,
OPTS_TYPE_INIT2 = ( 1ULL < < 32 ) ,
OPTS_TYPE_LOOP2 = ( 1ULL < < 33 ) ,
OPTS_TYPE_BINARY_HASHFILE = ( 1ULL < < 34 ) ,
2016-09-24 10:05:56 +00:00
} opts_type_t ;
typedef enum dgst_size
{
2016-09-29 12:56:02 +00:00
DGST_SIZE_4_2 = ( 2 * sizeof ( u32 ) ) , // 8
DGST_SIZE_4_4 = ( 4 * sizeof ( u32 ) ) , // 16
DGST_SIZE_4_5 = ( 5 * sizeof ( u32 ) ) , // 20
DGST_SIZE_4_6 = ( 6 * sizeof ( u32 ) ) , // 24
2016-12-16 01:05:12 +00:00
DGST_SIZE_4_7 = ( 7 * sizeof ( u32 ) ) , // 28
2016-09-29 12:56:02 +00:00
DGST_SIZE_4_8 = ( 8 * sizeof ( u32 ) ) , // 32
DGST_SIZE_4_16 = ( 16 * sizeof ( u32 ) ) , // 64 !!!
DGST_SIZE_4_32 = ( 32 * sizeof ( u32 ) ) , // 128 !!!
DGST_SIZE_4_64 = ( 64 * sizeof ( u32 ) ) , // 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
2016-09-24 10:05:56 +00:00
} dgst_size_t ;
typedef enum attack_exec
{
ATTACK_EXEC_OUTSIDE_KERNEL = 10 ,
ATTACK_EXEC_INSIDE_KERNEL = 11
} attack_exec_t ;
2016-09-30 07:34:06 +00:00
typedef enum hlfmt_name
{
HLFMT_HASHCAT = 0 ,
HLFMT_PWDUMP = 1 ,
HLFMT_PASSWD = 2 ,
HLFMT_SHADOW = 3 ,
HLFMT_DCC = 4 ,
HLFMT_DCC2 = 5 ,
HLFMT_NETNTLM1 = 7 ,
HLFMT_NETNTLM2 = 8 ,
HLFMT_NSLDAP = 9 ,
HLFMT_NSLDAPS = 10
} hlfmt_name_t ;
typedef enum outfile_fmt
{
2016-10-26 22:32:38 +00:00
OUTFILE_FMT_HASH = ( 1 < < 0 ) ,
OUTFILE_FMT_PLAIN = ( 1 < < 1 ) ,
OUTFILE_FMT_HEXPLAIN = ( 1 < < 2 ) ,
OUTFILE_FMT_CRACKPOS = ( 1 < < 3 )
2016-09-30 07:34:06 +00:00
} outfile_fmt_t ;
typedef enum parser_rc
{
PARSER_OK = 0 ,
PARSER_COMMENT = - 1 ,
PARSER_GLOBAL_ZERO = - 2 ,
PARSER_GLOBAL_LENGTH = - 3 ,
PARSER_HASH_LENGTH = - 4 ,
PARSER_HASH_VALUE = - 5 ,
PARSER_SALT_LENGTH = - 6 ,
PARSER_SALT_VALUE = - 7 ,
PARSER_SALT_ITERATION = - 8 ,
PARSER_SEPARATOR_UNMATCHED = - 9 ,
PARSER_SIGNATURE_UNMATCHED = - 10 ,
2017-02-06 16:03:42 +00:00
PARSER_HCCAPX_FILE_SIZE = - 11 ,
PARSER_HCCAPX_EAPOL_LEN = - 12 ,
2016-09-30 07:34:06 +00:00
PARSER_PSAFE2_FILE_SIZE = - 13 ,
PARSER_PSAFE3_FILE_SIZE = - 14 ,
PARSER_TC_FILE_SIZE = - 15 ,
PARSER_VC_FILE_SIZE = - 16 ,
PARSER_SIP_AUTH_DIRECTIVE = - 17 ,
2016-10-09 20:41:55 +00:00
PARSER_HASH_FILE = - 18 ,
2016-12-23 13:57:46 +00:00
PARSER_HASH_ENCODING = - 19 ,
PARSER_SALT_ENCODING = - 20 ,
2017-01-21 14:37:44 +00:00
PARSER_LUKS_FILE_SIZE = - 21 ,
PARSER_LUKS_MAGIC = - 22 ,
PARSER_LUKS_VERSION = - 23 ,
PARSER_LUKS_CIPHER_TYPE = - 24 ,
PARSER_LUKS_CIPHER_MODE = - 25 ,
PARSER_LUKS_HASH_TYPE = - 26 ,
PARSER_LUKS_KEY_SIZE = - 27 ,
PARSER_LUKS_KEY_DISABLED = - 28 ,
PARSER_LUKS_KEY_STRIPES = - 29 ,
PARSER_LUKS_HASH_CIPHER = - 30 ,
2017-02-06 16:03:42 +00:00
PARSER_HCCAPX_SIGNATURE = - 31 ,
PARSER_HCCAPX_VERSION = - 32 ,
2017-02-27 11:09:49 +00:00
PARSER_HCCAPX_MESSAGE_PAIR = - 33 ,
2016-09-30 07:34:06 +00:00
PARSER_UNKNOWN_ERROR = - 255
} parser_rc_t ;
2017-03-24 22:39:09 +00:00
typedef enum guess_mode
{
GUESS_MODE_NONE = 0 ,
GUESS_MODE_STRAIGHT_FILE = 1 ,
GUESS_MODE_STRAIGHT_FILE_RULES_FILE = 2 ,
GUESS_MODE_STRAIGHT_FILE_RULES_GEN = 3 ,
GUESS_MODE_STRAIGHT_STDIN = 4 ,
GUESS_MODE_STRAIGHT_STDIN_RULES_FILE = 5 ,
GUESS_MODE_STRAIGHT_STDIN_RULES_GEN = 6 ,
GUESS_MODE_COMBINATOR_BASE_LEFT = 7 ,
GUESS_MODE_COMBINATOR_BASE_RIGHT = 8 ,
GUESS_MODE_MASK = 9 ,
GUESS_MODE_MASK_CS = 10 ,
GUESS_MODE_HYBRID1 = 11 ,
GUESS_MODE_HYBRID1_CS = 12 ,
GUESS_MODE_HYBRID2 = 13 ,
GUESS_MODE_HYBRID2_CS = 14 ,
} guess_mode_t ;
2016-10-23 11:38:41 +00:00
typedef enum progress_mode
{
PROGRESS_MODE_NONE = 0 ,
PROGRESS_MODE_KEYSPACE_KNOWN = 1 ,
PROGRESS_MODE_KEYSPACE_UNKNOWN = 2 ,
} progress_mode_t ;
2016-10-31 09:09:04 +00:00
typedef enum user_options_defaults
{
2017-03-25 19:50:37 +00:00
ADVICE_DISABLE = false ,
2016-10-31 09:09:04 +00:00
ATTACK_MODE = ATTACK_MODE_STRAIGHT ,
BENCHMARK = false ,
BITMAP_MAX = 24 ,
BITMAP_MIN = 16 ,
DEBUG_MODE = 0 ,
FORCE = false ,
GPU_TEMP_ABORT = 90 ,
GPU_TEMP_DISABLE = false ,
GPU_TEMP_RETAIN = 75 ,
HASH_MODE = 0 ,
2017-02-27 11:09:49 +00:00
HCCAPX_MESSAGE_PAIR = 0 ,
2016-10-31 09:09:04 +00:00
HEX_CHARSET = false ,
HEX_SALT = false ,
HEX_WORDLIST = false ,
INCREMENT = false ,
INCREMENT_MAX = PW_MAX ,
INCREMENT_MIN = 1 ,
KEEP_GUESSING = false ,
KERNEL_ACCEL = 0 ,
KERNEL_LOOPS = 0 ,
KEYSPACE = false ,
LEFT = false ,
2017-06-29 10:19:05 +00:00
LENGTH_LIMIT_DISABLE = false ,
2016-10-31 09:09:04 +00:00
LIMIT = 0 ,
LOGFILE_DISABLE = false ,
LOOPBACK = false ,
MACHINE_READABLE = false ,
MARKOV_CLASSIC = false ,
MARKOV_DISABLE = false ,
MARKOV_THRESHOLD = 0 ,
2017-04-10 08:11:32 +00:00
NONCE_ERROR_CORRECTIONS = 8 ,
2016-10-31 09:09:04 +00:00
NVIDIA_SPIN_DAMP = 100 ,
OPENCL_VECTOR_WIDTH = 0 ,
OUTFILE_AUTOHEX = true ,
OUTFILE_CHECK_TIMER = 5 ,
OUTFILE_FORMAT = 3 ,
POTFILE_DISABLE = false ,
POWERTUNE_ENABLE = false ,
QUIET = false ,
REMOVE = false ,
REMOVE_TIMER = 60 ,
RESTORE = false ,
RESTORE_DISABLE = false ,
RESTORE_TIMER = 60 ,
RP_GEN = 0 ,
RP_GEN_FUNC_MAX = 4 ,
RP_GEN_FUNC_MIN = 1 ,
RP_GEN_SEED = 0 ,
RUNTIME = 0 ,
SCRYPT_TMTO = 0 ,
2017-06-29 10:19:05 +00:00
SELF_TEST_DISABLE = false ,
2016-10-31 09:09:04 +00:00
SEGMENT_SIZE = 33554432 ,
SEPARATOR = ' : ' ,
SHOW = false ,
SKIP = 0 ,
STATUS = false ,
STATUS_TIMER = 10 ,
STDOUT_FLAG = false ,
SPEED_ONLY = false ,
2016-12-09 22:44:43 +00:00
PROGRESS_ONLY = false ,
2016-10-31 09:09:04 +00:00
USAGE = false ,
USERNAME = false ,
VERSION = false ,
WEAK_HASH_THRESHOLD = 100 ,
WORKLOAD_PROFILE = 2 ,
} user_options_defaults_t ;
typedef enum user_options_map
{
2017-03-25 19:50:37 +00:00
IDX_ADVICE_DISABLE = 0xff00 ,
2016-10-31 09:09:04 +00:00
IDX_ATTACK_MODE = ' a ' ,
IDX_BENCHMARK = ' b ' ,
2017-03-25 19:50:37 +00:00
IDX_BITMAP_MAX = 0xff01 ,
IDX_BITMAP_MIN = 0xff02 ,
IDX_CPU_AFFINITY = 0xff03 ,
2016-10-31 09:09:04 +00:00
IDX_CUSTOM_CHARSET_1 = ' 1 ' ,
IDX_CUSTOM_CHARSET_2 = ' 2 ' ,
IDX_CUSTOM_CHARSET_3 = ' 3 ' ,
IDX_CUSTOM_CHARSET_4 = ' 4 ' ,
2017-03-25 19:50:37 +00:00
IDX_DEBUG_FILE = 0xff04 ,
IDX_DEBUG_MODE = 0xff05 ,
2017-04-14 14:36:28 +00:00
IDX_ENCODING_FROM = 0xff06 ,
IDX_ENCODING_TO = 0xff07 ,
IDX_FORCE = 0xff08 ,
IDX_GPU_TEMP_ABORT = 0xff09 ,
IDX_GPU_TEMP_DISABLE = 0xff0a ,
IDX_GPU_TEMP_RETAIN = 0xff0b ,
2016-10-31 09:09:04 +00:00
IDX_HASH_MODE = ' m ' ,
2017-04-14 14:36:28 +00:00
IDX_HCCAPX_MESSAGE_PAIR = 0xff0c ,
2016-10-31 09:09:04 +00:00
IDX_HELP = ' h ' ,
2017-04-14 14:36:28 +00:00
IDX_HEX_CHARSET = 0xff0d ,
IDX_HEX_SALT = 0xff0e ,
IDX_HEX_WORDLIST = 0xff0f ,
2016-10-31 09:09:04 +00:00
IDX_INCREMENT = ' i ' ,
2017-04-14 14:36:28 +00:00
IDX_INCREMENT_MAX = 0xff10 ,
IDX_INCREMENT_MIN = 0xff11 ,
IDX_INDUCTION_DIR = 0xff12 ,
IDX_KEEP_GUESSING = 0xff13 ,
2016-10-31 09:09:04 +00:00
IDX_KERNEL_ACCEL = ' n ' ,
IDX_KERNEL_LOOPS = ' u ' ,
2017-04-14 14:36:28 +00:00
IDX_KEYSPACE = 0xff14 ,
IDX_LEFT = 0xff15 ,
2017-06-29 10:19:05 +00:00
IDX_LENGTH_LIMIT_DISABLE = ' L ' ,
2016-10-31 09:09:04 +00:00
IDX_LIMIT = ' l ' ,
2017-04-14 14:36:28 +00:00
IDX_LOGFILE_DISABLE = 0xff16 ,
IDX_LOOPBACK = 0xff17 ,
IDX_MACHINE_READABLE = 0xff18 ,
IDX_MARKOV_CLASSIC = 0xff19 ,
IDX_MARKOV_DISABLE = 0xff1a ,
IDX_MARKOV_HCSTAT = 0xff1b ,
2016-10-31 09:09:04 +00:00
IDX_MARKOV_THRESHOLD = ' t ' ,
2017-04-14 14:36:28 +00:00
IDX_NONCE_ERROR_CORRECTIONS = 0xff1c ,
IDX_NVIDIA_SPIN_DAMP = 0xff1d ,
2016-10-31 09:09:04 +00:00
IDX_OPENCL_DEVICES = ' d ' ,
IDX_OPENCL_DEVICE_TYPES = ' D ' ,
IDX_OPENCL_INFO = ' I ' ,
2017-04-14 14:36:28 +00:00
IDX_OPENCL_PLATFORMS = 0xff1e ,
IDX_OPENCL_VECTOR_WIDTH = 0xff1f ,
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff20 ,
IDX_OUTFILE_CHECK_DIR = 0xff21 ,
IDX_OUTFILE_CHECK_TIMER = 0xff22 ,
IDX_OUTFILE_FORMAT = 0xff23 ,
2016-10-31 09:09:04 +00:00
IDX_OUTFILE = ' o ' ,
2017-04-14 14:36:28 +00:00
IDX_POTFILE_DISABLE = 0xff24 ,
IDX_POTFILE_PATH = 0xff25 ,
IDX_POWERTUNE_ENABLE = 0xff26 ,
IDX_QUIET = 0xff27 ,
IDX_REMOVE = 0xff28 ,
IDX_REMOVE_TIMER = 0xff29 ,
IDX_RESTORE = 0xff2a ,
IDX_RESTORE_DISABLE = 0xff2b ,
IDX_RESTORE_FILE_PATH = 0xff2c ,
2016-10-31 09:09:04 +00:00
IDX_RP_FILE = ' r ' ,
2017-04-14 14:36:28 +00:00
IDX_RP_GEN_FUNC_MAX = 0xff2d ,
IDX_RP_GEN_FUNC_MIN = 0xff2e ,
2016-10-31 09:09:04 +00:00
IDX_RP_GEN = ' g ' ,
2017-04-14 14:36:28 +00:00
IDX_RP_GEN_SEED = 0xff2f ,
2016-10-31 09:09:04 +00:00
IDX_RULE_BUF_L = ' j ' ,
IDX_RULE_BUF_R = ' k ' ,
2017-04-14 14:36:28 +00:00
IDX_RUNTIME = 0xff30 ,
IDX_SCRYPT_TMTO = 0xff31 ,
2017-06-29 10:19:05 +00:00
IDX_SELF_TEST_DISABLE = 0xff32 ,
2016-10-31 09:09:04 +00:00
IDX_SEGMENT_SIZE = ' c ' ,
IDX_SEPARATOR = ' p ' ,
2017-06-29 10:19:05 +00:00
IDX_SESSION = 0xff33 ,
IDX_SHOW = 0xff34 ,
2016-10-31 09:09:04 +00:00
IDX_SKIP = ' s ' ,
2017-06-29 10:19:05 +00:00
IDX_STATUS = 0xff35 ,
IDX_STATUS_TIMER = 0xff36 ,
IDX_STDOUT_FLAG = 0xff37 ,
IDX_SPEED_ONLY = 0xff38 ,
IDX_PROGRESS_ONLY = 0xff39 ,
IDX_TRUECRYPT_KEYFILES = 0xff3a ,
IDX_USERNAME = 0xff3b ,
IDX_VERACRYPT_KEYFILES = 0xff3c ,
IDX_VERACRYPT_PIM = 0xff3d ,
2016-10-31 09:09:04 +00:00
IDX_VERSION_LOWER = ' v ' ,
IDX_VERSION = ' V ' ,
2017-06-29 10:19:05 +00:00
IDX_WEAK_HASH_THRESHOLD = 0xff3e ,
2016-10-31 09:09:04 +00:00
IDX_WORKLOAD_PROFILE = ' w '
} user_options_map_t ;
2016-09-06 09:49:26 +00:00
/**
2016-09-16 15:01:18 +00:00
* structs
2016-09-06 09:49:26 +00:00
*/
2015-12-04 14:47:52 +00:00
2017-06-04 19:23:55 +00:00
typedef struct salt
2015-12-04 14:47:52 +00:00
{
2017-06-17 15:57:30 +00:00
u32 salt_buf [ 64 ] ;
u32 salt_buf_pc [ 64 ] ;
2015-12-04 14:47:52 +00:00
2017-03-23 15:44:32 +00:00
u32 salt_len ;
u32 salt_len_pc ;
u32 salt_iter ;
u32 salt_iter2 ;
u32 salt_sign [ 2 ] ;
2015-12-04 14:47:52 +00:00
2017-03-23 15:44:32 +00:00
u32 keccak_mdlen ;
2016-03-01 17:56:46 +00:00
2017-03-23 15:44:32 +00:00
u32 digests_cnt ;
u32 digests_done ;
2016-04-02 12:36:02 +00:00
2017-03-23 15:44:32 +00:00
u32 digests_offset ;
2016-04-02 12:36:02 +00:00
2017-03-23 15:44:32 +00:00
u32 scrypt_N ;
u32 scrypt_r ;
u32 scrypt_p ;
2016-01-21 16:20:02 +00:00
2016-09-06 09:49:26 +00:00
} salt_t ;
2016-01-21 16:20:02 +00:00
2016-10-01 09:54:00 +00:00
typedef struct user
2015-12-04 14:47:52 +00:00
{
char * user_name ;
2016-09-16 15:01:18 +00:00
u32 user_len ;
2015-12-04 14:47:52 +00:00
} user_t ;
2017-02-13 15:46:37 +00:00
typedef enum split_origin
{
SPLIT_ORIGIN_NONE = 0 ,
SPLIT_ORIGIN_LEFT = 1 ,
SPLIT_ORIGIN_RIGHT = 2 ,
} split_origin_t ;
typedef struct split
{
// some hashes, like lm, are split. this id point to the other hash of the group
int split_group ;
int split_neighbor ;
int split_origin ;
} split_t ;
2016-10-01 09:54:00 +00:00
typedef struct hashinfo
2015-12-04 14:47:52 +00:00
{
2017-02-13 15:46:37 +00:00
user_t * user ;
char * orighash ;
split_t * split ;
2015-12-04 14:47:52 +00:00
} hashinfo_t ;
2016-10-01 09:54:00 +00:00
typedef struct hash
2015-12-04 14:47:52 +00:00
{
void * digest ;
salt_t * salt ;
void * esalt ;
2017-01-24 14:23:48 +00:00
void * hook_salt ; // additional salt info only used by the hook (host)
2015-12-04 14:47:52 +00:00
int cracked ;
hashinfo_t * hash_info ;
2016-10-19 09:55:43 +00:00
char * pw_buf ;
int pw_len ;
2015-12-04 14:47:52 +00:00
} hash_t ;
2016-10-01 09:54:00 +00:00
typedef struct outfile_data
2016-09-24 09:08:35 +00:00
{
char * file_name ;
2016-11-30 23:02:26 +00:00
off_t seek ;
2016-09-24 09:08:35 +00:00
time_t ctime ;
} outfile_data_t ;
2016-10-01 09:54:00 +00:00
typedef struct logfile_ctx
2016-09-23 19:41:05 +00:00
{
bool enabled ;
char * logfile ;
char * topid ;
char * subid ;
} logfile_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct hashes
2016-09-16 15:01:18 +00:00
{
2017-04-10 20:35:01 +00:00
const char * hashfile ;
2016-09-16 15:01:18 +00:00
2017-04-10 20:35:01 +00:00
u32 hashlist_mode ;
u32 hashlist_format ;
2016-09-16 15:01:18 +00:00
2017-04-10 20:35:01 +00:00
u32 digests_cnt ;
u32 digests_done ;
u32 digests_saved ;
2016-09-16 15:01:18 +00:00
2017-04-10 20:35:01 +00:00
void * digests_buf ;
u32 * digests_shown ;
u32 * digests_shown_tmp ;
2016-09-16 15:01:18 +00:00
2017-04-10 20:35:01 +00:00
u32 salts_cnt ;
u32 salts_done ;
2015-12-04 14:47:52 +00:00
2017-04-10 20:35:01 +00:00
salt_t * salts_buf ;
u32 * salts_shown ;
2015-12-04 14:47:52 +00:00
2017-04-10 20:35:01 +00:00
void * esalts_buf ;
2015-12-04 14:47:52 +00:00
2017-04-10 20:35:01 +00:00
void * hook_salts_buf ;
2017-01-24 14:23:48 +00:00
2017-04-10 20:35:01 +00:00
u32 hashes_cnt_orig ;
u32 hashes_cnt ;
hash_t * hashes_buf ;
2016-09-16 15:01:18 +00:00
2017-04-10 20:35:01 +00:00
hashinfo_t * * hash_info ;
2016-09-16 15:01:18 +00:00
2017-04-10 20:35:01 +00:00
u8 * out_buf ; // allocates [HCBUFSIZ_LARGE];
u8 * tmp_buf ; // allocates [HCBUFSIZ_LARGE];
2016-10-30 21:22:26 +00:00
2017-06-13 17:07:08 +00:00
// selftest buffers
void * st_digests_buf ;
salt_t * st_salts_buf ;
void * st_esalts_buf ;
2017-06-14 10:07:33 +00:00
void * st_hook_salts_buf ;
2017-06-13 17:07:08 +00:00
2016-09-16 15:01:18 +00:00
} hashes_t ;
2016-10-01 09:54:00 +00:00
struct hashconfig
2016-09-16 15:01:18 +00:00
{
char separator ;
u32 hash_mode ;
u32 hash_type ;
u32 salt_type ;
u32 attack_exec ;
2017-02-13 15:46:37 +00:00
u64 opts_type ;
2016-09-16 15:01:18 +00:00
u32 kern_type ;
u32 dgst_size ;
u32 opti_type ;
u32 dgst_pos0 ;
u32 dgst_pos1 ;
u32 dgst_pos2 ;
u32 dgst_pos3 ;
2016-09-28 09:11:14 +00:00
u32 is_salted ;
u32 esalt_size ;
2017-01-24 14:23:48 +00:00
u32 hook_salt_size ;
2016-09-28 09:11:14 +00:00
u32 tmp_size ;
u32 hook_size ;
2016-09-28 11:51:00 +00:00
u32 pw_min ;
u32 pw_max ;
2016-10-30 20:56:56 +00:00
int ( * parse_func ) ( u8 * , u32 , hash_t * , const struct hashconfig * ) ;
2017-06-13 17:07:08 +00:00
char * st_hash ;
char * st_pass ;
2016-09-16 15:01:18 +00:00
} ;
2016-10-01 09:54:00 +00:00
typedef struct hashconfig hashconfig_t ;
2015-12-04 14:47:52 +00:00
2016-10-01 09:54:00 +00:00
typedef struct pw
2015-12-04 14:47:52 +00:00
{
2017-06-17 15:57:30 +00:00
u32 i [ 64 ] ;
2015-12-04 14:47:52 +00:00
2016-02-22 10:57:37 +00:00
u32 pw_len ;
2015-12-04 14:47:52 +00:00
2016-02-22 10:57:37 +00:00
u32 alignment_placeholder_1 ;
u32 alignment_placeholder_2 ;
u32 alignment_placeholder_3 ;
2015-12-04 14:47:52 +00:00
} pw_t ;
2016-10-01 09:54:00 +00:00
typedef struct bf
2015-12-04 14:47:52 +00:00
{
2016-09-16 15:01:18 +00:00
u32 i ;
2015-12-04 14:47:52 +00:00
} bf_t ;
2017-06-17 15:57:30 +00:00
typedef struct bs_word
{
u32 b [ 32 ] ;
} bs_word_t ;
2016-10-01 09:54:00 +00:00
typedef struct cpt
2015-12-04 14:47:52 +00:00
{
2016-09-16 15:01:18 +00:00
u32 cracked ;
2015-12-04 14:47:52 +00:00
time_t timestamp ;
} cpt_t ;
2016-10-01 09:54:00 +00:00
typedef struct plain
2015-12-04 14:47:52 +00:00
{
2016-09-16 15:01:18 +00:00
u32 salt_pos ;
u32 digest_pos ;
u32 hash_pos ;
u32 gidvid ;
u32 il_pos ;
2015-12-04 14:47:52 +00:00
} plain_t ;
2016-10-09 20:41:55 +00:00
# include "ext_OpenCL.h"
2016-10-01 10:33:59 +00:00
typedef struct hc_device_param
2016-09-16 15:01:18 +00:00
{
2016-10-29 12:02:29 +00:00
cl_device_id device ;
cl_device_type device_type ;
2016-09-16 15:01:18 +00:00
u32 device_id ;
u32 platform_devices_id ; // for mapping with hms devices
bool skipped ;
2016-11-18 09:26:48 +00:00
bool skipped_temp ;
2016-09-16 15:01:18 +00:00
u32 sm_major ;
u32 sm_minor ;
2017-02-20 17:38:31 +00:00
u32 kernel_exec_timeout ;
2016-09-16 15:01:18 +00:00
2016-11-05 19:23:05 +00:00
u8 pcie_bus ;
u8 pcie_device ;
u8 pcie_function ;
2016-09-16 15:01:18 +00:00
u32 device_processors ;
u64 device_maxmem_alloc ;
u64 device_global_mem ;
u32 device_maxclock_frequency ;
size_t device_maxworkgroup_size ;
u32 vector_width ;
2016-10-29 12:02:29 +00:00
u32 kernel_threads_by_user ;
u32 kernel_threads_by_wgs_kernel1 ;
u32 kernel_threads_by_wgs_kernel12 ;
u32 kernel_threads_by_wgs_kernel2 ;
u32 kernel_threads_by_wgs_kernel23 ;
u32 kernel_threads_by_wgs_kernel3 ;
2017-06-29 10:19:05 +00:00
u32 kernel_threads_by_wgs_kernel4 ;
2017-01-26 20:16:29 +00:00
u32 kernel_threads_by_wgs_kernel_init2 ;
u32 kernel_threads_by_wgs_kernel_loop2 ;
2016-10-29 12:02:29 +00:00
u32 kernel_threads_by_wgs_kernel_mp ;
u32 kernel_threads_by_wgs_kernel_mp_l ;
u32 kernel_threads_by_wgs_kernel_mp_r ;
u32 kernel_threads_by_wgs_kernel_amp ;
u32 kernel_threads_by_wgs_kernel_tm ;
u32 kernel_threads_by_wgs_kernel_memset ;
2016-09-16 15:01:18 +00:00
u32 kernel_loops ;
u32 kernel_accel ;
u32 kernel_loops_min ;
u32 kernel_loops_max ;
2016-12-15 12:19:10 +00:00
u32 kernel_loops_min_sav ; // the _sav are required because each -i iteration
u32 kernel_loops_max_sav ; // needs to recalculate the kernel_loops_min/max based on the current amplifier count
2016-09-16 15:01:18 +00:00
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 ;
2017-06-13 17:07:08 +00:00
size_t size_st_digests ;
size_t size_st_salts ;
size_t size_st_esalts ;
2016-09-16 15:01:18 +00:00
FILE * combs_fp ;
2017-06-24 22:56:25 +00:00
pw_t * combs_buf ;
2016-09-16 15:01:18 +00:00
void * hooks_buf ;
pw_t * pws_buf ;
u32 pws_cnt ;
u64 words_off ;
u64 words_done ;
u32 outerloop_pos ;
u32 outerloop_left ;
2016-12-09 22:44:43 +00:00
double outerloop_msec ;
2016-09-16 15:01:18 +00:00
u32 innerloop_pos ;
u32 innerloop_left ;
u32 exec_pos ;
2016-10-17 11:44:07 +00:00
double exec_msec [ EXEC_CACHE ] ;
2016-09-16 15:01:18 +00:00
// workaround cpu spinning
double exec_us_prev1 [ EXPECTED_ITERATIONS ] ;
double exec_us_prev2 [ EXPECTED_ITERATIONS ] ;
double exec_us_prev3 [ EXPECTED_ITERATIONS ] ;
2017-06-29 10:19:05 +00:00
double exec_us_prev4 [ EXPECTED_ITERATIONS ] ;
2017-01-26 20:16:29 +00:00
double exec_us_prev_init2 [ EXPECTED_ITERATIONS ] ;
double exec_us_prev_loop2 [ EXPECTED_ITERATIONS ] ;
2016-09-16 15:01:18 +00:00
// this is "current" speed
u32 speed_pos ;
u64 speed_cnt [ SPEED_CACHE ] ;
2016-10-17 11:44:07 +00:00
double speed_msec [ SPEED_CACHE ] ;
2016-09-16 15:01:18 +00:00
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 ;
2016-10-25 13:43:09 +00:00
char * device_opencl_version ;
2016-09-16 15:01:18 +00:00
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 ;
2017-06-29 10:19:05 +00:00
cl_kernel kernel4 ;
2017-01-26 20:16:29 +00:00
cl_kernel kernel_init2 ;
cl_kernel kernel_loop2 ;
2016-09-16 15:01:18 +00:00
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_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_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 ;
2017-06-13 17:07:08 +00:00
cl_mem d_st_digests_buf ;
cl_mem d_st_salts_buf ;
cl_mem d_st_esalts_buf ;
2016-09-16 15:01:18 +00:00
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 ] ;
2016-10-01 10:33:59 +00:00
} hc_device_param_t ;
2016-09-16 15:01:18 +00:00
2016-10-01 09:54:00 +00:00
typedef struct opencl_ctx
2016-09-16 15:01:18 +00:00
{
2016-09-30 10:21:09 +00:00
bool enabled ;
2016-09-16 15:01:18 +00:00
void * ocl ;
2016-09-17 15:05:01 +00:00
cl_uint platforms_cnt ;
2016-09-16 15:01:18 +00:00
cl_platform_id * platforms ;
2016-10-25 13:43:09 +00:00
char * * platforms_vendor ;
char * * platforms_name ;
char * * platforms_version ;
2016-10-26 09:24:00 +00:00
bool * platforms_skipped ;
2016-09-16 15:01:18 +00:00
2016-09-17 15:05:01 +00:00
cl_uint platform_devices_cnt ;
2016-09-16 15:01:18 +00:00
cl_device_id * platform_devices ;
u32 devices_cnt ;
u32 devices_active ;
hc_device_param_t * devices_param ;
2016-09-28 09:49:08 +00:00
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
2016-09-16 15:01:18 +00:00
u32 opencl_platforms_filter ;
u32 devices_filter ;
cl_device_type device_types_filter ;
2016-10-17 11:44:07 +00:00
double target_msec ;
2016-09-16 15:01:18 +00:00
2016-10-09 20:41:55 +00:00
bool need_adl ;
bool need_nvml ;
bool need_nvapi ;
bool need_xnvctrl ;
2016-11-05 22:19:13 +00:00
bool need_sysfs ;
2016-09-16 15:01:18 +00:00
2016-09-17 15:05:01 +00:00
int force_jit_compilation ;
2016-09-16 15:01:18 +00:00
} opencl_ctx_t ;
2016-10-09 20:41:55 +00:00
# include "ext_ADL.h"
# include "ext_nvapi.h"
# include "ext_nvml.h"
# include "ext_xnvctrl.h"
2016-11-05 22:19:13 +00:00
# include "ext_sysfs.h"
2016-10-09 20:41:55 +00:00
typedef struct hm_attrs
{
HM_ADAPTER_ADL adl ;
HM_ADAPTER_NVML nvml ;
HM_ADAPTER_NVAPI nvapi ;
HM_ADAPTER_XNVCTRL xnvctrl ;
2016-11-05 22:19:13 +00:00
HM_ADAPTER_SYSFS sysfs ;
2016-10-09 20:41:55 +00:00
int od_version ;
2016-11-21 14:58:44 +00:00
bool buslanes_get_supported ;
bool corespeed_get_supported ;
bool fanspeed_get_supported ;
bool fanspeed_set_supported ;
bool fanpolicy_get_supported ;
bool fanpolicy_set_supported ;
bool memoryspeed_get_supported ;
bool temperature_get_supported ;
bool threshold_shutdown_get_supported ;
bool threshold_slowdown_get_supported ;
bool throttle_get_supported ;
bool utilization_get_supported ;
2016-10-09 20:41:55 +00:00
} hm_attrs_t ;
typedef struct hwmon_ctx
{
bool enabled ;
void * hm_adl ;
void * hm_nvml ;
void * hm_nvapi ;
void * hm_xnvctrl ;
2016-11-05 22:19:13 +00:00
void * hm_sysfs ;
2016-10-09 20:41:55 +00:00
hm_attrs_t * hm_device ;
ADLOD6MemClockState * od_clock_mem_status ;
int * od_power_control_status ;
unsigned int * nvml_power_limit ;
} hwmon_ctx_t ;
2016-09-16 15:01:18 +00:00
# if defined (__APPLE__)
typedef struct cpu_set
{
u32 count ;
} cpu_set_t ;
# endif
/* AES context. */
typedef struct aes_context
{
2016-09-30 15:41:40 +00:00
int bits ;
2016-09-16 15:01:18 +00:00
u32 rek [ 60 ] ;
u32 rdk [ 60 ] ;
} aes_context_t ;
typedef aes_context_t aes_ctx ;
2016-10-01 09:54:00 +00:00
typedef struct debugfile_ctx
2016-09-16 15:01:18 +00:00
{
2016-09-30 09:48:14 +00:00
bool enabled ;
2016-09-16 15:01:18 +00:00
FILE * fp ;
char * filename ;
u32 mode ;
} debugfile_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct dictstat
2016-09-16 15:01:18 +00:00
{
u64 cnt ;
2016-10-31 10:28:06 +00:00
hc_stat_t stat ;
2016-09-16 15:01:18 +00:00
2017-04-14 14:36:28 +00:00
char encoding_from [ 64 ] ;
char encoding_to [ 64 ] ;
2016-09-16 15:01:18 +00:00
} dictstat_t ;
2016-10-01 09:54:00 +00:00
typedef struct dictstat_ctx
2016-09-16 15:01:18 +00:00
{
2016-09-24 11:01:17 +00:00
bool enabled ;
2016-09-16 15:01:18 +00:00
char * filename ;
dictstat_t * base ;
2017-02-23 23:55:06 +00:00
# if defined (_WIN)
2016-09-16 15:01:18 +00:00
u32 cnt ;
2017-02-23 23:55:06 +00:00
# else
size_t cnt ;
2016-09-16 15:01:18 +00:00
# endif
} dictstat_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct loopback_ctx
2016-09-16 15:01:18 +00:00
{
2016-09-30 10:07:49 +00:00
bool enabled ;
2016-10-26 13:10:59 +00:00
bool unused ;
2016-09-30 10:07:49 +00:00
2016-09-16 15:01:18 +00:00
FILE * fp ;
char * filename ;
} loopback_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct cs
2016-09-16 15:01:18 +00:00
{
u32 cs_buf [ 0x100 ] ;
u32 cs_len ;
} cs_t ;
2016-10-01 09:54:00 +00:00
typedef struct mf
2016-09-27 18:02:12 +00:00
{
char mf_buf [ 0x100 ] ;
int mf_len ;
} mf_t ;
2016-10-01 09:54:00 +00:00
typedef struct hcstat_table
2016-09-16 15:01:18 +00:00
{
u32 key ;
u64 val ;
} hcstat_table_t ;
2016-10-01 09:54:00 +00:00
typedef struct outfile_ctx
2016-09-16 15:01:18 +00:00
{
char * filename ;
FILE * fp ;
u32 outfile_format ;
2016-11-04 21:12:25 +00:00
bool outfile_autohex ;
2016-09-16 15:01:18 +00:00
} outfile_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct pot
2016-09-16 15:01:18 +00:00
{
char plain_buf [ HCBUFSIZ_TINY ] ;
int plain_len ;
hash_t hash ;
} pot_t ;
2016-10-01 09:54:00 +00:00
typedef struct potfile_ctx
2016-09-16 15:01:18 +00:00
{
2016-09-30 10:37:29 +00:00
bool enabled ;
2016-09-16 15:01:18 +00:00
2017-02-13 15:46:37 +00:00
bool keep_all_hashes ;
2017-02-01 08:00:16 +00:00
2016-09-16 15:01:18 +00:00
FILE * fp ;
char * filename ;
2016-10-30 21:47:48 +00:00
u8 * out_buf ; // allocates [HCBUFSIZ_LARGE];
u8 * tmp_buf ; // allocates [HCBUFSIZ_LARGE];
2016-09-16 15:01:18 +00:00
} potfile_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct restore_data
2016-09-16 15:01:18 +00:00
{
int version ;
char cwd [ 256 ] ;
2016-10-02 22:01:37 +00:00
u32 dicts_pos ;
2016-09-25 23:18:00 +00:00
u32 masks_pos ;
2016-09-16 15:01:18 +00:00
u64 words_cur ;
u32 argc ;
char * * argv ;
} restore_data_t ;
2017-01-27 15:29:18 +00:00
typedef struct pidfile_data
{
u32 pid ;
} pidfile_data_t ;
2016-10-01 09:54:00 +00:00
typedef struct restore_ctx
2016-09-24 23:02:44 +00:00
{
bool enabled ;
int argc ;
char * * argv ;
char * eff_restore_file ;
char * new_restore_file ;
restore_data_t * rd ;
} restore_ctx_t ;
2017-01-27 15:29:18 +00:00
typedef struct pidfile_ctx
{
u32 pid ;
char * filename ;
pidfile_data_t * pd ;
2017-02-17 07:59:22 +00:00
bool pidfile_written ;
2017-01-27 15:29:18 +00:00
} pidfile_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct kernel_rule
2016-09-16 15:01:18 +00:00
{
2016-09-22 20:54:20 +00:00
u32 cmds [ 32 ] ;
2016-09-16 15:01:18 +00:00
} kernel_rule_t ;
2016-10-01 09:54:00 +00:00
typedef struct out
2016-09-16 15:01:18 +00:00
{
FILE * fp ;
char buf [ BUFSIZ ] ;
int len ;
} out_t ;
2016-10-01 09:54:00 +00:00
typedef struct tuning_db_alias
2016-09-16 15:01:18 +00:00
{
char * device_name ;
char * alias_name ;
} tuning_db_alias_t ;
2016-10-01 09:54:00 +00:00
typedef struct tuning_db_entry
2016-09-16 15:01:18 +00:00
{
2017-04-10 20:35:01 +00:00
const char * device_name ;
int attack_mode ;
int hash_type ;
int workload_profile ;
int vector_width ;
int kernel_accel ;
int kernel_loops ;
2016-09-16 15:01:18 +00:00
} tuning_db_entry_t ;
2016-10-01 09:54:00 +00:00
typedef struct tuning_db
2016-09-16 15:01:18 +00:00
{
2016-09-30 10:58:06 +00:00
bool enabled ;
2016-09-16 15:01:18 +00:00
tuning_db_alias_t * alias_buf ;
int alias_cnt ;
tuning_db_entry_t * entry_buf ;
int entry_cnt ;
} tuning_db_t ;
2016-10-01 09:54:00 +00:00
typedef struct wl_data
2016-09-16 15:01:18 +00:00
{
2016-09-30 11:02:15 +00:00
bool enabled ;
2016-09-16 15:01:18 +00:00
char * buf ;
2016-09-30 14:43:59 +00:00
u64 incr ;
u64 avail ;
u64 cnt ;
u64 pos ;
2016-09-16 15:01:18 +00:00
2017-04-14 14:36:28 +00:00
bool iconv_enabled ;
iconv_t iconv_ctx ;
char * iconv_tmp ;
2016-09-30 14:43:59 +00:00
void ( * func ) ( char * , u64 , u64 * , u64 * ) ;
2016-09-22 09:35:08 +00:00
2016-09-16 15:01:18 +00:00
} wl_data_t ;
2016-10-01 09:54:00 +00:00
typedef struct user_options
2016-09-20 14:04:22 +00:00
{
2017-04-10 20:35:01 +00:00
const char * hc_bin ;
int hc_argc ;
char * * hc_argv ;
bool attack_mode_chgd ;
bool hash_mode_chgd ;
bool increment_max_chgd ;
bool increment_min_chgd ;
bool kernel_accel_chgd ;
bool kernel_loops_chgd ;
bool nvidia_spin_damp_chgd ;
bool opencl_vector_width_chgd ;
bool outfile_format_chgd ;
bool remove_timer_chgd ;
bool rp_gen_seed_chgd ;
bool runtime_chgd ;
bool workload_profile_chgd ;
bool segment_size_chgd ;
bool hccapx_message_pair_chgd ;
bool advice_disable ;
bool benchmark ;
bool force ;
bool gpu_temp_disable ;
bool hex_charset ;
bool hex_salt ;
bool hex_wordlist ;
bool increment ;
bool keep_guessing ;
bool keyspace ;
bool left ;
2017-06-29 10:19:05 +00:00
bool length_limit_disable ;
2017-04-10 20:35:01 +00:00
bool logfile_disable ;
bool loopback ;
bool machine_readable ;
bool markov_classic ;
bool markov_disable ;
bool opencl_info ;
bool outfile_autohex ;
bool potfile_disable ;
bool powertune_enable ;
bool quiet ;
bool remove ;
bool restore ;
bool restore_disable ;
2017-06-29 10:19:05 +00:00
bool self_test_disable ;
2017-04-10 20:35:01 +00:00
bool show ;
bool status ;
bool stdout_flag ;
bool speed_only ;
bool progress_only ;
bool usage ;
bool username ;
bool version ;
char * cpu_affinity ;
char * custom_charset_1 ;
char * custom_charset_2 ;
char * custom_charset_3 ;
char * custom_charset_4 ;
char * debug_file ;
2017-04-14 14:36:28 +00:00
char * encoding_from ;
char * encoding_to ;
2017-04-10 20:35:01 +00:00
char * induction_dir ;
char * markov_hcstat ;
char * opencl_devices ;
char * opencl_device_types ;
char * opencl_platforms ;
char * outfile ;
char * outfile_check_dir ;
char * potfile_path ;
char * restore_file_path ;
char * * rp_files ;
char * rule_buf_l ;
char * rule_buf_r ;
char separator ;
const char * session ;
char * truecrypt_keyfiles ;
char * veracrypt_keyfiles ;
u32 attack_mode ;
u32 bitmap_max ;
u32 bitmap_min ;
u32 debug_mode ;
u32 gpu_temp_abort ;
u32 gpu_temp_retain ;
u32 hash_mode ;
u32 hccapx_message_pair ;
u32 increment_max ;
u32 increment_min ;
u32 kernel_accel ;
u32 kernel_loops ;
u32 markov_threshold ;
u32 nonce_error_corrections ;
u32 nvidia_spin_damp ;
u32 opencl_vector_width ;
u32 outfile_check_timer ;
u32 outfile_format ;
u32 remove_timer ;
u32 restore_timer ;
u32 rp_files_cnt ;
u32 rp_gen ;
u32 rp_gen_func_max ;
u32 rp_gen_func_min ;
u32 rp_gen_seed ;
u32 runtime ;
u32 scrypt_tmto ;
u32 segment_size ;
u32 status_timer ;
u32 veracrypt_pim ;
u32 weak_hash_threshold ;
u32 workload_profile ;
u64 limit ;
u64 skip ;
2016-10-02 21:30:31 +00:00
2016-09-20 14:04:22 +00:00
} user_options_t ;
2016-10-01 09:54:00 +00:00
typedef struct user_options_extra
2016-09-21 09:09:12 +00:00
{
u32 attack_kern ;
2016-09-21 14:07:49 +00:00
u32 rule_len_r ;
u32 rule_len_l ;
2016-09-21 14:25:36 +00:00
u32 wordlist_mode ;
2016-10-02 21:30:31 +00:00
char * hc_hash ; // can be filename or string
int hc_workc ; // can be 0 in bf-mode = default mask
char * * hc_workv ;
2016-09-21 09:09:12 +00:00
} user_options_extra_t ;
2016-10-01 09:54:00 +00:00
typedef struct bitmap_ctx
2016-09-22 14:23:36 +00:00
{
2016-09-30 09:48:14 +00:00
bool enabled ;
2016-09-22 14:23:36 +00:00
u32 bitmap_bits ;
u32 bitmap_nums ;
u32 bitmap_size ;
u32 bitmap_mask ;
u32 bitmap_shift1 ;
u32 bitmap_shift2 ;
u32 * bitmap_s1_a ;
u32 * bitmap_s1_b ;
u32 * bitmap_s1_c ;
u32 * bitmap_s1_d ;
u32 * bitmap_s2_a ;
u32 * bitmap_s2_b ;
u32 * bitmap_s2_c ;
u32 * bitmap_s2_d ;
} bitmap_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct folder_config
2016-09-21 21:06:11 +00:00
{
char * cwd ;
char * install_dir ;
char * profile_dir ;
char * session_dir ;
char * shared_dir ;
char * cpath_real ;
} folder_config_t ;
2016-10-01 09:54:00 +00:00
typedef struct induct_ctx
2016-09-22 15:06:53 +00:00
{
bool enabled ;
char * root_directory ;
char * * induction_dictionaries ;
int induction_dictionaries_cnt ;
2016-09-29 12:46:51 +00:00
int induction_dictionaries_pos ;
2016-09-22 15:06:53 +00:00
} induct_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct outcheck_ctx
2016-09-27 11:13:07 +00:00
{
bool enabled ;
char * root_directory ;
} outcheck_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct straight_ctx
2016-09-27 11:13:07 +00:00
{
bool enabled ;
u32 kernel_rules_cnt ;
kernel_rule_t * kernel_rules_buf ;
2016-09-29 12:46:51 +00:00
char * * dicts ;
u32 dicts_pos ;
u32 dicts_cnt ;
u32 dicts_avail ;
char * dict ;
2016-09-27 11:13:07 +00:00
} straight_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct combinator_ctx
2016-09-27 16:32:09 +00:00
{
bool enabled ;
2016-10-05 13:41:56 +00:00
char * scratch_buf ;
2016-09-29 12:46:51 +00:00
char * dict1 ;
char * dict2 ;
2016-09-27 16:32:09 +00:00
u32 combs_mode ;
2017-02-22 11:28:23 +00:00
u64 combs_cnt ;
2016-09-27 16:32:09 +00:00
} combinator_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct mask_ctx
2016-09-25 23:18:00 +00:00
{
2016-09-26 13:11:46 +00:00
bool enabled ;
2016-11-10 18:25:04 +00:00
cs_t mp_sys [ 8 ] ;
2016-09-25 23:18:00 +00:00
cs_t mp_usr [ 4 ] ;
2016-09-26 15:50:47 +00:00
u64 bfs_cnt ;
2016-09-25 23:18:00 +00:00
cs_t * css_buf ;
u32 css_cnt ;
hcstat_table_t * root_table_buf ;
hcstat_table_t * markov_table_buf ;
cs_t * root_css_buf ;
cs_t * markov_css_buf ;
bool mask_from_file ;
char * * masks ;
u32 masks_pos ;
u32 masks_cnt ;
u32 masks_avail ;
char * mask ;
2016-09-27 18:02:12 +00:00
mf_t * mfs ;
2016-09-25 23:18:00 +00:00
} mask_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct cpt_ctx
2016-09-29 13:19:12 +00:00
{
2016-09-30 09:48:14 +00:00
bool enabled ;
2016-09-29 13:19:12 +00:00
cpt_t * cpt_buf ;
int cpt_pos ;
time_t cpt_start ;
u64 cpt_total ;
} cpt_ctx_t ;
2017-06-04 19:23:55 +00:00
typedef struct device_info
2016-11-02 21:45:39 +00:00
{
bool skipped_dev ;
double hashes_msec_dev ;
double hashes_msec_dev_benchmark ;
double exec_msec_dev ;
char * speed_sec_dev ;
2017-03-24 22:39:09 +00:00
char * guess_candidates_dev ;
2016-11-02 21:45:39 +00:00
char * hwmon_dev ;
2016-11-10 16:50:29 +00:00
int corespeed_dev ;
int memoryspeed_dev ;
2016-12-09 22:44:43 +00:00
double runtime_msec_dev ;
int progress_dev ;
2016-11-02 21:45:39 +00:00
} device_info_t ;
2017-06-04 19:23:55 +00:00
typedef struct hashcat_status
2016-11-02 21:45:39 +00:00
{
2017-04-10 20:35:01 +00:00
const char * hash_target ;
char * hash_type ;
int guess_mode ;
char * guess_base ;
int guess_base_offset ;
int guess_base_count ;
double guess_base_percent ;
char * guess_mod ;
int guess_mod_offset ;
int guess_mod_count ;
double guess_mod_percent ;
char * guess_charset ;
int guess_mask_length ;
char * session ;
char * status_string ;
int status_number ;
char * time_estimated_absolute ;
char * time_estimated_relative ;
char * time_started_absolute ;
char * time_started_relative ;
double msec_paused ;
double msec_running ;
double msec_real ;
int digests_cnt ;
int digests_done ;
double digests_percent ;
int salts_cnt ;
int salts_done ;
double salts_percent ;
int progress_mode ;
double progress_finished_percent ;
u64 progress_cur ;
u64 progress_cur_relative_skip ;
u64 progress_done ;
u64 progress_end ;
u64 progress_end_relative_skip ;
u64 progress_ignore ;
u64 progress_rejected ;
double progress_rejected_percent ;
u64 progress_restored ;
u64 progress_skip ;
u64 restore_point ;
u64 restore_total ;
double restore_percent ;
int cpt_cur_min ;
int cpt_cur_hour ;
int cpt_cur_day ;
double cpt_avg_min ;
double cpt_avg_hour ;
double cpt_avg_day ;
char * cpt ;
2016-11-02 21:45:39 +00:00
device_info_t device_info_buf [ DEVICES_MAX ] ;
int device_info_cnt ;
int device_info_active ;
double hashes_msec_all ;
double exec_msec_all ;
char * speed_sec_all ;
} hashcat_status_t ;
2016-10-01 09:54:00 +00:00
typedef struct status_ctx
2016-09-29 20:27:04 +00:00
{
2016-09-29 21:49:33 +00:00
/**
* main status
*/
2016-10-29 13:12:45 +00:00
bool accessible ;
2016-09-29 21:25:29 +00:00
u32 devices_status ;
2016-11-02 21:45:39 +00:00
/**
* full ( final ) status snapshot
*/
hashcat_status_t * hashcat_status_final ;
2016-09-29 21:49:33 +00:00
/**
* thread control
*/
2016-10-14 17:25:13 +00:00
bool run_main_level1 ;
2016-09-29 21:25:29 +00:00
bool run_main_level2 ;
bool run_main_level3 ;
bool run_thread_level1 ;
bool run_thread_level2 ;
2016-09-29 21:49:33 +00:00
bool shutdown_inner ;
bool shutdown_outer ;
2016-10-23 11:38:41 +00:00
bool checkpoint_shutdown ;
2016-09-29 21:49:33 +00:00
hc_thread_mutex_t mux_dispatcher ;
hc_thread_mutex_t mux_counter ;
hc_thread_mutex_t mux_hwmon ;
hc_thread_mutex_t mux_display ;
/**
* workload
*/
2016-10-20 19:27:42 +00:00
u64 words_off ; // used by dispatcher; get_work () as offset; attention: needs to be redone on in restore case!
u64 words_cur ; // used by dispatcher; the different to words_cur_next is that this counter guarantees that the work from zero to this counter has been actually computed
// has been finished actually, can be used for restore point therefore
u64 words_base ; // the unamplified max keyspace
u64 words_cnt ; // the amplified max keyspace
2016-09-29 21:49:33 +00:00
/**
* progress
*/
2016-10-23 11:38:41 +00:00
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
2016-09-29 20:27:04 +00:00
2016-09-29 21:49:33 +00:00
/**
* timer
*/
time_t runtime_start ;
time_t runtime_stop ;
2016-10-23 11:38:41 +00:00
hc_timer_t timer_running ; // timer on current dict
hc_timer_t timer_paused ; // timer on current dict
2016-09-29 21:49:33 +00:00
2016-10-23 11:38:41 +00:00
double msec_paused ; // timer on current dict
2016-09-29 21:49:33 +00:00
2016-09-29 20:27:04 +00:00
} status_ctx_t ;
2016-10-07 14:56:44 +00:00
typedef struct hashcat_user
{
// use this for context specific data
2016-10-23 11:38:41 +00:00
// see main.c as how this example is used
2016-10-07 14:56:44 +00:00
int outer_threads_cnt ;
hc_thread_t * outer_threads ;
} hashcat_user_t ;
2016-10-23 12:06:52 +00:00
typedef struct cache_hit
{
char * dictfile ;
2016-10-31 10:28:06 +00:00
hc_stat_t stat ;
2016-10-23 12:06:52 +00:00
u64 cached_cnt ;
u64 keyspace ;
} cache_hit_t ;
typedef struct cache_generate
{
char * dictfile ;
double percent ;
u64 comp ;
u64 cnt ;
u64 cnt2 ;
2017-05-23 08:07:04 +00:00
time_t runtime ;
2016-10-23 12:06:52 +00:00
} cache_generate_t ;
2016-10-23 12:49:40 +00:00
typedef struct hashlist_parse
{
u32 hashes_cnt ;
u32 hashes_avail ;
} hashlist_parse_t ;
2016-10-23 15:31:22 +00:00
# define MAX_OLD_EVENTS 10
2016-10-08 21:16:40 +00:00
typedef struct event_ctx
{
2016-10-23 15:31:22 +00:00
char old_buf [ MAX_OLD_EVENTS ] [ HCBUFSIZ_TINY ] ;
int old_len [ MAX_OLD_EVENTS ] ;
int old_cnt ;
2016-10-13 17:16:24 +00:00
char msg_buf [ HCBUFSIZ_TINY ] ;
int msg_len ;
bool msg_newline ;
int prev_len ;
2016-10-08 21:16:40 +00:00
hc_thread_mutex_t mux_event ;
} event_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct hashcat_ctx
2016-09-16 15:01:18 +00:00
{
2016-09-28 09:55:02 +00:00
bitmap_ctx_t * bitmap_ctx ;
combinator_ctx_t * combinator_ctx ;
2016-09-29 13:19:12 +00:00
cpt_ctx_t * cpt_ctx ;
2016-09-28 09:55:02 +00:00
debugfile_ctx_t * debugfile_ctx ;
2016-09-30 20:52:44 +00:00
dictstat_ctx_t * dictstat_ctx ;
2016-10-08 21:16:40 +00:00
event_ctx_t * event_ctx ;
2016-09-30 20:52:44 +00:00
folder_config_t * folder_config ;
2016-10-07 14:56:44 +00:00
hashcat_user_t * hashcat_user ;
2016-09-28 09:55:02 +00:00
hashconfig_t * hashconfig ;
hashes_t * hashes ;
2016-09-28 13:26:56 +00:00
hwmon_ctx_t * hwmon_ctx ;
2016-09-28 09:55:02 +00:00
induct_ctx_t * induct_ctx ;
logfile_ctx_t * logfile_ctx ;
loopback_ctx_t * loopback_ctx ;
mask_ctx_t * mask_ctx ;
opencl_ctx_t * opencl_ctx ;
outcheck_ctx_t * outcheck_ctx ;
outfile_ctx_t * outfile_ctx ;
2017-01-27 15:29:18 +00:00
pidfile_ctx_t * pidfile_ctx ;
2016-09-28 09:55:02 +00:00
potfile_ctx_t * potfile_ctx ;
restore_ctx_t * restore_ctx ;
2016-09-29 20:27:04 +00:00
status_ctx_t * status_ctx ;
2016-09-28 09:55:02 +00:00
straight_ctx_t * straight_ctx ;
2016-09-30 10:58:06 +00:00
tuning_db_t * tuning_db ;
2016-09-28 09:55:02 +00:00
user_options_extra_t * user_options_extra ;
user_options_t * user_options ;
2016-09-30 20:52:44 +00:00
wl_data_t * wl_data ;
2016-10-12 09:27:10 +00:00
void ( * event ) ( const u32 , struct hashcat_ctx * , const void * , const size_t ) ;
2016-10-07 14:56:44 +00:00
2016-09-30 20:52:44 +00:00
} hashcat_ctx_t ;
2016-10-01 09:54:00 +00:00
typedef struct thread_param
2016-09-30 20:52:44 +00:00
{
u32 tid ;
hashcat_ctx_t * hashcat_ctx ;
2016-09-28 09:55:02 +00:00
2016-09-30 20:52:44 +00:00
} thread_param_t ;
2016-09-16 15:01:18 +00:00
2016-09-06 16:44:05 +00:00
# endif // _TYPES_H