2016-09-20 14:04:22 +00:00
|
|
|
/**
|
|
|
|
* Author......: See docs/credits.txt
|
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "types.h"
|
|
|
|
#include "memory.h"
|
2016-10-09 20:41:55 +00:00
|
|
|
#include "event.h"
|
2016-09-23 19:41:05 +00:00
|
|
|
#include "logfile.h"
|
2016-09-20 14:04:22 +00:00
|
|
|
#include "interface.h"
|
2016-09-20 15:04:31 +00:00
|
|
|
#include "shared.h"
|
|
|
|
#include "usage.h"
|
2016-09-21 09:09:12 +00:00
|
|
|
#include "outfile.h"
|
2016-09-20 14:04:22 +00:00
|
|
|
#include "user_options.h"
|
|
|
|
|
2016-09-30 07:34:06 +00:00
|
|
|
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[] =
|
|
|
|
{
|
2016-10-14 19:38:52 +00:00
|
|
|
{"attack-mode", required_argument, 0, IDX_ATTACK_MODE},
|
|
|
|
{"benchmark", no_argument, 0, IDX_BENCHMARK},
|
|
|
|
{"bitmap-max", required_argument, 0, IDX_BITMAP_MAX},
|
|
|
|
{"bitmap-min", required_argument, 0, IDX_BITMAP_MIN},
|
|
|
|
{"cpu-affinity", required_argument, 0, IDX_CPU_AFFINITY},
|
|
|
|
{"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},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"debug-file", required_argument, 0, IDX_DEBUG_FILE},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"debug-mode", required_argument, 0, IDX_DEBUG_MODE},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"force", no_argument, 0, IDX_FORCE},
|
|
|
|
{"generate-rules-func-max", required_argument, 0, IDX_RP_GEN_FUNC_MAX},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"generate-rules-func-min", required_argument, 0, IDX_RP_GEN_FUNC_MIN},
|
|
|
|
{"generate-rules", required_argument, 0, IDX_RP_GEN},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"generate-rules-seed", required_argument, 0, IDX_RP_GEN_SEED},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"gpu-temp-abort", required_argument, 0, IDX_GPU_TEMP_ABORT},
|
|
|
|
{"gpu-temp-disable", no_argument, 0, IDX_GPU_TEMP_DISABLE},
|
|
|
|
{"gpu-temp-retain", required_argument, 0, IDX_GPU_TEMP_RETAIN},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"hash-type", required_argument, 0, IDX_HASH_MODE},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"help", no_argument, 0, IDX_HELP},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"hex-charset", no_argument, 0, IDX_HEX_CHARSET},
|
|
|
|
{"hex-salt", no_argument, 0, IDX_HEX_SALT},
|
|
|
|
{"hex-wordlist", no_argument, 0, IDX_HEX_WORDLIST},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"increment-max", required_argument, 0, IDX_INCREMENT_MAX},
|
|
|
|
{"increment-min", required_argument, 0, IDX_INCREMENT_MIN},
|
|
|
|
{"increment", no_argument, 0, IDX_INCREMENT},
|
|
|
|
{"induction-dir", required_argument, 0, IDX_INDUCTION_DIR},
|
2016-10-31 09:09:04 +00:00
|
|
|
{"keep-guessing", no_argument, 0, IDX_KEEP_GUESSING},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"kernel-accel", required_argument, 0, IDX_KERNEL_ACCEL},
|
|
|
|
{"kernel-loops", required_argument, 0, IDX_KERNEL_LOOPS},
|
|
|
|
{"keyspace", no_argument, 0, IDX_KEYSPACE},
|
|
|
|
{"left", no_argument, 0, IDX_LEFT},
|
|
|
|
{"limit", required_argument, 0, IDX_LIMIT},
|
|
|
|
{"logfile-disable", no_argument, 0, IDX_LOGFILE_DISABLE},
|
|
|
|
{"loopback", no_argument, 0, IDX_LOOPBACK},
|
|
|
|
{"machine-readable", no_argument, 0, IDX_MACHINE_READABLE},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"markov-classic", no_argument, 0, IDX_MARKOV_CLASSIC},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"markov-disable", no_argument, 0, IDX_MARKOV_DISABLE},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"markov-hcstat", required_argument, 0, IDX_MARKOV_HCSTAT},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"markov-threshold", required_argument, 0, IDX_MARKOV_THRESHOLD},
|
|
|
|
{"nvidia-spin-damp", required_argument, 0, IDX_NVIDIA_SPIN_DAMP},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"opencl-devices", required_argument, 0, IDX_OPENCL_DEVICES},
|
|
|
|
{"opencl-device-types", required_argument, 0, IDX_OPENCL_DEVICE_TYPES},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"opencl-info", no_argument, 0, IDX_OPENCL_INFO},
|
|
|
|
{"opencl-platforms", required_argument, 0, IDX_OPENCL_PLATFORMS},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"opencl-vector-width", required_argument, 0, IDX_OPENCL_VECTOR_WIDTH},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"outfile-autohex-disable", no_argument, 0, IDX_OUTFILE_AUTOHEX_DISABLE},
|
|
|
|
{"outfile-check-dir", required_argument, 0, IDX_OUTFILE_CHECK_DIR},
|
|
|
|
{"outfile-check-timer", required_argument, 0, IDX_OUTFILE_CHECK_TIMER},
|
|
|
|
{"outfile-format", required_argument, 0, IDX_OUTFILE_FORMAT},
|
|
|
|
{"outfile", required_argument, 0, IDX_OUTFILE},
|
|
|
|
{"potfile-disable", no_argument, 0, IDX_POTFILE_DISABLE},
|
|
|
|
{"potfile-path", required_argument, 0, IDX_POTFILE_PATH},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"powertune-enable", no_argument, 0, IDX_POWERTUNE_ENABLE},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"quiet", no_argument, 0, IDX_QUIET},
|
|
|
|
{"remove", no_argument, 0, IDX_REMOVE},
|
|
|
|
{"remove-timer", required_argument, 0, IDX_REMOVE_TIMER},
|
|
|
|
{"restore-disable", no_argument, 0, IDX_RESTORE_DISABLE},
|
2016-10-27 21:09:50 +00:00
|
|
|
{"restore-file-path", required_argument, 0, IDX_RESTORE_FILE_PATH},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"restore", no_argument, 0, IDX_RESTORE},
|
|
|
|
{"rule-left", required_argument, 0, IDX_RULE_BUF_L},
|
|
|
|
{"rule-right", required_argument, 0, IDX_RULE_BUF_R},
|
|
|
|
{"rules-file", required_argument, 0, IDX_RP_FILE},
|
|
|
|
{"runtime", required_argument, 0, IDX_RUNTIME},
|
|
|
|
{"scrypt-tmto", required_argument, 0, IDX_SCRYPT_TMTO},
|
|
|
|
{"segment-size", required_argument, 0, IDX_SEGMENT_SIZE},
|
|
|
|
{"separator", required_argument, 0, IDX_SEPARATOR},
|
|
|
|
{"seperator", required_argument, 0, IDX_SEPARATOR},
|
|
|
|
{"session", required_argument, 0, IDX_SESSION},
|
|
|
|
{"show", no_argument, 0, IDX_SHOW},
|
|
|
|
{"skip", required_argument, 0, IDX_SKIP},
|
|
|
|
{"status", no_argument, 0, IDX_STATUS},
|
|
|
|
{"status-timer", required_argument, 0, IDX_STATUS_TIMER},
|
|
|
|
{"stdout", no_argument, 0, IDX_STDOUT_FLAG},
|
|
|
|
{"speed-only", no_argument, 0, IDX_SPEED_ONLY},
|
2016-12-09 22:44:43 +00:00
|
|
|
{"progress-only", no_argument, 0, IDX_PROGRESS_ONLY},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"truecrypt-keyfiles", required_argument, 0, IDX_TRUECRYPT_KEYFILES},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"username", no_argument, 0, IDX_USERNAME},
|
2016-09-30 07:34:06 +00:00
|
|
|
{"veracrypt-keyfiles", required_argument, 0, IDX_VERACRYPT_KEYFILES},
|
|
|
|
{"veracrypt-pim", required_argument, 0, IDX_VERACRYPT_PIM},
|
2016-10-14 19:38:52 +00:00
|
|
|
{"version", no_argument, 0, IDX_VERSION},
|
|
|
|
{"weak-hash-threshold", required_argument, 0, IDX_WEAK_HASH_THRESHOLD},
|
|
|
|
{"workload-profile", required_argument, 0, IDX_WORKLOAD_PROFILE},
|
2016-09-30 07:34:06 +00:00
|
|
|
{0, 0, 0, 0}
|
|
|
|
};
|
|
|
|
|
2016-09-21 14:38:55 +00:00
|
|
|
static char RULE_BUF_R[] = ":";
|
|
|
|
static char RULE_BUF_L[] = ":";
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
static char DEF_MASK_CS_1[] = "?l?d?u";
|
|
|
|
static char DEF_MASK_CS_2[] = "?l?d";
|
|
|
|
static char DEF_MASK_CS_3[] = "?l?d*!$@_";
|
|
|
|
|
2016-10-13 08:07:04 +00:00
|
|
|
int user_options_init (hashcat_ctx_t *hashcat_ctx)
|
2016-09-20 14:04:22 +00:00
|
|
|
{
|
2016-10-06 14:40:29 +00:00
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-09-20 14:04:22 +00:00
|
|
|
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;
|
2016-10-31 09:09:04 +00:00
|
|
|
user_options->keep_guessing = KEEP_GUESSING;
|
2016-09-20 14:04:22 +00:00
|
|
|
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;
|
2016-10-27 21:09:50 +00:00
|
|
|
user_options->restore_file_path = NULL;
|
2016-09-20 14:04:22 +00:00
|
|
|
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;
|
2016-09-21 18:32:56 +00:00
|
|
|
user_options->session = PROGNAME;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->show = SHOW;
|
|
|
|
user_options->skip = SKIP;
|
|
|
|
user_options->status = STATUS;
|
|
|
|
user_options->status_timer = STATUS_TIMER;
|
|
|
|
user_options->stdout_flag = STDOUT_FLAG;
|
2016-10-14 19:38:52 +00:00
|
|
|
user_options->speed_only = SPEED_ONLY;
|
2016-12-09 22:44:43 +00:00
|
|
|
user_options->progress_only = PROGRESS_ONLY;
|
2016-09-20 14:04:22 +00:00
|
|
|
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;
|
2016-09-20 15:04:31 +00:00
|
|
|
user_options->rp_files_cnt = 0;
|
2016-11-20 21:54:52 +00:00
|
|
|
user_options->rp_files = (char **) hccalloc (256, sizeof (char *));
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->hc_bin = PROGNAME;
|
|
|
|
user_options->hc_argc = 0;
|
|
|
|
user_options->hc_argv = NULL;
|
2016-10-13 08:07:04 +00:00
|
|
|
|
|
|
|
return 0;
|
2016-09-20 14:04:22 +00:00
|
|
|
}
|
|
|
|
|
2016-10-06 14:40:29 +00:00
|
|
|
void user_options_destroy (hashcat_ctx_t *hashcat_ctx)
|
2016-09-20 14:04:22 +00:00
|
|
|
{
|
2016-10-06 14:40:29 +00:00
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-10 09:03:11 +00:00
|
|
|
hcfree (user_options->rp_files);
|
2016-09-20 15:04:31 +00:00
|
|
|
|
2016-10-03 14:35:09 +00:00
|
|
|
//do not reset this, it might be used from main.c
|
|
|
|
//memset (user_options, 0, sizeof (user_options_t));
|
2016-09-20 14:04:22 +00:00
|
|
|
}
|
2016-09-20 15:04:31 +00:00
|
|
|
|
2016-10-06 14:40:29 +00:00
|
|
|
int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-06 14:40:29 +00:00
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-09-20 15:04:31 +00:00
|
|
|
int c = -1;
|
|
|
|
|
|
|
|
optind = 1;
|
|
|
|
optopt = 0;
|
|
|
|
|
|
|
|
int option_index = 0;
|
|
|
|
|
2016-09-24 23:02:44 +00:00
|
|
|
while (((c = getopt_long (argc, argv, short_options, long_options, &option_index)) != -1) && optopt == 0)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case IDX_HELP: user_options->usage = true; break;
|
|
|
|
case IDX_VERSION: user_options->version = true; break;
|
|
|
|
case IDX_RESTORE: user_options->restore = true; break;
|
|
|
|
case IDX_QUIET: user_options->quiet = true; break;
|
|
|
|
case IDX_SHOW: user_options->show = true; break;
|
|
|
|
case IDX_LEFT: user_options->left = true; break;
|
|
|
|
case IDX_USERNAME: user_options->username = true; break;
|
|
|
|
case IDX_REMOVE: user_options->remove = true; break;
|
|
|
|
case IDX_REMOVE_TIMER: user_options->remove_timer = atoi (optarg);
|
|
|
|
user_options->remove_timer_chgd = true; break;
|
|
|
|
case IDX_POTFILE_DISABLE: user_options->potfile_disable = true; break;
|
|
|
|
case IDX_POTFILE_PATH: user_options->potfile_path = optarg; break;
|
|
|
|
case IDX_DEBUG_MODE: user_options->debug_mode = atoi (optarg); break;
|
|
|
|
case IDX_DEBUG_FILE: user_options->debug_file = optarg; break;
|
|
|
|
case IDX_INDUCTION_DIR: user_options->induction_dir = optarg; break;
|
|
|
|
case IDX_OUTFILE_CHECK_DIR: user_options->outfile_check_dir = optarg; break;
|
|
|
|
case IDX_FORCE: user_options->force = true; break;
|
|
|
|
case IDX_SKIP: user_options->skip = atoll (optarg); break;
|
|
|
|
case IDX_LIMIT: user_options->limit = atoll (optarg); break;
|
2016-10-31 09:09:04 +00:00
|
|
|
case IDX_KEEP_GUESSING: user_options->keep_guessing = true; break;
|
2016-09-20 15:04:31 +00:00
|
|
|
case IDX_KEYSPACE: user_options->keyspace = true; break;
|
|
|
|
case IDX_BENCHMARK: user_options->benchmark = true; break;
|
|
|
|
case IDX_STDOUT_FLAG: user_options->stdout_flag = true; break;
|
2016-10-14 19:38:52 +00:00
|
|
|
case IDX_SPEED_ONLY: user_options->speed_only = true; break;
|
2016-12-09 22:44:43 +00:00
|
|
|
case IDX_PROGRESS_ONLY: user_options->progress_only = true; break;
|
2016-09-20 15:04:31 +00:00
|
|
|
case IDX_RESTORE_DISABLE: user_options->restore_disable = true; break;
|
2016-10-27 21:09:50 +00:00
|
|
|
case IDX_RESTORE_FILE_PATH: user_options->restore_file_path = optarg; break;
|
2016-09-20 15:04:31 +00:00
|
|
|
case IDX_STATUS: user_options->status = true; break;
|
|
|
|
case IDX_STATUS_TIMER: user_options->status_timer = atoi (optarg); break;
|
|
|
|
case IDX_MACHINE_READABLE: user_options->machine_readable = true; break;
|
|
|
|
case IDX_LOOPBACK: user_options->loopback = true; break;
|
|
|
|
case IDX_WEAK_HASH_THRESHOLD: user_options->weak_hash_threshold = atoi (optarg); break;
|
|
|
|
case IDX_SESSION: user_options->session = optarg; break;
|
|
|
|
case IDX_HASH_MODE: user_options->hash_mode = atoi (optarg);
|
|
|
|
user_options->hash_mode_chgd = true; break;
|
|
|
|
case IDX_RUNTIME: user_options->runtime = atoi (optarg);
|
|
|
|
user_options->runtime_chgd = true; break;
|
|
|
|
case IDX_ATTACK_MODE: user_options->attack_mode = atoi (optarg);
|
|
|
|
user_options->attack_mode_chgd = true; break;
|
|
|
|
case IDX_RP_FILE: user_options->rp_files[user_options->rp_files_cnt++]
|
|
|
|
= optarg; break;
|
|
|
|
case IDX_RP_GEN: user_options->rp_gen = atoi (optarg); break;
|
|
|
|
case IDX_RP_GEN_FUNC_MIN: user_options->rp_gen_func_min = atoi (optarg); break;
|
|
|
|
case IDX_RP_GEN_FUNC_MAX: user_options->rp_gen_func_max = atoi (optarg); break;
|
|
|
|
case IDX_RP_GEN_SEED: user_options->rp_gen_seed = atoi (optarg);
|
|
|
|
user_options->rp_gen_seed_chgd = true; break;
|
|
|
|
case IDX_RULE_BUF_L: user_options->rule_buf_l = optarg; break;
|
|
|
|
case IDX_RULE_BUF_R: user_options->rule_buf_r = optarg; break;
|
|
|
|
case IDX_MARKOV_DISABLE: user_options->markov_disable = true; break;
|
|
|
|
case IDX_MARKOV_CLASSIC: user_options->markov_classic = true; break;
|
|
|
|
case IDX_MARKOV_THRESHOLD: user_options->markov_threshold = atoi (optarg); break;
|
|
|
|
case IDX_MARKOV_HCSTAT: user_options->markov_hcstat = optarg; break;
|
|
|
|
case IDX_OUTFILE: user_options->outfile = optarg; break;
|
|
|
|
case IDX_OUTFILE_FORMAT: user_options->outfile_format = atoi (optarg);
|
|
|
|
user_options->outfile_format_chgd = true; break;
|
2016-11-04 21:12:25 +00:00
|
|
|
case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = false; break;
|
2016-09-20 15:04:31 +00:00
|
|
|
case IDX_OUTFILE_CHECK_TIMER: user_options->outfile_check_timer = atoi (optarg); break;
|
|
|
|
case IDX_HEX_CHARSET: user_options->hex_charset = true; break;
|
|
|
|
case IDX_HEX_SALT: user_options->hex_salt = true; break;
|
|
|
|
case IDX_HEX_WORDLIST: user_options->hex_wordlist = true; break;
|
|
|
|
case IDX_CPU_AFFINITY: user_options->cpu_affinity = optarg; break;
|
|
|
|
case IDX_OPENCL_INFO: user_options->opencl_info = true; break;
|
|
|
|
case IDX_OPENCL_DEVICES: user_options->opencl_devices = optarg; break;
|
|
|
|
case IDX_OPENCL_PLATFORMS: user_options->opencl_platforms = optarg; break;
|
|
|
|
case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break;
|
|
|
|
case IDX_OPENCL_VECTOR_WIDTH: user_options->opencl_vector_width = atoi (optarg);
|
|
|
|
user_options->opencl_vector_width_chgd = true; break;
|
|
|
|
case IDX_WORKLOAD_PROFILE: user_options->workload_profile = atoi (optarg);
|
|
|
|
user_options->workload_profile_chgd = true; break;
|
|
|
|
case IDX_KERNEL_ACCEL: user_options->kernel_accel = atoi (optarg);
|
|
|
|
user_options->kernel_accel_chgd = true; break;
|
|
|
|
case IDX_KERNEL_LOOPS: user_options->kernel_loops = atoi (optarg);
|
|
|
|
user_options->kernel_loops_chgd = true; break;
|
|
|
|
case IDX_NVIDIA_SPIN_DAMP: user_options->nvidia_spin_damp = atoi (optarg);
|
|
|
|
user_options->nvidia_spin_damp_chgd = true; break;
|
|
|
|
case IDX_GPU_TEMP_DISABLE: user_options->gpu_temp_disable = true; break;
|
|
|
|
case IDX_GPU_TEMP_ABORT: user_options->gpu_temp_abort = atoi (optarg); break;
|
|
|
|
case IDX_GPU_TEMP_RETAIN: user_options->gpu_temp_retain = atoi (optarg); break;
|
|
|
|
case IDX_POWERTUNE_ENABLE: user_options->powertune_enable = true; break;
|
|
|
|
case IDX_LOGFILE_DISABLE: user_options->logfile_disable = true; break;
|
|
|
|
case IDX_TRUECRYPT_KEYFILES: user_options->truecrypt_keyfiles = optarg; break;
|
|
|
|
case IDX_VERACRYPT_KEYFILES: user_options->veracrypt_keyfiles = optarg; break;
|
|
|
|
case IDX_VERACRYPT_PIM: user_options->veracrypt_pim = atoi (optarg); break;
|
2016-09-21 20:07:10 +00:00
|
|
|
case IDX_SEGMENT_SIZE: user_options->segment_size = atoi (optarg);
|
|
|
|
user_options->segment_size_chgd = true; break;
|
2016-09-20 15:04:31 +00:00
|
|
|
case IDX_SCRYPT_TMTO: user_options->scrypt_tmto = atoi (optarg); break;
|
|
|
|
case IDX_SEPARATOR: user_options->separator = optarg[0]; break;
|
|
|
|
case IDX_BITMAP_MIN: user_options->bitmap_min = atoi (optarg); break;
|
|
|
|
case IDX_BITMAP_MAX: user_options->bitmap_max = atoi (optarg); break;
|
|
|
|
case IDX_INCREMENT: user_options->increment = true; break;
|
|
|
|
case IDX_INCREMENT_MIN: user_options->increment_min = atoi (optarg);
|
|
|
|
user_options->increment_min_chgd = true; break;
|
|
|
|
case IDX_INCREMENT_MAX: user_options->increment_max = atoi (optarg);
|
|
|
|
user_options->increment_max_chgd = true; break;
|
|
|
|
case IDX_CUSTOM_CHARSET_1: user_options->custom_charset_1 = optarg; break;
|
|
|
|
case IDX_CUSTOM_CHARSET_2: user_options->custom_charset_2 = optarg; break;
|
|
|
|
case IDX_CUSTOM_CHARSET_3: user_options->custom_charset_3 = optarg; break;
|
|
|
|
case IDX_CUSTOM_CHARSET_4: user_options->custom_charset_4 = optarg; break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid argument specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (optopt != 0)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid argument specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->hc_bin = argv[0];
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->hc_argc = argc - optind;
|
|
|
|
user_options->hc_argv = argv + optind;
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2016-09-21 14:07:49 +00:00
|
|
|
|
2016-10-06 14:40:29 +00:00
|
|
|
int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
2016-10-02 21:30:31 +00:00
|
|
|
{
|
2016-10-06 14:40:29 +00:00
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->hc_argc < 0)
|
2016-09-21 14:07:49 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "hc_argc %d is invalid", user_options->hc_argc);
|
2016-09-21 14:07:49 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
return -1;
|
2016-09-21 14:07:49 +00:00
|
|
|
}
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->hc_argv == NULL)
|
2016-09-21 19:07:57 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "hc_argv is NULL");
|
2016-09-21 19:07:57 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
return -1;
|
2016-09-21 20:07:10 +00:00
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_COMBI)
|
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_BF)
|
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_HYBRID1)
|
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_HYBRID2)
|
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_NONE))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid attack-mode specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->runtime_chgd == true && user_options->runtime == 0)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid runtime specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-05 21:46:34 +00:00
|
|
|
if (user_options->runtime_chgd == true && user_options->loopback == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Runtime-Limit is not allowed in combination with --loopback");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-11-03 18:02:55 +00:00
|
|
|
if (user_options->hash_mode > 99999)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid hash-type specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->username == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-26 22:32:38 +00:00
|
|
|
if ((user_options->hash_mode == 2500)
|
|
|
|
|| (user_options->hash_mode == 5200)
|
|
|
|
|| ((user_options->hash_mode >= 6200) && (user_options->hash_mode <= 6299))
|
|
|
|
|| ((user_options->hash_mode >= 13700) && (user_options->hash_mode <= 13799))
|
|
|
|
|| (user_options->hash_mode == 9000))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Mixing support for user names and hashes of type %s is not supported", strhashtype (user_options->hash_mode));
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->outfile_format > 16)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid outfile-format specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->left == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
|
|
|
if (user_options->outfile_format_chgd == true)
|
|
|
|
{
|
2016-10-25 09:36:17 +00:00
|
|
|
if (user_options->outfile_format > 1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Mixing outfile-format > 1 with left parameter is not allowed");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
2016-10-25 09:36:17 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->show == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
|
|
|
if (user_options->outfile_format_chgd == true)
|
|
|
|
{
|
2016-10-25 09:36:17 +00:00
|
|
|
if (user_options->outfile_format > 7)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Mixing outfile-format > 7 with show parameter is not allowed");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
2016-10-25 09:36:17 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->increment_min < INCREMENT_MIN)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid increment-min specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->increment_max > INCREMENT_MAX)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid increment-max specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->increment_min > user_options->increment_max)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid increment-min specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-12-09 22:44:43 +00:00
|
|
|
if ((user_options->increment == true) && (user_options->progress_only == true))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Increment is not allowed in combination with --progress-only");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-12-09 14:26:35 +00:00
|
|
|
if ((user_options->increment == true) && (user_options->speed_only == true))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Increment is not allowed in combination with --speed-only");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if ((user_options->increment == true) && (user_options->attack_mode == ATTACK_MODE_STRAIGHT))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Increment is not allowed in attack-mode 0");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-26 15:15:07 +00:00
|
|
|
if ((user_options->increment == false) && (user_options->increment_min_chgd == true))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Increment-min is only supported combined with increment switch");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-26 15:15:07 +00:00
|
|
|
if ((user_options->increment == false) && (user_options->increment_max_chgd == true))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Increment-max is only supported combined with increment switch");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->rp_files_cnt > 0 && user_options->rp_gen == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Use of both rules-file and rules-generate is not supported");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->rp_files_cnt > 0 || user_options->rp_gen == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
|
|
|
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Use of rules-file or rules-generate only allowed in attack-mode 0");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-22 14:23:36 +00:00
|
|
|
if (user_options->bitmap_min > user_options->bitmap_max)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid bitmap-min specified");
|
2016-09-22 14:23:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-20 15:04:31 +00:00
|
|
|
if (user_options->rp_gen_func_min > user_options->rp_gen_func_max)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid rp-gen-func-min specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_accel_chgd == true)
|
|
|
|
{
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->force == false)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-23 15:31:22 +00:00
|
|
|
event_log_error (hashcat_ctx, "The manual use of the -n option (or --kernel-accel) is outdated.");
|
|
|
|
event_log_error (hashcat_ctx, "Please consider using the -w option instead.");
|
|
|
|
event_log_error (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_accel < 1)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid kernel-accel specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_accel > 1024)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid kernel-accel specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_loops_chgd == true)
|
|
|
|
{
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->force == false)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-23 15:31:22 +00:00
|
|
|
event_log_error (hashcat_ctx, "The manual use of the -u option (or --kernel-loops) is outdated.");
|
|
|
|
event_log_error (hashcat_ctx, "Please consider using the -w option instead.");
|
|
|
|
event_log_error (hashcat_ctx, "You can use --force to override this but do not post error reports if you do so.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_loops < 1)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid kernel-loops specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_loops > 1024)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid kernel-loops specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((user_options->workload_profile < 1) || (user_options->workload_profile > 4))
|
|
|
|
{
|
2016-11-30 23:02:26 +00:00
|
|
|
event_log_error (hashcat_ctx, "workload-profile %u not available", user_options->workload_profile);
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->opencl_vector_width_chgd == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-09-21 14:07:49 +00:00
|
|
|
if (is_power_of_2 (user_options->opencl_vector_width) == false || user_options->opencl_vector_width > 16)
|
|
|
|
{
|
2016-11-30 23:02:26 +00:00
|
|
|
event_log_error (hashcat_ctx, "opencl-vector-width %u not allowed", user_options->opencl_vector_width);
|
2016-09-20 15:04:31 +00:00
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->show == true || user_options->left == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->remove == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Mixing remove parameter not allowed with show parameter or left parameter");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->potfile_disable == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Mixing potfile-disable parameter not allowed with show parameter or left parameter");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->show == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->outfile_autohex == false)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Mixing outfile-autohex-disable parameter not allowed with show parameter");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->keyspace == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->show == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Combining show parameter with keyspace parameter is not allowed");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2016-09-21 14:07:49 +00:00
|
|
|
else if (user_options->left == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Combining left parameter with keyspace parameter is not allowed");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->remove_timer_chgd == true)
|
|
|
|
{
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->remove == false)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter remove-timer require parameter remove enabled");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->remove_timer < 1)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter remove-timer must have a value greater than or equal to 1");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->loopback == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
|
|
|
if ((user_options->rp_files_cnt == 0) && (user_options->rp_gen == 0))
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter loopback not allowed without rules-file or rules-generate");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter loopback allowed in attack-mode 0 only");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (user_options->debug_mode > 0)
|
|
|
|
{
|
|
|
|
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter debug-mode option is only available with attack-mode 0");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((user_options->rp_files_cnt == 0) && (user_options->rp_gen == 0))
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter debug-mode not allowed without rules-file or rules-generate");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->debug_mode > 4)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid debug-mode specified");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->debug_file != NULL)
|
|
|
|
{
|
|
|
|
if (user_options->debug_mode < 1)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter debug-file requires parameter debug-mode to be set");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->induction_dir != NULL)
|
|
|
|
{
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter induction-dir not allowed with brute-force attacks");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
|
|
|
if ((user_options->weak_hash_threshold != WEAK_HASH_THRESHOLD) && (user_options->weak_hash_threshold != 0))
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "setting --weak-hash-threshold allowed only in straight-attack mode");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->nvidia_spin_damp > 100)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "setting --nvidia-spin-damp must be between 0 and 100 (inclusive)");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-21 18:50:14 +00:00
|
|
|
if ((user_options->gpu_temp_abort != 0) && (user_options->gpu_temp_retain != 0))
|
|
|
|
{
|
|
|
|
if (user_options->gpu_temp_abort < user_options->gpu_temp_retain)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
|
2016-09-21 18:50:14 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->benchmark == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
|
|
|
if (user_options->attack_mode_chgd == true)
|
|
|
|
{
|
|
|
|
if (user_options->attack_mode != ATTACK_MODE_BF)
|
|
|
|
{
|
2016-10-11 08:55:02 +00:00
|
|
|
event_log_error (hashcat_ctx, "Only attack-mode 3 allowed in benchmark mode");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
|
|
|
|
// argc / argv checks
|
|
|
|
|
|
|
|
bool show_error = true;
|
|
|
|
|
2016-10-02 23:30:58 +00:00
|
|
|
if (user_options->version == true)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
else if (user_options->usage == true)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
else if (user_options->benchmark == true)
|
2016-10-02 21:30:31 +00:00
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 0)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
2016-09-21 14:07:49 +00:00
|
|
|
else if (user_options->opencl_info == true)
|
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->hc_argc == 0)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->restore == true)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 0)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->keyspace == true)
|
|
|
|
{
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 1)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 2)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 1)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 2)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 2)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->stdout_flag == true)
|
|
|
|
{
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
|
2016-09-21 14:07:49 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
// all argc possible because of stdin mode
|
2016-09-21 14:07:49 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 2)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc >= 1)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc >= 1)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc >= 1)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
2016-09-21 14:07:49 +00:00
|
|
|
}
|
|
|
|
}
|
2016-09-20 15:04:31 +00:00
|
|
|
else
|
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->hc_argc >= 1)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
show_error = false;
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->hc_argc == 3)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
show_error = false;
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_BF)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-02 21:38:17 +00:00
|
|
|
if (user_options->hc_argc >= 1)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
show_error = false;
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->hc_argc >= 2)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
show_error = false;
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->hc_argc >= 2)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (show_error == true)
|
|
|
|
{
|
|
|
|
usage_mini_print (user_options->hc_bin);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-20 15:04:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2016-10-06 14:40:29 +00:00
|
|
|
void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
|
2016-09-21 09:09:12 +00:00
|
|
|
{
|
2016-10-06 14:40:29 +00:00
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
#if !defined (WITH_HWMON)
|
|
|
|
user_options->powertune_enable = false;
|
|
|
|
user_options->gpu_temp_disable = true;
|
|
|
|
user_options->gpu_temp_abort = 0;
|
|
|
|
user_options->gpu_temp_retain = 0;
|
|
|
|
#endif // WITH_HWMON
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
// some options can influence or overwrite other options
|
|
|
|
|
2016-12-09 22:44:43 +00:00
|
|
|
if (user_options->opencl_info == true
|
|
|
|
|| user_options->keyspace == true
|
|
|
|
|| user_options->stdout_flag == true
|
|
|
|
|| user_options->speed_only == true
|
|
|
|
|| user_options->progress_only == true)
|
2016-09-21 09:09:12 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->gpu_temp_disable = true;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->left = false;
|
|
|
|
user_options->logfile_disable = true;
|
|
|
|
user_options->nvidia_spin_damp = 0;
|
|
|
|
user_options->outfile_check_timer = 0;
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->potfile_disable = true;
|
|
|
|
user_options->powertune_enable = false;
|
|
|
|
user_options->restore_disable = true;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->restore = false;
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->restore_timer = 0;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->show = false;
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->status = false;
|
|
|
|
user_options->status_timer = 0;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->weak_hash_threshold = 0;
|
2016-09-21 09:09:12 +00:00
|
|
|
}
|
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
if (user_options->benchmark == true)
|
2016-09-21 09:09:12 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->attack_mode = ATTACK_MODE_BF;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->gpu_temp_disable = false;
|
2016-11-12 18:54:52 +00:00
|
|
|
user_options->gpu_temp_retain = 0;
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->increment = false;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->left = false;
|
|
|
|
user_options->logfile_disable = true;
|
|
|
|
user_options->nvidia_spin_damp = 0;
|
|
|
|
user_options->potfile_disable = true;
|
|
|
|
user_options->powertune_enable = true;
|
|
|
|
user_options->restore_disable = true;
|
|
|
|
user_options->restore = false;
|
|
|
|
user_options->restore_timer = 0;
|
|
|
|
user_options->session = "benchmark";
|
|
|
|
user_options->show = false;
|
|
|
|
user_options->status = false;
|
|
|
|
user_options->status_timer = 0;
|
2016-10-14 19:38:52 +00:00
|
|
|
user_options->speed_only = true;
|
2016-12-09 22:44:43 +00:00
|
|
|
user_options->progress_only = false;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->weak_hash_threshold = 0;
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->workload_profile_chgd == false)
|
2016-09-21 09:09:12 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->workload_profile = 3;
|
2016-09-21 09:09:12 +00:00
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
}
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2016-12-09 22:44:43 +00:00
|
|
|
if (user_options->progress_only == true)
|
|
|
|
{
|
|
|
|
user_options->speed_only = true;
|
|
|
|
}
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->keyspace == true)
|
|
|
|
{
|
|
|
|
user_options->session = "keyspace";
|
|
|
|
user_options->quiet = true;
|
|
|
|
}
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->stdout_flag == true)
|
|
|
|
{
|
|
|
|
user_options->session = "stdout";
|
|
|
|
user_options->quiet = true;
|
|
|
|
user_options->hash_mode = 2000;
|
|
|
|
user_options->outfile_format = OUTFILE_FMT_PLAIN;
|
|
|
|
user_options->force = true;
|
|
|
|
user_options->kernel_accel = 1024;
|
|
|
|
user_options->kernel_loops = 1024;
|
|
|
|
user_options->opencl_vector_width = 1;
|
|
|
|
}
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->opencl_info == true)
|
|
|
|
{
|
|
|
|
user_options->session = "opencl_info";
|
|
|
|
user_options->quiet = true;
|
|
|
|
user_options->opencl_platforms = NULL;
|
|
|
|
user_options->opencl_devices = NULL;
|
2016-11-20 21:54:52 +00:00
|
|
|
user_options->opencl_device_types = hcstrdup ("1,2,3");
|
2016-09-21 09:09:12 +00:00
|
|
|
}
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->left == true)
|
|
|
|
{
|
|
|
|
user_options->outfile_format = OUTFILE_FMT_HASH;
|
|
|
|
}
|
2016-09-21 14:07:49 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->show == true || user_options->left == true)
|
|
|
|
{
|
|
|
|
user_options->attack_mode = ATTACK_MODE_NONE;
|
|
|
|
user_options->quiet = true;
|
|
|
|
}
|
2016-09-21 14:07:49 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
// this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
|
|
|
|
if (user_options->show == true || user_options->left == true)
|
2016-09-21 14:07:49 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->restore_disable = true;
|
|
|
|
|
|
|
|
user_options->restore = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->skip != 0 && user_options->limit != 0)
|
|
|
|
{
|
|
|
|
user_options->limit += user_options->skip;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
|
|
|
user_options->weak_hash_threshold = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->hash_mode == 9710)
|
|
|
|
{
|
|
|
|
user_options->outfile_format = 5;
|
|
|
|
user_options->outfile_format_chgd = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->hash_mode == 9810)
|
|
|
|
{
|
|
|
|
user_options->outfile_format = 5;
|
|
|
|
user_options->outfile_format_chgd = 1;
|
|
|
|
}
|
2016-09-26 15:15:07 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->hash_mode == 10410)
|
|
|
|
{
|
|
|
|
user_options->outfile_format = 5;
|
|
|
|
user_options->outfile_format_chgd = 1;
|
|
|
|
}
|
2016-09-26 15:15:07 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->markov_threshold == 0)
|
|
|
|
{
|
|
|
|
user_options->markov_threshold = 0x100;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->segment_size_chgd == true)
|
|
|
|
{
|
|
|
|
user_options->segment_size *= (1024 * 1024);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->gpu_temp_disable == true)
|
|
|
|
{
|
|
|
|
user_options->gpu_temp_abort = 0;
|
|
|
|
user_options->gpu_temp_retain = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// default mask
|
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
{
|
2016-12-09 22:44:43 +00:00
|
|
|
if (user_options->opencl_info == true)
|
2016-10-02 21:44:09 +00:00
|
|
|
{
|
|
|
|
|
2016-12-09 14:26:35 +00:00
|
|
|
}
|
|
|
|
else if (user_options->speed_only == true)
|
|
|
|
{
|
|
|
|
|
2016-10-02 21:44:09 +00:00
|
|
|
}
|
2016-10-04 21:09:12 +00:00
|
|
|
else if (user_options->keyspace == true)
|
2016-10-02 21:44:09 +00:00
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 0)
|
|
|
|
{
|
|
|
|
user_options->custom_charset_1 = DEF_MASK_CS_1;
|
|
|
|
user_options->custom_charset_2 = DEF_MASK_CS_2;
|
|
|
|
user_options->custom_charset_3 = DEF_MASK_CS_3;
|
|
|
|
|
|
|
|
user_options->increment = true;
|
|
|
|
}
|
|
|
|
}
|
2016-10-04 21:09:12 +00:00
|
|
|
else if (user_options->stdout_flag == true)
|
2016-10-02 21:44:09 +00:00
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 0)
|
|
|
|
{
|
|
|
|
user_options->custom_charset_1 = DEF_MASK_CS_1;
|
|
|
|
user_options->custom_charset_2 = DEF_MASK_CS_2;
|
|
|
|
user_options->custom_charset_3 = DEF_MASK_CS_3;
|
|
|
|
|
|
|
|
user_options->increment = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2016-09-26 15:15:07 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->hc_argc == 1)
|
2016-09-26 15:15:07 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->custom_charset_1 = DEF_MASK_CS_1;
|
|
|
|
user_options->custom_charset_2 = DEF_MASK_CS_2;
|
|
|
|
user_options->custom_charset_3 = DEF_MASK_CS_3;
|
2016-09-26 15:15:07 +00:00
|
|
|
|
|
|
|
user_options->increment = true;
|
|
|
|
}
|
|
|
|
}
|
2016-09-21 14:07:49 +00:00
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
}
|
|
|
|
|
2016-12-29 12:05:29 +00:00
|
|
|
void user_options_postprocess (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
// automatic status
|
|
|
|
|
|
|
|
if (user_options_extra->wordlist_mode == WL_MODE_STDIN)
|
|
|
|
{
|
|
|
|
user_options->status = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-06 14:40:29 +00:00
|
|
|
void user_options_extra_init (hashcat_ctx_t *hashcat_ctx)
|
2016-10-02 21:30:31 +00:00
|
|
|
{
|
2016-10-06 14:40:29 +00:00
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
// attack-kern
|
2016-09-21 14:07:49 +00:00
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options_extra->attack_kern = ATTACK_KERN_NONE;
|
|
|
|
|
|
|
|
switch (user_options->attack_mode)
|
2016-09-21 14:07:49 +00:00
|
|
|
{
|
2016-10-02 21:30:31 +00:00
|
|
|
case ATTACK_MODE_STRAIGHT: user_options_extra->attack_kern = ATTACK_KERN_STRAIGHT; break;
|
|
|
|
case ATTACK_MODE_COMBI: user_options_extra->attack_kern = ATTACK_KERN_COMBI; break;
|
|
|
|
case ATTACK_MODE_BF: user_options_extra->attack_kern = ATTACK_KERN_BF; break;
|
|
|
|
case ATTACK_MODE_HYBRID1: user_options_extra->attack_kern = ATTACK_KERN_COMBI; break;
|
|
|
|
case ATTACK_MODE_HYBRID2: user_options_extra->attack_kern = ATTACK_KERN_COMBI; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// rules
|
|
|
|
|
|
|
|
user_options_extra->rule_len_l = (int) strlen (user_options->rule_buf_l);
|
|
|
|
user_options_extra->rule_len_r = (int) strlen (user_options->rule_buf_r);
|
|
|
|
|
|
|
|
// hc_hash and hc_work*
|
|
|
|
|
|
|
|
user_options_extra->hc_hash = NULL;
|
|
|
|
user_options_extra->hc_workv = NULL;
|
|
|
|
user_options_extra->hc_workc = 0;
|
|
|
|
|
|
|
|
if (user_options->benchmark == true)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (user_options->opencl_info == true)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (user_options->keyspace == true)
|
|
|
|
{
|
|
|
|
user_options_extra->hc_workc = user_options->hc_argc;
|
|
|
|
user_options_extra->hc_workv = user_options->hc_argv;
|
|
|
|
}
|
|
|
|
else if (user_options->stdout_flag == true)
|
|
|
|
{
|
|
|
|
user_options_extra->hc_workc = user_options->hc_argc;
|
|
|
|
user_options_extra->hc_workv = user_options->hc_argv;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
user_options_extra->hc_hash = user_options->hc_argv[0];
|
|
|
|
user_options_extra->hc_workc = user_options->hc_argc - 1;
|
|
|
|
user_options_extra->hc_workv = user_options->hc_argv + 1;
|
|
|
|
}
|
2016-10-20 20:30:00 +00:00
|
|
|
|
|
|
|
// wordlist_mode
|
|
|
|
|
|
|
|
user_options_extra->wordlist_mode = WL_MODE_NONE;
|
|
|
|
|
|
|
|
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
|
|
|
|
{
|
|
|
|
user_options_extra->wordlist_mode = (user_options_extra->hc_workc >= 1) ? WL_MODE_FILE : WL_MODE_STDIN;
|
|
|
|
}
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
|
|
|
|
{
|
|
|
|
user_options_extra->wordlist_mode = WL_MODE_FILE;
|
|
|
|
}
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
|
|
|
|
{
|
|
|
|
user_options_extra->wordlist_mode = WL_MODE_MASK;
|
|
|
|
}
|
2016-09-21 09:09:12 +00:00
|
|
|
}
|
2016-09-23 19:41:05 +00:00
|
|
|
|
2016-10-06 14:40:29 +00:00
|
|
|
void user_options_extra_destroy (hashcat_ctx_t *hashcat_ctx)
|
2016-09-23 19:50:35 +00:00
|
|
|
{
|
2016-10-06 14:40:29 +00:00
|
|
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
2016-10-01 22:00:21 +00:00
|
|
|
memset (user_options_extra, 0, sizeof (user_options_extra_t));
|
2016-09-23 19:50:35 +00:00
|
|
|
}
|
|
|
|
|
2016-10-06 19:37:03 +00:00
|
|
|
u64 user_options_extra_amplifier (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
|
|
|
|
{
|
|
|
|
if (straight_ctx->kernel_rules_cnt)
|
|
|
|
{
|
|
|
|
return straight_ctx->kernel_rules_cnt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
|
|
|
|
{
|
|
|
|
if (combinator_ctx->combs_cnt)
|
|
|
|
{
|
|
|
|
return combinator_ctx->combs_cnt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
|
|
|
|
{
|
|
|
|
if (mask_ctx->bfs_cnt)
|
|
|
|
{
|
|
|
|
return mask_ctx->bfs_cnt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
dictstat_ctx_t *dictstat_ctx = hashcat_ctx->dictstat_ctx;
|
|
|
|
folder_config_t *folder_config = hashcat_ctx->folder_config;
|
|
|
|
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
|
|
|
|
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
|
|
|
|
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
2017-01-27 15:29:18 +00:00
|
|
|
pidfile_ctx_t *pidfile_ctx = hashcat_ctx->pidfile_ctx;
|
2017-01-27 13:50:39 +00:00
|
|
|
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
|
|
|
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
// common folders
|
|
|
|
|
|
|
|
if (hc_path_read (folder_config->cwd) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", folder_config->cwd);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_read (folder_config->install_dir) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", folder_config->install_dir);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_read (folder_config->profile_dir) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", folder_config->profile_dir);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_write (folder_config->session_dir) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", folder_config->session_dir);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_read (folder_config->shared_dir) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", folder_config->shared_dir);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_read (folder_config->cpath_real) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", folder_config->cpath_real);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// hashfile - can be NULL
|
|
|
|
|
|
|
|
if (user_options_extra->hc_hash != NULL)
|
|
|
|
{
|
|
|
|
if (hc_path_read (user_options_extra->hc_hash) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", user_options_extra->hc_hash);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// arguments - checks must depend on attack_mode
|
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < user_options_extra->hc_workc; i++)
|
|
|
|
{
|
|
|
|
char *wlfile = user_options_extra->hc_workv[i];
|
|
|
|
|
|
|
|
if (hc_path_exist (wlfile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", wlfile);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2017-01-27 15:34:48 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < (int) user_options->rp_files_cnt; i++)
|
|
|
|
{
|
|
|
|
char *rp_file = user_options->rp_files[i];
|
|
|
|
|
|
|
|
if (hc_path_exist (rp_file) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", rp_file);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
|
|
|
{
|
|
|
|
// mode easy mode here because both files must exist and readable
|
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (user_options_extra->hc_workc == 2)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-01-27 14:06:31 +00:00
|
|
|
char *dictfile1 = user_options_extra->hc_workv[0];
|
|
|
|
char *dictfile2 = user_options_extra->hc_workv[1];
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (dictfile1) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", dictfile1);
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (dictfile2) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", dictfile2);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
{
|
|
|
|
// if the file exist it's a maskfile and then it must be readable
|
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (user_options_extra->hc_workc == 1)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-01-27 14:06:31 +00:00
|
|
|
char *maskfile = user_options_extra->hc_workv[0];
|
|
|
|
|
|
|
|
if (hc_path_exist (maskfile) == true)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (maskfile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", maskfile);
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
|
|
|
{
|
2017-01-27 14:06:31 +00:00
|
|
|
if (user_options_extra->hc_workc == 2)
|
|
|
|
{
|
|
|
|
char *wlfile = user_options_extra->hc_workv[0];
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
char *maskfile = user_options_extra->hc_workv[1];
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
// for wordlist: can be folder
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_exist (wlfile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", wlfile);
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
// for mask: if the file exist it's a maskfile and then it must be readable
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_exist (maskfile) == true)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (maskfile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", maskfile);
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
|
|
|
{
|
2017-01-27 14:06:31 +00:00
|
|
|
if (user_options_extra->hc_workc == 2)
|
|
|
|
{
|
|
|
|
char *wlfile = user_options_extra->hc_workv[1];
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
char *maskfile = user_options_extra->hc_workv[0];
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
// for wordlist: can be folder
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_exist (wlfile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", wlfile);
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
// for mask: if the file exist it's a maskfile and then it must be readable
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_exist (maskfile) == true)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (maskfile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", maskfile);
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// logfile
|
|
|
|
|
|
|
|
if (logfile_ctx->enabled == true)
|
|
|
|
{
|
|
|
|
if (hc_path_exist (logfile_ctx->logfile) == true)
|
|
|
|
{
|
|
|
|
if (hc_path_write (logfile_ctx->logfile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", logfile_ctx->logfile);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// outfile_check
|
|
|
|
|
|
|
|
if (outcheck_ctx->enabled == true)
|
|
|
|
{
|
|
|
|
if (hc_path_exist (outcheck_ctx->root_directory) == true)
|
|
|
|
{
|
|
|
|
const bool is_dir = hc_path_is_directory (outcheck_ctx->root_directory);
|
|
|
|
|
|
|
|
if (is_dir == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Directory specified in outfile-check '%s' is not a directory", outcheck_ctx->root_directory);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// outfile - can be NULL
|
|
|
|
|
|
|
|
if (outfile_ctx->filename != NULL)
|
|
|
|
{
|
|
|
|
if (hc_path_write (outfile_ctx->filename) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", outfile_ctx->filename);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// check for hashfile vs outfile (should not point to the same physical file)
|
|
|
|
|
|
|
|
char *hashfile = user_options_extra->hc_hash;
|
|
|
|
|
|
|
|
char *outfile = outfile_ctx->filename;
|
|
|
|
|
|
|
|
hc_stat_t tmpstat_outfile;
|
|
|
|
hc_stat_t tmpstat_hashfile;
|
|
|
|
|
|
|
|
FILE *tmp_outfile_fp = fopen (outfile, "r");
|
|
|
|
|
|
|
|
if (tmp_outfile_fp)
|
|
|
|
{
|
|
|
|
hc_fstat (fileno (tmp_outfile_fp), &tmpstat_outfile);
|
|
|
|
|
|
|
|
fclose (tmp_outfile_fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
FILE *tmp_hashfile_fp = fopen (hashfile, "r");
|
|
|
|
|
|
|
|
if (tmp_hashfile_fp)
|
|
|
|
{
|
|
|
|
hc_fstat (fileno (tmp_hashfile_fp), &tmpstat_hashfile);
|
|
|
|
|
|
|
|
fclose (tmp_hashfile_fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (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 (memcmp (&tmpstat_outfile, &tmpstat_hashfile, sizeof (hc_stat_t)) == 0)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Hashfile and Outfile are not allowed to point to the same file");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-27 15:29:18 +00:00
|
|
|
// pidfile
|
|
|
|
|
|
|
|
if (hc_path_exist (pidfile_ctx->filename) == true)
|
|
|
|
{
|
|
|
|
if (hc_path_write (pidfile_ctx->filename) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", pidfile_ctx->filename);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
// potfile
|
|
|
|
|
|
|
|
if (potfile_ctx->enabled == true)
|
|
|
|
{
|
|
|
|
if (hc_path_exist (potfile_ctx->filename) == true)
|
|
|
|
{
|
|
|
|
if (hc_path_write (potfile_ctx->filename) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", potfile_ctx->filename);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// dictstat
|
|
|
|
|
|
|
|
if (dictstat_ctx->enabled == true)
|
|
|
|
{
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_exist (dictstat_ctx->filename) == true)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_write (dictstat_ctx->filename) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %m", dictstat_ctx->filename);
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// loopback - can't check at this point
|
|
|
|
|
|
|
|
// tuning file check already done
|
|
|
|
|
|
|
|
// debugfile check already done
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-10-06 14:25:24 +00:00
|
|
|
void user_options_logger (hashcat_ctx_t *hashcat_ctx)
|
2016-09-23 19:41:05 +00:00
|
|
|
{
|
2016-10-06 14:25:24 +00:00
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
|
|
|
|
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_char (user_options->separator);
|
|
|
|
logfile_top_string (user_options->cpu_affinity);
|
|
|
|
logfile_top_string (user_options->custom_charset_1);
|
|
|
|
logfile_top_string (user_options->custom_charset_2);
|
|
|
|
logfile_top_string (user_options->custom_charset_3);
|
|
|
|
logfile_top_string (user_options->custom_charset_4);
|
|
|
|
logfile_top_string (user_options->debug_file);
|
|
|
|
logfile_top_string (user_options->induction_dir);
|
|
|
|
logfile_top_string (user_options->markov_hcstat);
|
|
|
|
logfile_top_string (user_options->opencl_devices);
|
|
|
|
logfile_top_string (user_options->opencl_device_types);
|
|
|
|
logfile_top_string (user_options->opencl_platforms);
|
|
|
|
logfile_top_string (user_options->outfile);
|
|
|
|
logfile_top_string (user_options->outfile_check_dir);
|
|
|
|
logfile_top_string (user_options->potfile_path);
|
2016-10-27 21:09:50 +00:00
|
|
|
logfile_top_string (user_options->restore_file_path);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_string (user_options->rp_files[0]);
|
|
|
|
logfile_top_string (user_options->rule_buf_l);
|
|
|
|
logfile_top_string (user_options->rule_buf_r);
|
|
|
|
logfile_top_string (user_options->session);
|
|
|
|
logfile_top_string (user_options->truecrypt_keyfiles);
|
|
|
|
logfile_top_string (user_options->veracrypt_keyfiles);
|
|
|
|
logfile_top_uint64 (user_options->limit);
|
|
|
|
logfile_top_uint64 (user_options->skip);
|
|
|
|
logfile_top_uint (user_options->attack_mode);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->benchmark);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->bitmap_max);
|
|
|
|
logfile_top_uint (user_options->bitmap_min);
|
|
|
|
logfile_top_uint (user_options->debug_mode);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->force);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->gpu_temp_abort);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->gpu_temp_disable);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->gpu_temp_retain);
|
|
|
|
logfile_top_uint (user_options->hash_mode);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->hex_charset);
|
|
|
|
logfile_top_uint (user_options->hex_salt);
|
|
|
|
logfile_top_uint (user_options->hex_wordlist);
|
|
|
|
logfile_top_uint (user_options->increment);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->increment_max);
|
|
|
|
logfile_top_uint (user_options->increment_min);
|
2016-10-31 09:09:04 +00:00
|
|
|
logfile_top_uint (user_options->keep_guessing);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->kernel_accel);
|
|
|
|
logfile_top_uint (user_options->kernel_loops);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->keyspace);
|
|
|
|
logfile_top_uint (user_options->left);
|
|
|
|
logfile_top_uint (user_options->logfile_disable);
|
|
|
|
logfile_top_uint (user_options->loopback);
|
|
|
|
logfile_top_uint (user_options->machine_readable);
|
|
|
|
logfile_top_uint (user_options->markov_classic);
|
|
|
|
logfile_top_uint (user_options->markov_disable);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->markov_threshold);
|
|
|
|
logfile_top_uint (user_options->nvidia_spin_damp);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->opencl_info);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->opencl_vector_width);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->outfile_autohex);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->outfile_check_timer);
|
|
|
|
logfile_top_uint (user_options->outfile_format);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->potfile_disable);
|
|
|
|
logfile_top_uint (user_options->powertune_enable);
|
|
|
|
logfile_top_uint (user_options->quiet);
|
|
|
|
logfile_top_uint (user_options->remove);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->remove_timer);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->restore);
|
|
|
|
logfile_top_uint (user_options->restore_disable);
|
|
|
|
logfile_top_uint (user_options->restore_timer);
|
|
|
|
logfile_top_uint (user_options->rp_files_cnt);
|
|
|
|
logfile_top_uint (user_options->rp_gen);
|
|
|
|
logfile_top_uint (user_options->rp_gen_func_max);
|
|
|
|
logfile_top_uint (user_options->rp_gen_func_min);
|
|
|
|
logfile_top_uint (user_options->rp_gen_seed);
|
|
|
|
logfile_top_uint (user_options->runtime);
|
|
|
|
logfile_top_uint (user_options->scrypt_tmto);
|
|
|
|
logfile_top_uint (user_options->segment_size);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->show);
|
|
|
|
logfile_top_uint (user_options->status);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->status_timer);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->stdout_flag);
|
|
|
|
logfile_top_uint (user_options->speed_only);
|
2016-12-09 22:44:43 +00:00
|
|
|
logfile_top_uint (user_options->progress_only);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->usage);
|
|
|
|
logfile_top_uint (user_options->username);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->veracrypt_pim);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->version);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->weak_hash_threshold);
|
|
|
|
logfile_top_uint (user_options->workload_profile);
|
|
|
|
}
|