1
mirror of https://github.com/hashcat/hashcat synced 2024-12-27 05:13:45 +01:00

Add all defaults for user commandline parameters to user_options.h; Prepare user commandline parameter struct for easier handling of functions calls that require them

This commit is contained in:
jsteube 2016-09-20 16:04:22 +02:00
parent ced3b3b82f
commit e6f083b708
32 changed files with 458 additions and 265 deletions

View File

@ -6,6 +6,4 @@
#ifndef _ATTACK_MODE_H
#define _ATTACK_MODE_H
#define ATTACK_MODE 0
#endif // _ATTACK_MODE_H

View File

@ -6,8 +6,6 @@
#ifndef _AUTOTUNE_H
#define _AUTOTUNE_H
#define OPENCL_VECTOR_WIDTH 0
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig);
void *thread_autotune (void *p);

View File

@ -6,8 +6,6 @@
#ifndef _BENCHMARK_H
#define _BENCHMARK_H
#define BENCHMARK 0
#define DEFAULT_BENCHMARK_ALGORITHMS_CNT 146
#endif // _BENCHMARK_H

View File

@ -8,9 +8,6 @@
#include <string.h>
#define BITMAP_MIN 16
#define BITMAP_MAX 24
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);

View File

@ -8,8 +8,6 @@
#include <stdio.h>
#define DEBUG_MODE 0
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);

View File

@ -6,8 +6,6 @@
#ifndef _HASH_MANAGEMENT_H
#define _HASH_MANAGEMENT_H
#define USERNAME 0
int sort_by_digest_p0p1 (const void *v1, const void *v2);
int sort_by_salt (const void *v1, const void *v2);
int sort_by_hash (const void *v1, const void *v2);

View File

@ -6,10 +6,6 @@
#ifndef _HWMON_H
#define _HWMON_H
#define GPU_TEMP_DISABLE 0
#define GPU_TEMP_ABORT 90
#define GPU_TEMP_RETAIN 75
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);

View File

@ -16,10 +16,6 @@
#define PW_MAX 54
#define PW_MAX1 (PW_MAX + 1)
#define HASH_MODE 0
#define HEX_SALT 0
#define SEPARATOR ':'
/**
* weak hashes shutcut
*/

View File

@ -11,8 +11,6 @@
#include <stdarg.h>
#include <time.h>
#define LOGFILE_DISABLE 0
// logfile_append() checks for logfile_disable internally to make it easier from here
#define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));

View File

@ -11,7 +11,6 @@
#include <errno.h>
#include <time.h>
#define LOOPBACK 0
#define LOOPBACK_FILE "hashcat.loopback"
void loopback_init (loopback_ctx_t *loopback_ctx);

View File

@ -18,16 +18,7 @@
#define SP_ROOT_CNT (SP_PW_MAX * CHARSIZ)
#define SP_MARKOV_CNT (SP_PW_MAX * CHARSIZ * CHARSIZ)
#define MARKOV_THRESHOLD 0
#define MARKOV_DISABLE 0
#define MARKOV_CLASSIC 0
#define HEX_CHARSET 0
#define INCR_MASKS 1000
#define INCREMENT 0
#define INCREMENT_MIN 1
#define INCREMENT_MAX PW_MAX
#define INCR_MASKS 1000
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);

View File

@ -9,17 +9,6 @@
#include <stdio.h>
#include <errno.h>
#define KERNEL_ACCEL 0
#define KERNEL_LOOPS 0
#define KERNEL_RULES 1024
#define KERNEL_COMBS 1024
#define KERNEL_BFS 1024
#define KERNEL_THREADS_MAX 256
#define KERNEL_THREADS_MAX_CPU 1
#define WORKLOAD_PROFILE 2
#define SCRYPT_TMTO 0
#define NVIDIA_SPIN_DAMP 100
static const char CL_VENDOR_AMD[] = "Advanced Micro Devices, Inc.";
static const char CL_VENDOR_AMD_USE_INTEL[] = "GenuineIntel";
static const char CL_VENDOR_APPLE[] = "Apple";
@ -29,6 +18,16 @@ static const char CL_VENDOR_MESA[] = "Mesa";
static const char CL_VENDOR_NV[] = "NVIDIA Corporation";
static const char CL_VENDOR_POCL[] = "The pocl project";
typedef enum amplifier_count
{
KERNEL_BFS = 1024,
KERNEL_COMBS = 1024,
KERNEL_RULES = 1024,
KERNEL_THREADS_MAX = 256,
KERNEL_THREADS_MAX_CPU = 1
} amplifier_count_t;
typedef enum vendor_id
{
VENDOR_ID_AMD = (1 << 0),

View File

@ -10,9 +10,6 @@
#include <time.h>
#include <inttypes.h>
#define OUTFILE_FORMAT 3
#define OUTFILE_AUTOHEX 1
typedef enum outfile_fmt
{
OUTFILE_FMT_HASH = (1 << 0),

View File

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

View File

@ -9,10 +9,6 @@
#include <stdio.h>
#include <errno.h>
#define SHOW 0
#define LEFT 0
#define POTFILE_DISABLE 0
#define INCR_POT 1000
int sort_by_pot (const void *v1, const void *v2);

View File

@ -6,6 +6,4 @@
#ifndef _POWERTUNE_H
#define _POWERTUNE_H
#define POWERTUNE_ENABLE 0
#endif // _POWERTUNE_H

View File

@ -6,7 +6,4 @@
#ifndef _REMOVE_H
#define _REMOVE_H
#define REMOVE 0
#define REMOVE_TIMER 60
#endif // _REMOVE_H

View File

@ -20,17 +20,9 @@
#include <psapi.h>
#endif // _WIN
#define RESTORE 0
#define RESTORE_TIMER 60
#define RESTORE_DISABLE 0
#define RESTORE_VERSION_MIN 320
#define RESTORE_VERSION_CUR 320
#define SKIP 0
#define LIMIT 0
#define KEYSPACE 0
u64 get_lowest_words_done (opencl_ctx_t *opencl_ctx);
restore_data_t *init_restore (int argc, char **argv);

View File

@ -72,12 +72,6 @@
#define RULE_OP_MANGLE_DUPEBLOCK_LAST 'Y'
#define RULE_OP_MANGLE_TITLE 'E'
#define RP_GEN 0
#define RP_GEN_FUNC_MIN 1
#define RP_GEN_FUNC_MAX 4
#define RP_GEN_SEED 0
#define RULE_BUF_L ":"
#define RULE_BUF_R ":"
#define INCR_RULES 10000
int generate_random_rule (char rule_buf[RP_RULE_BUFSIZ], u32 rp_gen_func_min, u32 rp_gen_func_max);

View File

@ -6,6 +6,4 @@
#ifndef _RUNTIME_H
#define _RUNTIME_H
#define RUNTIME 0
#endif // _RUNTIME_H

View File

@ -9,10 +9,6 @@
#include <stdio.h>
#include <inttypes.h>
#define STATUS 0
#define STATUS_TIMER 10
#define MACHINE_READABLE 0
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
void status_display_machine_readable (opencl_ctx_t *opencl_ctx, const hashes_t *hashes);

View File

@ -20,8 +20,6 @@
#include <pwd.h>
#endif // _POSIX
#define STDOUT_FLAG 0
void process_stdout (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const uint pws_cnt);
#endif // _STDOUT_H

View File

@ -23,8 +23,6 @@
#include <windows.h>
#endif // _WIN
#define QUIET 0
void send_prompt ();
void clear_prompt ();

View File

@ -750,6 +750,92 @@ typedef struct
} wl_data_t;
typedef struct
{
bool usage;
bool version;
bool quiet;
bool benchmark;
bool stdout_flag;
bool show;
bool left;
bool username;
bool remove;
u32 remove_timer;
u64 skip;
u64 limit;
bool force;
bool keyspace;
bool potfile_disable;
char *potfile_path;
u32 debug_mode;
char *debug_file;
char *induction_dir;
char *outfile_check_dir;
u32 runtime;
u32 hash_mode;
u32 attack_mode;
char *outfile;
u32 outfile_format;
bool outfile_autohex;
u32 outfile_check_timer;
bool restore;
u32 restore_timer;
bool restore_disable;
bool status;
u32 status_timer;
bool machine_readable;
bool loopback;
u32 weak_hash_threshold;
char *session;
bool hex_charset;
bool hex_salt;
bool hex_wordlist;
u32 rp_gen;
u32 rp_gen_func_min;
u32 rp_gen_func_max;
u32 rp_gen_seed;
char *rule_buf_l;
char *rule_buf_r;
bool increment;
u32 increment_min;
u32 increment_max;
char *cpu_affinity;
bool opencl_info;
char *opencl_devices;
char *opencl_platforms;
char *opencl_device_types;
u32 opencl_vector_width;
char *truecrypt_keyfiles;
char *veracrypt_keyfiles;
u32 veracrypt_pim;
u32 workload_profile;
u32 kernel_accel;
u32 kernel_loops;
u32 nvidia_spin_damp;
bool gpu_temp_disable;
#if defined (HAVE_HWMON)
u32 gpu_temp_abort;
u32 gpu_temp_retain;
bool powertune_enable;
#endif
bool logfile_disable;
u32 segment_size;
u32 scrypt_tmto;
char separator;
u32 bitmap_min;
u32 bitmap_max;
bool markov_disable;
bool markov_classic;
u32 markov_threshold;
char *markov_hcstat;
char *custom_charset_1;
char *custom_charset_2;
char *custom_charset_3;
char *custom_charset_4;
} user_options_t;
typedef struct
{
bool quiet;

View File

@ -6,8 +6,6 @@
#ifndef _USAGE_H
#define _USAGE_H
#define USAGE 0
void usage_mini_print (const char *progname);
void usage_big_print (const char *progname);

255
include/user_options.h Normal file
View File

@ -0,0 +1,255 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _USER_OPTIONS_H
#define _USER_OPTIONS_H
#include <getopt.h>
typedef enum user_options_defaults
{
ATTACK_MODE = 0,
BENCHMARK = 0,
BITMAP_MAX = 24,
BITMAP_MIN = 16,
DEBUG_MODE = 0,
FORCE = 0,
GPU_TEMP_ABORT = 90,
GPU_TEMP_DISABLE = 0,
GPU_TEMP_RETAIN = 75,
HASH_MODE = 0,
HEX_CHARSET = 0,
HEX_SALT = 0,
HEX_WORDLIST = 0,
INCREMENT = 0,
INCREMENT_MAX = PW_MAX,
INCREMENT_MIN = 1,
KERNEL_ACCEL = 0,
KERNEL_LOOPS = 0,
KEYSPACE = 0,
LEFT = 0,
LIMIT = 0,
LOGFILE_DISABLE = 0,
LOOPBACK = 0,
MACHINE_READABLE = 0,
MARKOV_CLASSIC = 0,
MARKOV_DISABLE = 0,
MARKOV_THRESHOLD = 0,
NVIDIA_SPIN_DAMP = 100,
OPENCL_VECTOR_WIDTH = 0,
OUTFILE_AUTOHEX = 1,
OUTFILE_CHECK_TIMER = 5,
OUTFILE_FORMAT = 3,
POTFILE_DISABLE = 0,
POWERTUNE_ENABLE = 0,
QUIET = 0,
REMOVE = 0,
REMOVE_TIMER = 60,
RESTORE = 0,
RESTORE_DISABLE = 0,
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,
SEGMENT_SIZE = 32,
SEPARATOR = ':',
SHOW = 0,
SKIP = 0,
STATUS = 0,
STATUS_TIMER = 10,
STDOUT_FLAG = 0,
USAGE = 0,
USERNAME = 0,
VERSION = 0,
WEAK_HASH_THRESHOLD = 100,
WORKLOAD_PROFILE = 2,
} user_options_defaults_t;
static char RULE_BUF_R[] = ":";
static char RULE_BUF_L[] = ":";
typedef enum user_options_map
{
IDX_ATTACK_MODE = 'a',
IDX_BENCHMARK = 'b',
IDX_BITMAP_MAX = 0xff00,
IDX_BITMAP_MIN = 0xff01,
IDX_CPU_AFFINITY = 0xff02,
IDX_CUSTOM_CHARSET_1 = '1',
IDX_CUSTOM_CHARSET_2 = '2',
IDX_CUSTOM_CHARSET_3 = '3',
IDX_CUSTOM_CHARSET_4 = '4',
IDX_DEBUG_FILE = 0xff03,
IDX_DEBUG_MODE = 0xff04,
IDX_FORCE = 0xff05,
IDX_GPU_TEMP_ABORT = 0xff06,
IDX_GPU_TEMP_DISABLE = 0xff07,
IDX_GPU_TEMP_RETAIN = 0xff08,
IDX_HASH_MODE = 'm',
IDX_HELP = 'h',
IDX_HEX_CHARSET = 0xff09,
IDX_HEX_SALT = 0xff0a,
IDX_HEX_WORDLIST = 0xff0b,
IDX_INCREMENT = 'i',
IDX_INCREMENT_MAX = 0xff0c,
IDX_INCREMENT_MIN = 0xff0d,
IDX_INDUCTION_DIR = 0xff0e,
IDX_KERNEL_ACCEL = 'n',
IDX_KERNEL_LOOPS = 'u',
IDX_KEYSPACE = 0xff0f,
IDX_LEFT = 0xff10,
IDX_LIMIT = 'l',
IDX_LOGFILE_DISABLE = 0xff11,
IDX_LOOPBACK = 0xff12,
IDX_MACHINE_READABLE = 0xff13,
IDX_MARKOV_CLASSIC = 0xff14,
IDX_MARKOV_DISABLE = 0xff15,
IDX_MARKOV_HCSTAT = 0xff16,
IDX_MARKOV_THRESHOLD = 't',
IDX_NVIDIA_SPIN_DAMP = 0xff17,
IDX_OPENCL_DEVICES = 'd',
IDX_OPENCL_DEVICE_TYPES = 'D',
IDX_OPENCL_INFO = 'I',
IDX_OPENCL_PLATFORMS = 0xff18,
IDX_OPENCL_VECTOR_WIDTH = 0xff19,
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff1a,
IDX_OUTFILE_CHECK_DIR = 0xff1b,
IDX_OUTFILE_CHECK_TIMER = 0xff1c,
IDX_OUTFILE_FORMAT = 0xff1d,
IDX_OUTFILE = 'o',
IDX_POTFILE_DISABLE = 0xff1e,
IDX_POTFILE_PATH = 0xff1f,
IDX_POWERTUNE_ENABLE = 0xff20,
IDX_QUIET = 0xff21,
IDX_REMOVE = 0xff22,
IDX_REMOVE_TIMER = 0xff23,
IDX_RESTORE = 0xff24,
IDX_RESTORE_DISABLE = 0xff25,
IDX_RP_FILE = 'r',
IDX_RP_GEN_FUNC_MAX = 0xff26,
IDX_RP_GEN_FUNC_MIN = 0xff27,
IDX_RP_GEN = 'g',
IDX_RP_GEN_SEED = 0xff28,
IDX_RULE_BUF_L = 'j',
IDX_RULE_BUF_R = 'k',
IDX_RUNTIME = 0xff29,
IDX_SCRYPT_TMTO = 0xff2a,
IDX_SEGMENT_SIZE = 'c',
IDX_SEPARATOR = 'p',
IDX_SESSION = 0xff2b,
IDX_SHOW = 0xff2c,
IDX_SKIP = 's',
IDX_STATUS = 0xff2d,
IDX_STATUS_TIMER = 0xff2e,
IDX_STDOUT_FLAG = 0xff2f,
IDX_TRUECRYPT_KEYFILES = 0xff30,
IDX_USERNAME = 0xff31,
IDX_VERACRYPT_KEYFILES = 0xff32,
IDX_VERACRYPT_PIM = 0xff33,
IDX_VERSION_LOWER = 'v',
IDX_VERSION = 'V',
IDX_WEAK_HASH_THRESHOLD = 0xff34,
IDX_WORKLOAD_PROFILE = 'w'
} user_options_map_t;
static const char short_options[] = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:iIbw:";
static const struct option long_options[] =
{
{"help", no_argument, 0, IDX_HELP},
{"version", no_argument, 0, IDX_VERSION},
{"quiet", no_argument, 0, IDX_QUIET},
{"show", no_argument, 0, IDX_SHOW},
{"left", no_argument, 0, IDX_LEFT},
{"username", no_argument, 0, IDX_USERNAME},
{"remove", no_argument, 0, IDX_REMOVE},
{"remove-timer", required_argument, 0, IDX_REMOVE_TIMER},
{"skip", required_argument, 0, IDX_SKIP},
{"limit", required_argument, 0, IDX_LIMIT},
{"keyspace", no_argument, 0, IDX_KEYSPACE},
{"potfile-disable", no_argument, 0, IDX_POTFILE_DISABLE},
{"potfile-path", required_argument, 0, IDX_POTFILE_PATH},
{"debug-mode", required_argument, 0, IDX_DEBUG_MODE},
{"debug-file", required_argument, 0, IDX_DEBUG_FILE},
{"induction-dir", required_argument, 0, IDX_INDUCTION_DIR},
{"outfile-check-dir", required_argument, 0, IDX_OUTFILE_CHECK_DIR},
{"force", no_argument, 0, IDX_FORCE},
{"benchmark", no_argument, 0, IDX_BENCHMARK},
{"stdout", no_argument, 0, IDX_STDOUT_FLAG},
{"restore", no_argument, 0, IDX_RESTORE},
{"restore-disable", no_argument, 0, IDX_RESTORE_DISABLE},
{"status", no_argument, 0, IDX_STATUS},
{"status-timer", required_argument, 0, IDX_STATUS_TIMER},
{"machine-readable", no_argument, 0, IDX_MACHINE_READABLE},
{"loopback", no_argument, 0, IDX_LOOPBACK},
{"weak-hash-threshold", required_argument, 0, IDX_WEAK_HASH_THRESHOLD},
{"session", required_argument, 0, IDX_SESSION},
{"runtime", required_argument, 0, IDX_RUNTIME},
{"generate-rules", required_argument, 0, IDX_RP_GEN},
{"generate-rules-func-min", required_argument, 0, IDX_RP_GEN_FUNC_MIN},
{"generate-rules-func-max", required_argument, 0, IDX_RP_GEN_FUNC_MAX},
{"generate-rules-seed", required_argument, 0, IDX_RP_GEN_SEED},
{"rule-left", required_argument, 0, IDX_RULE_BUF_L},
{"rule-right", required_argument, 0, IDX_RULE_BUF_R},
{"hash-type", required_argument, 0, IDX_HASH_MODE},
{"attack-mode", required_argument, 0, IDX_ATTACK_MODE},
{"rules-file", required_argument, 0, IDX_RP_FILE},
{"outfile", required_argument, 0, IDX_OUTFILE},
{"outfile-format", required_argument, 0, IDX_OUTFILE_FORMAT},
{"outfile-autohex-disable", no_argument, 0, IDX_OUTFILE_AUTOHEX_DISABLE},
{"outfile-check-timer", required_argument, 0, IDX_OUTFILE_CHECK_TIMER},
{"hex-charset", no_argument, 0, IDX_HEX_CHARSET},
{"hex-salt", no_argument, 0, IDX_HEX_SALT},
{"hex-wordlist", no_argument, 0, IDX_HEX_WORDLIST},
{"markov-disable", no_argument, 0, IDX_MARKOV_DISABLE},
{"markov-classic", no_argument, 0, IDX_MARKOV_CLASSIC},
{"markov-threshold", required_argument, 0, IDX_MARKOV_THRESHOLD},
{"markov-hcstat", required_argument, 0, IDX_MARKOV_HCSTAT},
{"cpu-affinity", required_argument, 0, IDX_CPU_AFFINITY},
{"opencl-info", no_argument, 0, IDX_OPENCL_INFO},
{"opencl-devices", required_argument, 0, IDX_OPENCL_DEVICES},
{"opencl-platforms", required_argument, 0, IDX_OPENCL_PLATFORMS},
{"opencl-device-types", required_argument, 0, IDX_OPENCL_DEVICE_TYPES},
{"opencl-vector-width", required_argument, 0, IDX_OPENCL_VECTOR_WIDTH},
{"workload-profile", required_argument, 0, IDX_WORKLOAD_PROFILE},
{"kernel-accel", required_argument, 0, IDX_KERNEL_ACCEL},
{"kernel-loops", required_argument, 0, IDX_KERNEL_LOOPS},
{"nvidia-spin-damp", required_argument, 0, IDX_NVIDIA_SPIN_DAMP},
{"gpu-temp-disable", no_argument, 0, IDX_GPU_TEMP_DISABLE},
#if defined (HAVE_HWMON)
{"gpu-temp-abort", required_argument, 0, IDX_GPU_TEMP_ABORT},
{"gpu-temp-retain", required_argument, 0, IDX_GPU_TEMP_RETAIN},
{"powertune-enable", no_argument, 0, IDX_POWERTUNE_ENABLE},
#endif // HAVE_HWMON
{"logfile-disable", no_argument, 0, IDX_LOGFILE_DISABLE},
{"truecrypt-keyfiles", required_argument, 0, IDX_TRUECRYPT_KEYFILES},
{"veracrypt-keyfiles", required_argument, 0, IDX_VERACRYPT_KEYFILES},
{"veracrypt-pim", required_argument, 0, IDX_VERACRYPT_PIM},
{"segment-size", required_argument, 0, IDX_SEGMENT_SIZE},
{"scrypt-tmto", required_argument, 0, IDX_SCRYPT_TMTO},
{"seperator", required_argument, 0, IDX_SEPARATOR},
{"separator", required_argument, 0, IDX_SEPARATOR},
{"bitmap-min", required_argument, 0, IDX_BITMAP_MIN},
{"bitmap-max", required_argument, 0, IDX_BITMAP_MAX},
{"increment", no_argument, 0, IDX_INCREMENT},
{"increment-min", required_argument, 0, IDX_INCREMENT_MIN},
{"increment-max", required_argument, 0, IDX_INCREMENT_MAX},
{"custom-charset1", required_argument, 0, IDX_CUSTOM_CHARSET_1},
{"custom-charset2", required_argument, 0, IDX_CUSTOM_CHARSET_2},
{"custom-charset3", required_argument, 0, IDX_CUSTOM_CHARSET_3},
{"custom-charset4", required_argument, 0, IDX_CUSTOM_CHARSET_4},
{0, 0, 0, 0}
};
void user_options_init (user_options_t *user_options);
void user_options_destroy (user_options_t *user_options);
#endif // _USER_OPTIONS_H

View File

@ -6,6 +6,4 @@
#ifndef _VERSION_H
#define _VERSION_H
#define VERSION 0
#endif // _VERSION_H

View File

@ -6,8 +6,6 @@
#ifndef _WEAK_HASH_H
#define _WEAK_HASH_H
#define WEAK_HASH_THRESHOLD 100
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

View File

@ -6,9 +6,6 @@
#ifndef _WORDLIST_H
#define _WORDLIST_H
#define HEX_WORDLIST 0
#define SEGMENT_SIZE 32
uint convert_from_hex (char *line_buf, const uint line_len);
void load_segment (wl_data_t *wl_data, FILE *fd);

View File

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

View File

@ -14,7 +14,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <search.h>
#include <getopt.h>
#include <inttypes.h>
#include <signal.h>
@ -85,6 +84,7 @@
#include "dispatch.h"
#include "monitor.h"
#include "session.h"
#include "user_options.h"
extern hc_global_data_t data;
@ -104,7 +104,6 @@ static const char PROGNAME[] = "hashcat";
const int comptime = COMPTIME;
#define FORCE 0
int main (int argc, char **argv)
{
@ -191,6 +190,12 @@ int main (int argc, char **argv)
* commandline parameters
*/
user_options_t *user_options = (user_options_t *) mymalloc (sizeof (user_options_t));
user_options_init (user_options);
//data.user_options = user_options;
uint usage = USAGE;
uint version = VERSION;
uint quiet = QUIET;
@ -273,176 +278,6 @@ int main (int argc, char **argv)
char *custom_charset_3 = NULL;
char *custom_charset_4 = NULL;
#define IDX_HELP 'h'
#define IDX_VERSION 'V'
#define IDX_VERSION_LOWER 'v'
#define IDX_QUIET 0xff02
#define IDX_SHOW 0xff03
#define IDX_LEFT 0xff04
#define IDX_REMOVE 0xff05
#define IDX_REMOVE_TIMER 0xff37
#define IDX_SKIP 's'
#define IDX_LIMIT 'l'
#define IDX_KEYSPACE 0xff35
#define IDX_POTFILE_DISABLE 0xff06
#define IDX_POTFILE_PATH 0xffe0
#define IDX_DEBUG_MODE 0xff43
#define IDX_DEBUG_FILE 0xff44
#define IDX_INDUCTION_DIR 0xff46
#define IDX_OUTFILE_CHECK_DIR 0xff47
#define IDX_USERNAME 0xff07
#define IDX_FORCE 0xff08
#define IDX_RUNTIME 0xff09
#define IDX_BENCHMARK 'b'
#define IDX_STDOUT_FLAG 0xff77
#define IDX_HASH_MODE 'm'
#define IDX_ATTACK_MODE 'a'
#define IDX_RP_FILE 'r'
#define IDX_RP_GEN 'g'
#define IDX_RP_GEN_FUNC_MIN 0xff10
#define IDX_RP_GEN_FUNC_MAX 0xff11
#define IDX_RP_GEN_SEED 0xff34
#define IDX_RULE_BUF_L 'j'
#define IDX_RULE_BUF_R 'k'
#define IDX_INCREMENT 'i'
#define IDX_INCREMENT_MIN 0xff12
#define IDX_INCREMENT_MAX 0xff13
#define IDX_OUTFILE 'o'
#define IDX_OUTFILE_FORMAT 0xff14
#define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
#define IDX_OUTFILE_CHECK_TIMER 0xff45
#define IDX_RESTORE 0xff15
#define IDX_RESTORE_DISABLE 0xff27
#define IDX_STATUS 0xff17
#define IDX_STATUS_TIMER 0xff18
#define IDX_MACHINE_READABLE 0xff50
#define IDX_LOOPBACK 0xff38
#define IDX_WEAK_HASH_THRESHOLD 0xff42
#define IDX_SESSION 0xff19
#define IDX_HEX_CHARSET 0xff20
#define IDX_HEX_SALT 0xff21
#define IDX_HEX_WORDLIST 0xff40
#define IDX_MARKOV_DISABLE 0xff22
#define IDX_MARKOV_CLASSIC 0xff23
#define IDX_MARKOV_THRESHOLD 't'
#define IDX_MARKOV_HCSTAT 0xff24
#define IDX_CPU_AFFINITY 0xff25
#define IDX_OPENCL_INFO 'I'
#define IDX_OPENCL_DEVICES 'd'
#define IDX_OPENCL_PLATFORMS 0xff72
#define IDX_OPENCL_DEVICE_TYPES 'D'
#define IDX_OPENCL_VECTOR_WIDTH 0xff74
#define IDX_WORKLOAD_PROFILE 'w'
#define IDX_KERNEL_ACCEL 'n'
#define IDX_KERNEL_LOOPS 'u'
#define IDX_NVIDIA_SPIN_DAMP 0xff79
#define IDX_GPU_TEMP_DISABLE 0xff29
#define IDX_GPU_TEMP_ABORT 0xff30
#define IDX_GPU_TEMP_RETAIN 0xff31
#define IDX_POWERTUNE_ENABLE 0xff41
#define IDX_LOGFILE_DISABLE 0xff51
#define IDX_TRUECRYPT_KEYFILES 0xff52
#define IDX_VERACRYPT_KEYFILES 0xff53
#define IDX_VERACRYPT_PIM 0xff54
#define IDX_SCRYPT_TMTO 0xff61
#define IDX_SEGMENT_SIZE 'c'
#define IDX_SEPARATOR 'p'
#define IDX_BITMAP_MIN 0xff70
#define IDX_BITMAP_MAX 0xff71
#define IDX_CUSTOM_CHARSET_1 '1'
#define IDX_CUSTOM_CHARSET_2 '2'
#define IDX_CUSTOM_CHARSET_3 '3'
#define IDX_CUSTOM_CHARSET_4 '4'
char short_options[] = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:iIbw:";
struct option long_options[] =
{
{"help", no_argument, 0, IDX_HELP},
{"version", no_argument, 0, IDX_VERSION},
{"quiet", no_argument, 0, IDX_QUIET},
{"show", no_argument, 0, IDX_SHOW},
{"left", no_argument, 0, IDX_LEFT},
{"username", no_argument, 0, IDX_USERNAME},
{"remove", no_argument, 0, IDX_REMOVE},
{"remove-timer", required_argument, 0, IDX_REMOVE_TIMER},
{"skip", required_argument, 0, IDX_SKIP},
{"limit", required_argument, 0, IDX_LIMIT},
{"keyspace", no_argument, 0, IDX_KEYSPACE},
{"potfile-disable", no_argument, 0, IDX_POTFILE_DISABLE},
{"potfile-path", required_argument, 0, IDX_POTFILE_PATH},
{"debug-mode", required_argument, 0, IDX_DEBUG_MODE},
{"debug-file", required_argument, 0, IDX_DEBUG_FILE},
{"induction-dir", required_argument, 0, IDX_INDUCTION_DIR},
{"outfile-check-dir", required_argument, 0, IDX_OUTFILE_CHECK_DIR},
{"force", no_argument, 0, IDX_FORCE},
{"benchmark", no_argument, 0, IDX_BENCHMARK},
{"stdout", no_argument, 0, IDX_STDOUT_FLAG},
{"restore", no_argument, 0, IDX_RESTORE},
{"restore-disable", no_argument, 0, IDX_RESTORE_DISABLE},
{"status", no_argument, 0, IDX_STATUS},
{"status-timer", required_argument, 0, IDX_STATUS_TIMER},
{"machine-readable", no_argument, 0, IDX_MACHINE_READABLE},
{"loopback", no_argument, 0, IDX_LOOPBACK},
{"weak-hash-threshold", required_argument, 0, IDX_WEAK_HASH_THRESHOLD},
{"session", required_argument, 0, IDX_SESSION},
{"runtime", required_argument, 0, IDX_RUNTIME},
{"generate-rules", required_argument, 0, IDX_RP_GEN},
{"generate-rules-func-min", required_argument, 0, IDX_RP_GEN_FUNC_MIN},
{"generate-rules-func-max", required_argument, 0, IDX_RP_GEN_FUNC_MAX},
{"generate-rules-seed", required_argument, 0, IDX_RP_GEN_SEED},
{"rule-left", required_argument, 0, IDX_RULE_BUF_L},
{"rule-right", required_argument, 0, IDX_RULE_BUF_R},
{"hash-type", required_argument, 0, IDX_HASH_MODE},
{"attack-mode", required_argument, 0, IDX_ATTACK_MODE},
{"rules-file", required_argument, 0, IDX_RP_FILE},
{"outfile", required_argument, 0, IDX_OUTFILE},
{"outfile-format", required_argument, 0, IDX_OUTFILE_FORMAT},
{"outfile-autohex-disable", no_argument, 0, IDX_OUTFILE_AUTOHEX_DISABLE},
{"outfile-check-timer", required_argument, 0, IDX_OUTFILE_CHECK_TIMER},
{"hex-charset", no_argument, 0, IDX_HEX_CHARSET},
{"hex-salt", no_argument, 0, IDX_HEX_SALT},
{"hex-wordlist", no_argument, 0, IDX_HEX_WORDLIST},
{"markov-disable", no_argument, 0, IDX_MARKOV_DISABLE},
{"markov-classic", no_argument, 0, IDX_MARKOV_CLASSIC},
{"markov-threshold", required_argument, 0, IDX_MARKOV_THRESHOLD},
{"markov-hcstat", required_argument, 0, IDX_MARKOV_HCSTAT},
{"cpu-affinity", required_argument, 0, IDX_CPU_AFFINITY},
{"opencl-info", no_argument, 0, IDX_OPENCL_INFO},
{"opencl-devices", required_argument, 0, IDX_OPENCL_DEVICES},
{"opencl-platforms", required_argument, 0, IDX_OPENCL_PLATFORMS},
{"opencl-device-types", required_argument, 0, IDX_OPENCL_DEVICE_TYPES},
{"opencl-vector-width", required_argument, 0, IDX_OPENCL_VECTOR_WIDTH},
{"workload-profile", required_argument, 0, IDX_WORKLOAD_PROFILE},
{"kernel-accel", required_argument, 0, IDX_KERNEL_ACCEL},
{"kernel-loops", required_argument, 0, IDX_KERNEL_LOOPS},
{"nvidia-spin-damp", required_argument, 0, IDX_NVIDIA_SPIN_DAMP},
{"gpu-temp-disable", no_argument, 0, IDX_GPU_TEMP_DISABLE},
#if defined (HAVE_HWMON)
{"gpu-temp-abort", required_argument, 0, IDX_GPU_TEMP_ABORT},
{"gpu-temp-retain", required_argument, 0, IDX_GPU_TEMP_RETAIN},
{"powertune-enable", no_argument, 0, IDX_POWERTUNE_ENABLE},
#endif // HAVE_HWMON
{"logfile-disable", no_argument, 0, IDX_LOGFILE_DISABLE},
{"truecrypt-keyfiles", required_argument, 0, IDX_TRUECRYPT_KEYFILES},
{"veracrypt-keyfiles", required_argument, 0, IDX_VERACRYPT_KEYFILES},
{"veracrypt-pim", required_argument, 0, IDX_VERACRYPT_PIM},
{"segment-size", required_argument, 0, IDX_SEGMENT_SIZE},
{"scrypt-tmto", required_argument, 0, IDX_SCRYPT_TMTO},
{"seperator", required_argument, 0, IDX_SEPARATOR},
{"separator", required_argument, 0, IDX_SEPARATOR},
{"bitmap-min", required_argument, 0, IDX_BITMAP_MIN},
{"bitmap-max", required_argument, 0, IDX_BITMAP_MAX},
{"increment", no_argument, 0, IDX_INCREMENT},
{"increment-min", required_argument, 0, IDX_INCREMENT_MIN},
{"increment-max", required_argument, 0, IDX_INCREMENT_MAX},
{"custom-charset1", required_argument, 0, IDX_CUSTOM_CHARSET_1},
{"custom-charset2", required_argument, 0, IDX_CUSTOM_CHARSET_2},
{"custom-charset3", required_argument, 0, IDX_CUSTOM_CHARSET_3},
{"custom-charset4", required_argument, 0, IDX_CUSTOM_CHARSET_4},
{0, 0, 0, 0}
};
uint rp_files_cnt = 0;
char **rp_files = (char **) mycalloc (argc, sizeof (char *));

98
src/user_options.c Normal file
View File

@ -0,0 +1,98 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#include "common.h"
#include "types.h"
#include "memory.h"
#include "interface.h"
#include "user_options.h"
void user_options_init (user_options_t *user_options)
{
user_options->attack_mode = ATTACK_MODE;
user_options->benchmark = BENCHMARK;
user_options->bitmap_max = BITMAP_MAX;
user_options->bitmap_min = BITMAP_MIN;
user_options->cpu_affinity = NULL;
user_options->custom_charset_1 = NULL;
user_options->custom_charset_2 = NULL;
user_options->custom_charset_3 = NULL;
user_options->custom_charset_4 = NULL;
user_options->debug_file = NULL;
user_options->debug_mode = DEBUG_MODE;
user_options->force = FORCE;
user_options->gpu_temp_abort = GPU_TEMP_ABORT;
user_options->gpu_temp_disable = GPU_TEMP_DISABLE;
user_options->gpu_temp_retain = GPU_TEMP_RETAIN;
user_options->hash_mode = HASH_MODE;
user_options->hex_charset = HEX_CHARSET;
user_options->hex_salt = HEX_SALT;
user_options->hex_wordlist = HEX_WORDLIST;
user_options->increment = INCREMENT;
user_options->increment_max = INCREMENT_MAX;
user_options->increment_min = INCREMENT_MIN;
user_options->induction_dir = NULL;
user_options->kernel_accel = KERNEL_ACCEL;
user_options->kernel_loops = KERNEL_LOOPS;
user_options->keyspace = KEYSPACE;
user_options->left = LEFT;
user_options->limit = LIMIT;
user_options->logfile_disable = LOGFILE_DISABLE;
user_options->loopback = LOOPBACK;
user_options->machine_readable = MACHINE_READABLE;
user_options->markov_classic = MARKOV_CLASSIC;
user_options->markov_disable = MARKOV_DISABLE;
user_options->markov_hcstat = NULL;
user_options->markov_threshold = MARKOV_THRESHOLD;
user_options->nvidia_spin_damp = NVIDIA_SPIN_DAMP;
user_options->opencl_devices = NULL;
user_options->opencl_device_types = NULL;
user_options->opencl_info = 0;
user_options->opencl_platforms = NULL;
user_options->opencl_vector_width = OPENCL_VECTOR_WIDTH;
user_options->outfile_autohex = OUTFILE_AUTOHEX;
user_options->outfile_check_dir = NULL;
user_options->outfile_check_timer = OUTFILE_CHECK_TIMER;
user_options->outfile_format = OUTFILE_FORMAT;
user_options->outfile = NULL;
user_options->potfile_disable = POTFILE_DISABLE;
user_options->potfile_path = NULL;
user_options->powertune_enable = POWERTUNE_ENABLE;
user_options->quiet = QUIET;
user_options->remove = REMOVE;
user_options->remove_timer = REMOVE_TIMER;
user_options->restore_disable = RESTORE_DISABLE;
user_options->restore = RESTORE;
user_options->restore_timer = RESTORE_TIMER;
user_options->rp_gen_func_max = RP_GEN_FUNC_MAX;
user_options->rp_gen_func_min = RP_GEN_FUNC_MIN;
user_options->rp_gen = RP_GEN;
user_options->rp_gen_seed = RP_GEN_SEED;
user_options->rule_buf_l = RULE_BUF_L;
user_options->rule_buf_r = RULE_BUF_R;
user_options->runtime = RUNTIME;
user_options->scrypt_tmto = SCRYPT_TMTO;
user_options->segment_size = SEGMENT_SIZE;
user_options->separator = SEPARATOR;
user_options->session = NULL;
user_options->show = SHOW;
user_options->skip = SKIP;
user_options->status = STATUS;
user_options->status_timer = STATUS_TIMER;
user_options->stdout_flag = STDOUT_FLAG;
user_options->truecrypt_keyfiles = NULL;
user_options->usage = USAGE;
user_options->username = USERNAME;
user_options->veracrypt_keyfiles = NULL;
user_options->veracrypt_pim = 0;
user_options->version = VERSION;
user_options->weak_hash_threshold = WEAK_HASH_THRESHOLD;
user_options->workload_profile = WORKLOAD_PROFILE;
}
void user_options_destroy (user_options_t *user_options)
{
myfree (user_options);
}