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"
|
2022-01-13 16:53:04 +00:00
|
|
|
#include "convert.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"
|
2019-04-25 12:45:17 +00:00
|
|
|
#include "backend.h"
|
2016-09-20 14:04:22 +00:00
|
|
|
#include "user_options.h"
|
2020-01-23 08:03:22 +00:00
|
|
|
#include "outfile.h"
|
2016-09-20 14:04:22 +00:00
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
#include "brain.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WITH_BRAIN
|
2021-07-18 19:48:54 +00:00
|
|
|
static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSz";
|
2018-10-28 15:47:13 +00:00
|
|
|
#else
|
2021-07-18 19:48:54 +00:00
|
|
|
static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMS";
|
2018-10-28 15:47:13 +00:00
|
|
|
#endif
|
2016-09-30 07:34:06 +00:00
|
|
|
|
2021-07-18 19:48:54 +00:00
|
|
|
static char *const SEPARATOR = ":";
|
2021-07-22 16:54:02 +00:00
|
|
|
|
2016-09-30 07:34:06 +00:00
|
|
|
static const struct option long_options[] =
|
|
|
|
{
|
2018-01-29 11:35:08 +00:00
|
|
|
{"advice-disable", no_argument, NULL, IDX_ADVICE_DISABLE},
|
|
|
|
{"attack-mode", required_argument, NULL, IDX_ATTACK_MODE},
|
2019-05-01 13:52:56 +00:00
|
|
|
{"backend-devices", required_argument, NULL, IDX_BACKEND_DEVICES},
|
2020-01-03 10:51:24 +00:00
|
|
|
{"backend-ignore-cuda", no_argument, NULL, IDX_BACKEND_IGNORE_CUDA},
|
2021-07-09 03:50:40 +00:00
|
|
|
{"backend-ignore-hip", no_argument, NULL, IDX_BACKEND_IGNORE_HIP},
|
2020-01-03 10:51:24 +00:00
|
|
|
{"backend-ignore-opencl", no_argument, NULL, IDX_BACKEND_IGNORE_OPENCL},
|
2019-05-01 13:52:56 +00:00
|
|
|
{"backend-info", no_argument, NULL, IDX_BACKEND_INFO},
|
|
|
|
{"backend-vector-width", required_argument, NULL, IDX_BACKEND_VECTOR_WIDTH},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"benchmark-all", no_argument, NULL, IDX_BENCHMARK_ALL},
|
2018-09-01 10:31:17 +00:00
|
|
|
{"benchmark", no_argument, NULL, IDX_BENCHMARK},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"bitmap-max", required_argument, NULL, IDX_BITMAP_MAX},
|
|
|
|
{"bitmap-min", required_argument, NULL, IDX_BITMAP_MIN},
|
|
|
|
{"cpu-affinity", required_argument, NULL, IDX_CPU_AFFINITY},
|
|
|
|
{"custom-charset1", required_argument, NULL, IDX_CUSTOM_CHARSET_1},
|
|
|
|
{"custom-charset2", required_argument, NULL, IDX_CUSTOM_CHARSET_2},
|
|
|
|
{"custom-charset3", required_argument, NULL, IDX_CUSTOM_CHARSET_3},
|
|
|
|
{"custom-charset4", required_argument, NULL, IDX_CUSTOM_CHARSET_4},
|
|
|
|
{"debug-file", required_argument, NULL, IDX_DEBUG_FILE},
|
|
|
|
{"debug-mode", required_argument, NULL, IDX_DEBUG_MODE},
|
2021-08-10 15:59:52 +00:00
|
|
|
{"deprecated-check-disable", no_argument, NULL, IDX_DEPRECATED_CHECK_DISABLE},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"encoding-from", required_argument, NULL, IDX_ENCODING_FROM},
|
|
|
|
{"encoding-to", required_argument, NULL, IDX_ENCODING_TO},
|
2020-12-29 06:56:20 +00:00
|
|
|
{"example-hashes", no_argument, NULL, IDX_HASH_INFO}, // alias of hash-info
|
2018-01-29 11:35:08 +00:00
|
|
|
{"force", no_argument, NULL, IDX_FORCE},
|
|
|
|
{"generate-rules-func-max", required_argument, NULL, IDX_RP_GEN_FUNC_MAX},
|
|
|
|
{"generate-rules-func-min", required_argument, NULL, IDX_RP_GEN_FUNC_MIN},
|
2021-08-14 09:43:32 +00:00
|
|
|
{"generate-rules-func-sel", required_argument, NULL, IDX_RP_GEN_FUNC_SEL},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"generate-rules", required_argument, NULL, IDX_RP_GEN},
|
|
|
|
{"generate-rules-seed", required_argument, NULL, IDX_RP_GEN_SEED},
|
2018-11-09 11:48:27 +00:00
|
|
|
{"hwmon-disable", no_argument, NULL, IDX_HWMON_DISABLE},
|
|
|
|
{"hwmon-temp-abort", required_argument, NULL, IDX_HWMON_TEMP_ABORT},
|
2020-12-29 03:58:58 +00:00
|
|
|
{"hash-info", no_argument, NULL, IDX_HASH_INFO},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"hash-type", required_argument, NULL, IDX_HASH_MODE},
|
|
|
|
{"hccapx-message-pair", required_argument, NULL, IDX_HCCAPX_MESSAGE_PAIR},
|
|
|
|
{"help", no_argument, NULL, IDX_HELP},
|
|
|
|
{"hex-charset", no_argument, NULL, IDX_HEX_CHARSET},
|
|
|
|
{"hex-salt", no_argument, NULL, IDX_HEX_SALT},
|
|
|
|
{"hex-wordlist", no_argument, NULL, IDX_HEX_WORDLIST},
|
2019-11-02 09:29:34 +00:00
|
|
|
{"hook-threads", required_argument, NULL, IDX_HOOK_THREADS},
|
2021-06-11 17:25:39 +00:00
|
|
|
{"identify", no_argument, NULL, IDX_IDENTIFY},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"increment-max", required_argument, NULL, IDX_INCREMENT_MAX},
|
|
|
|
{"increment-min", required_argument, NULL, IDX_INCREMENT_MIN},
|
|
|
|
{"increment", no_argument, NULL, IDX_INCREMENT},
|
|
|
|
{"induction-dir", required_argument, NULL, IDX_INDUCTION_DIR},
|
|
|
|
{"keep-guessing", no_argument, NULL, IDX_KEEP_GUESSING},
|
|
|
|
{"kernel-accel", required_argument, NULL, IDX_KERNEL_ACCEL},
|
|
|
|
{"kernel-loops", required_argument, NULL, IDX_KERNEL_LOOPS},
|
2018-11-06 15:06:06 +00:00
|
|
|
{"kernel-threads", required_argument, NULL, IDX_KERNEL_THREADS},
|
2018-11-26 08:38:13 +00:00
|
|
|
{"keyboard-layout-mapping", required_argument, NULL, IDX_KEYBOARD_LAYOUT_MAPPING},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"keyspace", no_argument, NULL, IDX_KEYSPACE},
|
|
|
|
{"left", no_argument, NULL, IDX_LEFT},
|
|
|
|
{"limit", required_argument, NULL, IDX_LIMIT},
|
|
|
|
{"logfile-disable", no_argument, NULL, IDX_LOGFILE_DISABLE},
|
|
|
|
{"loopback", no_argument, NULL, IDX_LOOPBACK},
|
|
|
|
{"machine-readable", no_argument, NULL, IDX_MACHINE_READABLE},
|
|
|
|
{"markov-classic", no_argument, NULL, IDX_MARKOV_CLASSIC},
|
|
|
|
{"markov-disable", no_argument, NULL, IDX_MARKOV_DISABLE},
|
2018-08-23 07:10:54 +00:00
|
|
|
{"markov-hcstat2", required_argument, NULL, IDX_MARKOV_HCSTAT2},
|
2021-07-07 08:32:08 +00:00
|
|
|
{"markov-inverse", no_argument, NULL, IDX_MARKOV_INVERSE},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"markov-threshold", required_argument, NULL, IDX_MARKOV_THRESHOLD},
|
|
|
|
{"nonce-error-corrections", required_argument, NULL, IDX_NONCE_ERROR_CORRECTIONS},
|
|
|
|
{"opencl-device-types", required_argument, NULL, IDX_OPENCL_DEVICE_TYPES},
|
|
|
|
{"optimized-kernel-enable", no_argument, NULL, IDX_OPTIMIZED_KERNEL_ENABLE},
|
2021-07-21 13:47:05 +00:00
|
|
|
{"multiply-accel-disable", no_argument, NULL, IDX_MULTIPLY_ACCEL_DISABLE},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"outfile-autohex-disable", no_argument, NULL, IDX_OUTFILE_AUTOHEX_DISABLE},
|
|
|
|
{"outfile-check-dir", required_argument, NULL, IDX_OUTFILE_CHECK_DIR},
|
|
|
|
{"outfile-check-timer", required_argument, NULL, IDX_OUTFILE_CHECK_TIMER},
|
|
|
|
{"outfile-format", required_argument, NULL, IDX_OUTFILE_FORMAT},
|
|
|
|
{"outfile", required_argument, NULL, IDX_OUTFILE},
|
|
|
|
{"potfile-disable", no_argument, NULL, IDX_POTFILE_DISABLE},
|
|
|
|
{"potfile-path", required_argument, NULL, IDX_POTFILE_PATH},
|
2018-09-01 10:31:17 +00:00
|
|
|
{"progress-only", no_argument, NULL, IDX_PROGRESS_ONLY},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"quiet", no_argument, NULL, IDX_QUIET},
|
|
|
|
{"remove", no_argument, NULL, IDX_REMOVE},
|
|
|
|
{"remove-timer", required_argument, NULL, IDX_REMOVE_TIMER},
|
|
|
|
{"restore-disable", no_argument, NULL, IDX_RESTORE_DISABLE},
|
|
|
|
{"restore-file-path", required_argument, NULL, IDX_RESTORE_FILE_PATH},
|
|
|
|
{"restore", no_argument, NULL, IDX_RESTORE},
|
|
|
|
{"rule-left", required_argument, NULL, IDX_RULE_BUF_L},
|
|
|
|
{"rule-right", required_argument, NULL, IDX_RULE_BUF_R},
|
|
|
|
{"rules-file", required_argument, NULL, IDX_RP_FILE},
|
|
|
|
{"runtime", required_argument, NULL, IDX_RUNTIME},
|
|
|
|
{"scrypt-tmto", required_argument, NULL, IDX_SCRYPT_TMTO},
|
|
|
|
{"segment-size", required_argument, NULL, IDX_SEGMENT_SIZE},
|
2018-09-01 10:31:17 +00:00
|
|
|
{"self-test-disable", no_argument, NULL, IDX_SELF_TEST_DISABLE},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"separator", required_argument, NULL, IDX_SEPARATOR},
|
|
|
|
{"seperator", required_argument, NULL, IDX_SEPARATOR},
|
|
|
|
{"session", required_argument, NULL, IDX_SESSION},
|
|
|
|
{"show", no_argument, NULL, IDX_SHOW},
|
|
|
|
{"skip", required_argument, NULL, IDX_SKIP},
|
2018-09-01 10:31:17 +00:00
|
|
|
{"slow-candidates", no_argument, NULL, IDX_SLOW_CANDIDATES},
|
|
|
|
{"speed-only", no_argument, NULL, IDX_SPEED_ONLY},
|
2018-11-20 11:32:24 +00:00
|
|
|
{"spin-damp", required_argument, NULL, IDX_SPIN_DAMP},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"status", no_argument, NULL, IDX_STATUS},
|
2019-03-27 10:09:24 +00:00
|
|
|
{"status-json", no_argument, NULL, IDX_STATUS_JSON},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"status-timer", required_argument, NULL, IDX_STATUS_TIMER},
|
|
|
|
{"stdout", no_argument, NULL, IDX_STDOUT_FLAG},
|
2018-10-31 10:37:06 +00:00
|
|
|
{"stdin-timeout-abort", required_argument, NULL, IDX_STDIN_TIMEOUT_ABORT},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"truecrypt-keyfiles", required_argument, NULL, IDX_TRUECRYPT_KEYFILES},
|
|
|
|
{"username", no_argument, NULL, IDX_USERNAME},
|
|
|
|
{"veracrypt-keyfiles", required_argument, NULL, IDX_VERACRYPT_KEYFILES},
|
2019-03-15 20:48:49 +00:00
|
|
|
{"veracrypt-pim-start", required_argument, NULL, IDX_VERACRYPT_PIM_START},
|
|
|
|
{"veracrypt-pim-stop", required_argument, NULL, IDX_VERACRYPT_PIM_STOP},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"version", no_argument, NULL, IDX_VERSION},
|
2018-09-01 10:31:17 +00:00
|
|
|
{"wordlist-autohex-disable", no_argument, NULL, IDX_WORDLIST_AUTOHEX_DISABLE},
|
2018-01-29 11:35:08 +00:00
|
|
|
{"workload-profile", required_argument, NULL, IDX_WORKLOAD_PROFILE},
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
{"brain-client", no_argument, NULL, IDX_BRAIN_CLIENT},
|
|
|
|
{"brain-client-features", required_argument, NULL, IDX_BRAIN_CLIENT_FEATURES},
|
|
|
|
{"brain-server", no_argument, NULL, IDX_BRAIN_SERVER},
|
2020-01-11 09:46:11 +00:00
|
|
|
{"brain-server-timer", required_argument, NULL, IDX_BRAIN_SERVER_TIMER},
|
2018-10-28 15:47:13 +00:00
|
|
|
{"brain-host", required_argument, NULL, IDX_BRAIN_HOST},
|
|
|
|
{"brain-port", required_argument, NULL, IDX_BRAIN_PORT},
|
|
|
|
{"brain-password", required_argument, NULL, IDX_BRAIN_PASSWORD},
|
|
|
|
{"brain-session", required_argument, NULL, IDX_BRAIN_SESSION},
|
|
|
|
{"brain-session-whitelist", required_argument, NULL, IDX_BRAIN_SESSION_WHITELIST},
|
|
|
|
#endif
|
2018-01-29 11:35:08 +00:00
|
|
|
{NULL, 0, NULL, 0 }
|
2016-09-30 07:34:06 +00:00
|
|
|
};
|
|
|
|
|
2021-07-18 19:48:54 +00:00
|
|
|
static const char *const ENCODING_FROM = "utf-8";
|
|
|
|
static const char *const ENCODING_TO = "utf-8";
|
2017-04-14 14:36:28 +00:00
|
|
|
|
2021-07-18 19:48:54 +00:00
|
|
|
static const char *const RULE_BUF_R = ":";
|
|
|
|
static const char *const RULE_BUF_L = ":";
|
2016-09-21 14:38:55 +00:00
|
|
|
|
2021-07-18 19:48:54 +00:00
|
|
|
static const char *const DEF_MASK_CS_1 = "?l?d?u";
|
|
|
|
static const char *const DEF_MASK_CS_2 = "?l?d";
|
|
|
|
static const char *const DEF_MASK_CS_3 = "?l?d*!$@_";
|
2016-10-02 21:30:31 +00:00
|
|
|
|
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;
|
|
|
|
|
2017-03-25 19:50:37 +00:00
|
|
|
user_options->advice_disable = ADVICE_DISABLE;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->attack_mode = ATTACK_MODE;
|
2021-06-05 20:11:18 +00:00
|
|
|
user_options->autodetect = AUTODETECT;
|
2019-05-01 13:52:56 +00:00
|
|
|
user_options->backend_devices = NULL;
|
2020-01-03 10:51:24 +00:00
|
|
|
user_options->backend_ignore_cuda = BACKEND_IGNORE_CUDA;
|
2021-08-14 09:43:32 +00:00
|
|
|
user_options->backend_ignore_hip = BACKEND_IGNORE_HIP;
|
2020-01-03 10:51:24 +00:00
|
|
|
user_options->backend_ignore_opencl = BACKEND_IGNORE_OPENCL;
|
2019-05-01 13:52:56 +00:00
|
|
|
user_options->backend_info = BACKEND_INFO;
|
|
|
|
user_options->backend_vector_width = BACKEND_VECTOR_WIDTH;
|
2017-12-05 10:08:59 +00:00
|
|
|
user_options->benchmark_all = BENCHMARK_ALL;
|
2018-09-01 10:31:17 +00:00
|
|
|
user_options->benchmark = BENCHMARK;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->bitmap_max = BITMAP_MAX;
|
|
|
|
user_options->bitmap_min = BITMAP_MIN;
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
user_options->brain_client = BRAIN_CLIENT;
|
|
|
|
user_options->brain_client_features = BRAIN_CLIENT_FEATURES;
|
|
|
|
user_options->brain_host = NULL;
|
|
|
|
user_options->brain_port = BRAIN_PORT;
|
|
|
|
user_options->brain_server = BRAIN_SERVER;
|
2020-01-11 10:25:37 +00:00
|
|
|
user_options->brain_server_timer = BRAIN_SERVER_TIMER;
|
2018-10-28 15:47:13 +00:00
|
|
|
user_options->brain_session = BRAIN_SESSION;
|
|
|
|
user_options->brain_session_whitelist = NULL;
|
|
|
|
#endif
|
2016-09-20 14:04:22 +00:00
|
|
|
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;
|
2021-08-10 15:59:52 +00:00
|
|
|
user_options->deprecated_check_disable = DEPRECATED_CHECK_DISABLE;
|
2017-04-14 14:36:28 +00:00
|
|
|
user_options->encoding_from = ENCODING_FROM;
|
|
|
|
user_options->encoding_to = ENCODING_TO;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->force = FORCE;
|
2018-11-09 11:48:27 +00:00
|
|
|
user_options->hwmon_disable = HWMON_DISABLE;
|
|
|
|
user_options->hwmon_temp_abort = HWMON_TEMP_ABORT;
|
2020-12-29 03:58:58 +00:00
|
|
|
user_options->hash_info = HASH_INFO;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->hash_mode = HASH_MODE;
|
2017-02-27 11:09:49 +00:00
|
|
|
user_options->hccapx_message_pair = HCCAPX_MESSAGE_PAIR;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->hex_charset = HEX_CHARSET;
|
|
|
|
user_options->hex_salt = HEX_SALT;
|
|
|
|
user_options->hex_wordlist = HEX_WORDLIST;
|
2019-11-02 09:29:34 +00:00
|
|
|
user_options->hook_threads = HOOK_THREADS;
|
2021-06-11 17:25:39 +00:00
|
|
|
user_options->identify = IDENTIFY;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->increment = INCREMENT;
|
|
|
|
user_options->increment_max = INCREMENT_MAX;
|
|
|
|
user_options->increment_min = INCREMENT_MIN;
|
|
|
|
user_options->induction_dir = NULL;
|
2018-09-01 10:31:17 +00:00
|
|
|
user_options->keep_guessing = KEEP_GUESSING;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->kernel_accel = KERNEL_ACCEL;
|
|
|
|
user_options->kernel_loops = KERNEL_LOOPS;
|
2018-11-06 15:06:06 +00:00
|
|
|
user_options->kernel_threads = KERNEL_THREADS;
|
2018-11-25 17:21:07 +00:00
|
|
|
user_options->keyboard_layout_mapping = NULL;
|
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;
|
2018-08-23 07:10:54 +00:00
|
|
|
user_options->markov_hcstat2 = NULL;
|
2021-07-07 08:32:08 +00:00
|
|
|
user_options->markov_inverse = MARKOV_INVERSE;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->markov_threshold = MARKOV_THRESHOLD;
|
2017-03-07 13:41:58 +00:00
|
|
|
user_options->nonce_error_corrections = NONCE_ERROR_CORRECTIONS;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->opencl_device_types = NULL;
|
2017-07-18 11:23:42 +00:00
|
|
|
user_options->optimized_kernel_enable = OPTIMIZED_KERNEL_ENABLE;
|
2021-07-21 13:47:05 +00:00
|
|
|
user_options->multiply_accel_disable = MULTIPLY_ACCEL_DISABLE;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->outfile_autohex = OUTFILE_AUTOHEX;
|
|
|
|
user_options->outfile_check_dir = NULL;
|
|
|
|
user_options->outfile_check_timer = OUTFILE_CHECK_TIMER;
|
2020-01-24 17:43:13 +00:00
|
|
|
user_options->outfile_format = OUTFILE_FORMAT;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->outfile = NULL;
|
|
|
|
user_options->potfile_disable = POTFILE_DISABLE;
|
|
|
|
user_options->potfile_path = NULL;
|
2018-09-01 10:31:17 +00:00
|
|
|
user_options->progress_only = PROGRESS_ONLY;
|
2016-09-20 14:04:22 +00:00
|
|
|
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;
|
2021-08-14 09:43:32 +00:00
|
|
|
user_options->rp_gen_func_sel = NULL;
|
2016-09-20 14:04:22 +00:00
|
|
|
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;
|
2018-09-01 10:31:17 +00:00
|
|
|
user_options->self_test_disable = SELF_TEST_DISABLE;
|
2016-09-20 14:04:22 +00:00
|
|
|
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;
|
2018-09-01 10:31:17 +00:00
|
|
|
user_options->slow_candidates = SLOW_CANDIDATES;
|
|
|
|
user_options->speed_only = SPEED_ONLY;
|
2018-11-20 11:32:24 +00:00
|
|
|
user_options->spin_damp = SPIN_DAMP;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->status = STATUS;
|
2019-03-27 10:09:24 +00:00
|
|
|
user_options->status_json = STATUS_JSON;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->status_timer = STATUS_TIMER;
|
2018-10-31 10:37:06 +00:00
|
|
|
user_options->stdin_timeout_abort = STDIN_TIMEOUT_ABORT;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->stdout_flag = STDOUT_FLAG;
|
|
|
|
user_options->truecrypt_keyfiles = NULL;
|
|
|
|
user_options->usage = USAGE;
|
|
|
|
user_options->username = USERNAME;
|
|
|
|
user_options->veracrypt_keyfiles = NULL;
|
2020-02-08 11:24:47 +00:00
|
|
|
user_options->veracrypt_pim_start = VERACRYPT_PIM_START;
|
|
|
|
user_options->veracrypt_pim_stop = VERACRYPT_PIM_STOP;
|
2016-09-20 14:04:22 +00:00
|
|
|
user_options->version = VERSION;
|
2018-09-01 10:31:17 +00:00
|
|
|
user_options->wordlist_autohex_disable = WORDLIST_AUTOHEX_DISABLE;
|
2016-09-20 14:04:22 +00:00
|
|
|
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;
|
|
|
|
|
2017-03-19 14:11:41 +00:00
|
|
|
int option_index;
|
|
|
|
|
2016-09-20 15:04:31 +00:00
|
|
|
optind = 1;
|
|
|
|
optopt = 0;
|
|
|
|
|
2017-03-19 14:11:41 +00:00
|
|
|
option_index = 0;
|
|
|
|
|
2017-08-16 09:46:17 +00:00
|
|
|
while ((c = getopt_long (argc, argv, short_options, long_options, &option_index)) != -1)
|
2017-03-19 14:11:41 +00:00
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case IDX_REMOVE_TIMER:
|
|
|
|
case IDX_DEBUG_MODE:
|
|
|
|
case IDX_SKIP:
|
|
|
|
case IDX_LIMIT:
|
|
|
|
case IDX_STATUS_TIMER:
|
|
|
|
case IDX_HASH_MODE:
|
|
|
|
case IDX_RUNTIME:
|
|
|
|
case IDX_ATTACK_MODE:
|
|
|
|
case IDX_RP_GEN:
|
|
|
|
case IDX_RP_GEN_FUNC_MIN:
|
|
|
|
case IDX_RP_GEN_FUNC_MAX:
|
|
|
|
case IDX_RP_GEN_SEED:
|
|
|
|
case IDX_MARKOV_THRESHOLD:
|
|
|
|
case IDX_OUTFILE_CHECK_TIMER:
|
2019-05-01 13:52:56 +00:00
|
|
|
case IDX_BACKEND_VECTOR_WIDTH:
|
2017-03-19 14:11:41 +00:00
|
|
|
case IDX_WORKLOAD_PROFILE:
|
|
|
|
case IDX_KERNEL_ACCEL:
|
|
|
|
case IDX_KERNEL_LOOPS:
|
2018-11-06 15:06:06 +00:00
|
|
|
case IDX_KERNEL_THREADS:
|
2018-11-20 11:32:24 +00:00
|
|
|
case IDX_SPIN_DAMP:
|
2018-11-09 11:48:27 +00:00
|
|
|
case IDX_HWMON_TEMP_ABORT:
|
2017-03-19 14:11:41 +00:00
|
|
|
case IDX_HCCAPX_MESSAGE_PAIR:
|
|
|
|
case IDX_NONCE_ERROR_CORRECTIONS:
|
2019-03-15 20:48:49 +00:00
|
|
|
case IDX_VERACRYPT_PIM_START:
|
|
|
|
case IDX_VERACRYPT_PIM_STOP:
|
2017-03-19 14:11:41 +00:00
|
|
|
case IDX_SEGMENT_SIZE:
|
|
|
|
case IDX_SCRYPT_TMTO:
|
|
|
|
case IDX_BITMAP_MIN:
|
|
|
|
case IDX_BITMAP_MAX:
|
|
|
|
case IDX_INCREMENT_MIN:
|
|
|
|
case IDX_INCREMENT_MAX:
|
2019-11-02 09:29:34 +00:00
|
|
|
case IDX_HOOK_THREADS:
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
case IDX_BRAIN_PORT:
|
|
|
|
#endif
|
2017-03-19 14:11:41 +00:00
|
|
|
|
|
|
|
if (hc_string_is_digit (optarg) == false)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "The specified parameter cannot use '%s' as a value - must be a number.", optarg);
|
2017-03-19 14:11:41 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-08-16 09:46:17 +00:00
|
|
|
break;
|
2017-03-19 14:27:43 +00:00
|
|
|
|
2017-08-16 09:46:17 +00:00
|
|
|
case '?':
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid argument specified.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2017-03-19 14:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
optind = 1;
|
|
|
|
optopt = 0;
|
|
|
|
|
2017-03-19 14:11:41 +00:00
|
|
|
option_index = 0;
|
2016-09-20 15:04:31 +00:00
|
|
|
|
2017-08-16 09:46:17 +00:00
|
|
|
while ((c = getopt_long (argc, argv, short_options, long_options, &option_index)) != -1)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
2018-11-15 13:35:51 +00:00
|
|
|
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;
|
2021-08-10 15:59:52 +00:00
|
|
|
case IDX_DEPRECATED_CHECK_DISABLE: user_options->deprecated_check_disable = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_LEFT: user_options->left = true; break;
|
|
|
|
case IDX_ADVICE_DISABLE: user_options->advice_disable = 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 = hc_strtoul (optarg, NULL, 10);
|
|
|
|
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 = hc_strtoul (optarg, NULL, 10); break;
|
|
|
|
case IDX_DEBUG_FILE: user_options->debug_file = optarg; break;
|
|
|
|
case IDX_ENCODING_FROM: user_options->encoding_from = optarg; break;
|
|
|
|
case IDX_ENCODING_TO: user_options->encoding_to = optarg; break;
|
|
|
|
case IDX_INDUCTION_DIR: user_options->induction_dir = optarg; break;
|
|
|
|
case IDX_OUTFILE_CHECK_DIR: user_options->outfile_check_dir = optarg; break;
|
2020-12-29 03:58:58 +00:00
|
|
|
case IDX_HASH_INFO: user_options->hash_info = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_FORCE: user_options->force = true; break;
|
|
|
|
case IDX_SELF_TEST_DISABLE: user_options->self_test_disable = true; break;
|
|
|
|
case IDX_SKIP: user_options->skip = hc_strtoull (optarg, NULL, 10);
|
|
|
|
user_options->skip_chgd = true; break;
|
|
|
|
case IDX_LIMIT: user_options->limit = hc_strtoull (optarg, NULL, 10);
|
|
|
|
user_options->limit_chgd = true; break;
|
|
|
|
case IDX_KEEP_GUESSING: user_options->keep_guessing = true; break;
|
|
|
|
case IDX_KEYSPACE: user_options->keyspace = true; break;
|
|
|
|
case IDX_BENCHMARK: user_options->benchmark = true; break;
|
|
|
|
case IDX_BENCHMARK_ALL: user_options->benchmark_all = true; break;
|
|
|
|
case IDX_STDOUT_FLAG: user_options->stdout_flag = true; break;
|
|
|
|
case IDX_STDIN_TIMEOUT_ABORT: user_options->stdin_timeout_abort = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->stdin_timeout_abort_chgd = true; break;
|
2021-06-11 17:25:39 +00:00
|
|
|
case IDX_IDENTIFY: user_options->identify = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_SPEED_ONLY: user_options->speed_only = true; break;
|
|
|
|
case IDX_PROGRESS_ONLY: user_options->progress_only = true; break;
|
|
|
|
case IDX_RESTORE_DISABLE: user_options->restore_disable = true; break;
|
|
|
|
case IDX_RESTORE_FILE_PATH: user_options->restore_file_path = optarg; break;
|
|
|
|
case IDX_STATUS: user_options->status = true; break;
|
2020-01-15 19:27:08 +00:00
|
|
|
case IDX_STATUS_JSON: user_options->status_json = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_STATUS_TIMER: user_options->status_timer = hc_strtoul (optarg, NULL, 10); break;
|
|
|
|
case IDX_MACHINE_READABLE: user_options->machine_readable = true; break;
|
|
|
|
case IDX_LOOPBACK: user_options->loopback = true; break;
|
|
|
|
case IDX_SESSION: user_options->session = optarg; break;
|
|
|
|
case IDX_HASH_MODE: user_options->hash_mode = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->hash_mode_chgd = true; break;
|
|
|
|
case IDX_RUNTIME: user_options->runtime = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->runtime_chgd = true; break;
|
|
|
|
case IDX_ATTACK_MODE: user_options->attack_mode = hc_strtoul (optarg, NULL, 10);
|
|
|
|
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 = hc_strtoul (optarg, NULL, 10); break;
|
|
|
|
case IDX_RP_GEN_FUNC_MIN: user_options->rp_gen_func_min = hc_strtoul (optarg, NULL, 10); break;
|
|
|
|
case IDX_RP_GEN_FUNC_MAX: user_options->rp_gen_func_max = hc_strtoul (optarg, NULL, 10); break;
|
2021-08-14 09:43:32 +00:00
|
|
|
case IDX_RP_GEN_FUNC_SEL: user_options->rp_gen_func_sel = optarg; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_RP_GEN_SEED: user_options->rp_gen_seed = hc_strtoul (optarg, NULL, 10);
|
|
|
|
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;
|
2021-07-07 08:32:08 +00:00
|
|
|
case IDX_MARKOV_INVERSE: user_options->markov_inverse = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_MARKOV_THRESHOLD: user_options->markov_threshold = hc_strtoul (optarg, NULL, 10); break;
|
|
|
|
case IDX_MARKOV_HCSTAT2: user_options->markov_hcstat2 = optarg; break;
|
|
|
|
case IDX_OUTFILE: user_options->outfile = optarg; break;
|
2020-01-24 17:43:13 +00:00
|
|
|
case IDX_OUTFILE_FORMAT: user_options->outfile_format = outfile_format_parse (optarg);
|
2018-11-15 13:35:51 +00:00
|
|
|
user_options->outfile_format_chgd = true; break;
|
|
|
|
case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = false; break;
|
|
|
|
case IDX_OUTFILE_CHECK_TIMER: user_options->outfile_check_timer = hc_strtoul (optarg, NULL, 10); break;
|
|
|
|
case IDX_WORDLIST_AUTOHEX_DISABLE: user_options->wordlist_autohex_disable = true; 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;
|
2020-01-03 10:51:24 +00:00
|
|
|
case IDX_BACKEND_IGNORE_CUDA: user_options->backend_ignore_cuda = true; break;
|
2021-07-09 03:50:40 +00:00
|
|
|
case IDX_BACKEND_IGNORE_HIP: user_options->backend_ignore_hip = true; break;
|
2020-01-03 10:51:24 +00:00
|
|
|
case IDX_BACKEND_IGNORE_OPENCL: user_options->backend_ignore_opencl = true; break;
|
2019-05-01 13:52:56 +00:00
|
|
|
case IDX_BACKEND_INFO: user_options->backend_info = true; break;
|
|
|
|
case IDX_BACKEND_DEVICES: user_options->backend_devices = optarg; break;
|
|
|
|
case IDX_BACKEND_VECTOR_WIDTH: user_options->backend_vector_width = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->backend_vector_width_chgd = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break;
|
|
|
|
case IDX_OPTIMIZED_KERNEL_ENABLE: user_options->optimized_kernel_enable = true; break;
|
2021-07-21 13:47:05 +00:00
|
|
|
case IDX_MULTIPLY_ACCEL_DISABLE: user_options->multiply_accel_disable = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_WORKLOAD_PROFILE: user_options->workload_profile = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->workload_profile_chgd = true; break;
|
|
|
|
case IDX_KERNEL_ACCEL: user_options->kernel_accel = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->kernel_accel_chgd = true; break;
|
|
|
|
case IDX_KERNEL_LOOPS: user_options->kernel_loops = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->kernel_loops_chgd = true; break;
|
|
|
|
case IDX_KERNEL_THREADS: user_options->kernel_threads = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->kernel_threads_chgd = true; break;
|
2018-11-20 11:32:24 +00:00
|
|
|
case IDX_SPIN_DAMP: user_options->spin_damp = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->spin_damp_chgd = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_HWMON_DISABLE: user_options->hwmon_disable = true; break;
|
|
|
|
case IDX_HWMON_TEMP_ABORT: user_options->hwmon_temp_abort = hc_strtoul (optarg, NULL, 10); break;
|
|
|
|
case IDX_LOGFILE_DISABLE: user_options->logfile_disable = true; break;
|
|
|
|
case IDX_HCCAPX_MESSAGE_PAIR: user_options->hccapx_message_pair = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->hccapx_message_pair_chgd = true; break;
|
|
|
|
case IDX_NONCE_ERROR_CORRECTIONS: user_options->nonce_error_corrections = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->nonce_error_corrections_chgd = true; break;
|
2018-11-25 17:21:07 +00:00
|
|
|
case IDX_KEYBOARD_LAYOUT_MAPPING: user_options->keyboard_layout_mapping = optarg; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_TRUECRYPT_KEYFILES: user_options->truecrypt_keyfiles = optarg; break;
|
|
|
|
case IDX_VERACRYPT_KEYFILES: user_options->veracrypt_keyfiles = optarg; break;
|
2020-02-08 11:24:47 +00:00
|
|
|
case IDX_VERACRYPT_PIM_START: user_options->veracrypt_pim_start = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->veracrypt_pim_start_chgd = true; break;
|
|
|
|
case IDX_VERACRYPT_PIM_STOP: user_options->veracrypt_pim_stop = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->veracrypt_pim_stop_chgd = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_SEGMENT_SIZE: user_options->segment_size = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->segment_size_chgd = true; break;
|
2021-04-16 18:17:53 +00:00
|
|
|
case IDX_SCRYPT_TMTO: user_options->scrypt_tmto = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->scrypt_tmto_chgd = true; break;
|
2021-07-22 16:54:02 +00:00
|
|
|
case IDX_SEPARATOR: user_options->separator = optarg;
|
|
|
|
user_options->separator_chgd = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_BITMAP_MIN: user_options->bitmap_min = hc_strtoul (optarg, NULL, 10); break;
|
|
|
|
case IDX_BITMAP_MAX: user_options->bitmap_max = hc_strtoul (optarg, NULL, 10); break;
|
2019-11-02 09:29:34 +00:00
|
|
|
case IDX_HOOK_THREADS: user_options->hook_threads = hc_strtoul (optarg, NULL, 10); break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_INCREMENT: user_options->increment = true; break;
|
|
|
|
case IDX_INCREMENT_MIN: user_options->increment_min = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->increment_min_chgd = true; break;
|
|
|
|
case IDX_INCREMENT_MAX: user_options->increment_max = hc_strtoul (optarg, NULL, 10);
|
|
|
|
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;
|
|
|
|
case IDX_SLOW_CANDIDATES: user_options->slow_candidates = true; break;
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_BRAIN_CLIENT: user_options->brain_client = true; break;
|
|
|
|
case IDX_BRAIN_CLIENT_FEATURES: user_options->brain_client_features = hc_strtoul (optarg, NULL, 10); break;
|
|
|
|
case IDX_BRAIN_SERVER: user_options->brain_server = true; break;
|
2020-01-11 09:46:11 +00:00
|
|
|
case IDX_BRAIN_SERVER_TIMER: user_options->brain_server_timer = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->brain_server_timer_chgd = true; break;
|
2018-11-15 13:35:51 +00:00
|
|
|
case IDX_BRAIN_PASSWORD: user_options->brain_password = optarg;
|
|
|
|
user_options->brain_password_chgd = true; break;
|
|
|
|
case IDX_BRAIN_HOST: user_options->brain_host = optarg;
|
|
|
|
user_options->brain_host_chgd = true; break;
|
|
|
|
case IDX_BRAIN_PORT: user_options->brain_port = hc_strtoul (optarg, NULL, 10);
|
|
|
|
user_options->brain_port_chgd = true; break;
|
|
|
|
case IDX_BRAIN_SESSION: user_options->brain_session = hc_strtoul (optarg, NULL, 16); break;
|
|
|
|
case IDX_BRAIN_SESSION_WHITELIST: user_options->brain_session_whitelist = optarg; break;
|
2018-10-28 15:47:13 +00:00
|
|
|
#endif
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2017-04-02 07:50:06 +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
|
|
|
{
|
2017-04-02 07:50:06 +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
|
|
|
}
|
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
if ((user_options->brain_client == true) && (user_options->brain_server == true))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can not have --brain-client and --brain-server at the same time");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-12-10 12:16:41 +00:00
|
|
|
if ((user_options->brain_client_features < 1) || (user_options->brain_client_features > 3))
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid --brain-client-feature argument");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((user_options->brain_client == true) && (user_options->brain_password_chgd == false))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Brain clients need to set --brain-password");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2020-01-11 09:46:11 +00:00
|
|
|
|
|
|
|
if (user_options->brain_server_timer_chgd)
|
|
|
|
{
|
|
|
|
if (user_options->brain_server == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "The --brain-server-timer flag requires --brain-server.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->brain_server_timer != 0) // special case (no intermediate dumps)
|
|
|
|
{
|
|
|
|
if (user_options->brain_server_timer < 60)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Brain server backup timer must be at least 60 seconds.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-10-28 15:47:13 +00:00
|
|
|
#endif
|
|
|
|
|
2021-07-22 16:54:02 +00:00
|
|
|
if (user_options->separator_chgd == true)
|
|
|
|
{
|
2022-01-13 16:53:04 +00:00
|
|
|
bool error = false;
|
|
|
|
if ((strlen (user_options->separator) != 1) && (strlen (user_options->separator) != 4))
|
2021-07-22 16:54:02 +00:00
|
|
|
{
|
2022-01-13 16:53:04 +00:00
|
|
|
error = true;
|
|
|
|
}
|
|
|
|
if (strlen (user_options->separator) == 4)
|
|
|
|
{
|
|
|
|
if ((user_options->separator[0] == '0') && (user_options->separator[1] == 'x'))
|
|
|
|
{
|
|
|
|
if (is_valid_hex_string((u8 * )(&(user_options->separator[2])),2)){
|
|
|
|
u8 sep = hex_to_u8((u8 * )(&(user_options->separator[2])));
|
|
|
|
user_options->separator[0] = sep;
|
|
|
|
user_options->separator[1] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
error = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
error = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (error){
|
|
|
|
event_log_error (hashcat_ctx, "Separator length has to be exactly 1 byte (single char or hex format e.g. 0x09 for TAB)");
|
2021-07-22 16:54:02 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-01 10:31:17 +00:00
|
|
|
if (user_options->slow_candidates == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2018-09-01 10:31:17 +00:00
|
|
|
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
2018-09-01 21:12:56 +00:00
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_COMBI)
|
2018-09-01 10:31:17 +00:00
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_BF))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid attack mode (-a) value specified in slow-candidates mode.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
2018-09-01 10:31:17 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
else if (user_options->brain_client == true)
|
|
|
|
{
|
|
|
|
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_COMBI)
|
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_BF))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid attack mode (-a) value specified in brain-client mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2018-09-01 10:31:17 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
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)
|
2020-09-29 13:56:32 +00:00
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_ASSOCIATION)
|
2018-09-01 10:31:17 +00:00
|
|
|
&& (user_options->attack_mode != ATTACK_MODE_NONE))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid attack mode (-a) value specified.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
|
2017-02-27 11:09:49 +00:00
|
|
|
if (user_options->hccapx_message_pair_chgd == true)
|
|
|
|
{
|
|
|
|
if (user_options->remove == true)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Combining --remove with --hccapx-message-pair is not allowed.");
|
2017-02-27 11:09:49 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->hccapx_message_pair >= 6)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --hccapx-message-pair value specified.");
|
2017-02-27 11:09:49 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-20 16:00:42 +00:00
|
|
|
/*
|
|
|
|
if (user_options->skip_chgd == true && user_options->skip == 0)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid --skip value specified.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (user_options->limit_chgd == true && user_options->limit == 0)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid --limit value specified.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-20 15:04:31 +00:00
|
|
|
if (user_options->runtime_chgd == true && user_options->runtime == 0)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --runtime value 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)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Combining --limit with --loopback is not allowed.");
|
2017-01-05 21:46:34 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-01-06 12:48:41 +00:00
|
|
|
if (user_options->hash_mode >= MODULE_HASH_MODES_MAXIMUM)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid -m (hash type) value specified.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-01-24 17:43:13 +00:00
|
|
|
if (user_options->outfile_format == 0)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --outfile-format value 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)
|
|
|
|
{
|
2020-01-24 17:43:13 +00:00
|
|
|
if (user_options->outfile_format > 1)
|
2016-10-25 09:36:17 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Combining --outfile-format > 1 with --left 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)
|
|
|
|
{
|
2020-01-24 17:43:13 +00:00
|
|
|
if (user_options->outfile_format & OUTFILE_FMT_CRACKPOS)
|
2020-01-23 08:03:22 +00:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Using crack_pos in --outfile-format for --show is not allowed.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-01-24 17:43:13 +00:00
|
|
|
if (user_options->outfile_format & OUTFILE_FMT_TIME_ABS)
|
2020-01-23 08:03:22 +00:00
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Using the absolute timestamp in --outfile-format for --show is not allowed.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-01-24 17:43:13 +00:00
|
|
|
if (user_options->outfile_format & OUTFILE_FMT_TIME_REL)
|
2016-10-25 09:36:17 +00:00
|
|
|
{
|
2020-01-23 08:03:22 +00:00
|
|
|
event_log_error (hashcat_ctx, "Using the relative timestamp in --outfile-format for --show 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)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --increment-min value specified.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->increment_max > INCREMENT_MAX)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --increment-max value specified.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-02-08 11:24:47 +00:00
|
|
|
if ((user_options->veracrypt_pim_start_chgd == true) && (user_options->veracrypt_pim_stop_chgd == false))
|
2019-03-15 20:48:49 +00:00
|
|
|
{
|
2021-06-06 18:47:18 +00:00
|
|
|
event_log_error (hashcat_ctx, "The--veracrypt-pim-start option requires --veracrypt-pim-stop as well.");
|
2019-03-15 20:48:49 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-02-08 11:24:47 +00:00
|
|
|
if ((user_options->veracrypt_pim_start_chgd == false) && (user_options->veracrypt_pim_stop_chgd == true))
|
2019-03-15 20:48:49 +00:00
|
|
|
{
|
2021-06-06 18:47:18 +00:00
|
|
|
event_log_error (hashcat_ctx, "The --veracrypt-pim-stop option requires --veracrypt-pim-start as well.");
|
2019-03-15 20:48:49 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->veracrypt_pim_start > user_options->veracrypt_pim_stop)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid --veracrypt-pim-start value specified.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-09-20 15:04:31 +00:00
|
|
|
if (user_options->increment_min > user_options->increment_max)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --increment-min value specified - must be >= --increment-max.");
|
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))
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Increment is not allowed in combination with --progress-only.");
|
2016-12-09 22:44:43 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-12-09 14:26:35 +00:00
|
|
|
if ((user_options->increment == true) && (user_options->speed_only == true))
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Increment is not allowed in combination with --speed-only.");
|
2016-12-09 14:26:35 +00:00
|
|
|
|
|
|
|
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
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Increment is not allowed in attack mode 0 (straight).");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->increment == true) && (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Increment is not allowed in attack mode 9 (association).");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((user_options->remove == true) && (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Remove is not allowed in attack mode 9 (association).");
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Increment-min is only supported when combined with -i/--increment.");
|
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
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Increment-max is only supported combined with -i/--increment.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-07-18 11:23:42 +00:00
|
|
|
if ((user_options->rp_files_cnt > 0) && (user_options->rp_gen > 0))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Combining -r/--rules-file and -g/--rules-generate is not supported.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-07-18 11:23:42 +00:00
|
|
|
if ((user_options->rp_files_cnt > 0) || (user_options->rp_gen > 0))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT) && (user_options->attack_mode != ATTACK_MODE_ASSOCIATION))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2021-06-06 18:47:18 +00:00
|
|
|
event_log_error (hashcat_ctx, "Use of -r/--rules-file and -g/--rules-generate requires attack mode 0 or 9.");
|
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)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --bitmap-min value 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)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --rp-gen-func-min value 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.");
|
2017-02-23 10:59:34 +00:00
|
|
|
|
|
|
|
event_log_warning (hashcat_ctx, "Please consider using the -w option instead.");
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_warning (hashcat_ctx, "You can use --force to override this, but do not report related errors.");
|
2017-02-23 10:59:34 +00:00
|
|
|
event_log_warning (hashcat_ctx, NULL);
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_accel < 1)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --kernel-accel value specified - must be greater than 0.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_accel > 1024)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --kernel-accel value specified - must be <= 1024.");
|
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.");
|
2017-02-23 10:59:34 +00:00
|
|
|
|
|
|
|
event_log_warning (hashcat_ctx, "Please consider using the -w option instead.");
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_warning (hashcat_ctx, "You can use --force to override this, but do not report related errors.");
|
2017-02-23 10:59:34 +00:00
|
|
|
event_log_warning (hashcat_ctx, NULL);
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_loops < 1)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid kernel-loops specified.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-08-29 08:28:42 +00:00
|
|
|
if (user_options->kernel_loops > 1024)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid kernel-loops specified.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-06 15:06:06 +00:00
|
|
|
if (user_options->kernel_threads_chgd == true)
|
|
|
|
{
|
|
|
|
if (user_options->force == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "The manual use of the -T option (or --kernel-threads) is outdated.");
|
|
|
|
|
|
|
|
event_log_warning (hashcat_ctx, "You can use --force to override this, but do not report related errors.");
|
|
|
|
event_log_warning (hashcat_ctx, NULL);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_threads < 1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid kernel-threads specified.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->kernel_threads > 1024)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Invalid kernel-threads specified.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-20 15:04:31 +00:00
|
|
|
if ((user_options->workload_profile < 1) || (user_options->workload_profile > 4))
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "workload-profile %u is not available.", user_options->workload_profile);
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
if (user_options->backend_vector_width_chgd == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
if (is_power_of_2 (user_options->backend_vector_width) == false || user_options->backend_vector_width > 16)
|
2016-09-21 14:07:49 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
event_log_error (hashcat_ctx, "backend-vector-width %u is not allowed.", user_options->backend_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
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Mixing --remove not allowed with --show or --left.");
|
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
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Mixing --potfile-disable is not allowed with --show or --left.");
|
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
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Mixing --outfile-autohex-disable is not allowed with --show.");
|
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
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Combining --show with --keyspace is not allowed.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2017-11-05 06:39:03 +00:00
|
|
|
|
|
|
|
if (user_options->left == true)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Combining --left with --keyspace is not allowed.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2019-04-06 22:35:33 +00:00
|
|
|
|
2019-03-27 11:53:34 +00:00
|
|
|
if (user_options->machine_readable == true)
|
|
|
|
{
|
|
|
|
if (user_options->status_json == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "The --status-json flag can not be used with --machine-readable.");
|
2019-04-06 22:35:33 +00:00
|
|
|
|
2019-03-27 11:53:34 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2019-04-06 22:35:33 +00:00
|
|
|
|
2016-09-20 15:04:31 +00:00
|
|
|
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
|
|
|
{
|
2019-03-27 11:53:34 +00:00
|
|
|
event_log_error (hashcat_ctx, "The --remove-timer flag requires --remove.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->remove_timer < 1)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "The --remove-timer parameter 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))
|
|
|
|
{
|
2021-06-06 18:47:18 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter --loopback requires either -r/--rules-file or -g/--rules-generate.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter --loopback is only allowed in attack mode 0 (straight).");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->debug_mode > 0)
|
|
|
|
{
|
2021-12-12 09:18:05 +00:00
|
|
|
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT) && (user_options->attack_mode != ATTACK_MODE_ASSOCIATION))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter --debug-mode option is only allowed in attack mode 0 (straight).");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((user_options->rp_files_cnt == 0) && (user_options->rp_gen == 0))
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Use of --debug-mode requires -r/--rules-file or -g/--rules-generate.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->debug_mode > 4)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --debug-mode value specified.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->debug_file != NULL)
|
|
|
|
{
|
|
|
|
if (user_options->debug_mode < 1)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Parameter --debug-file requires --debug-mode.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->induction_dir != NULL)
|
|
|
|
{
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Use of --induction-dir is not allowed in attack mode 3 (brute-force).");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2020-09-29 13:56:32 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Use of --induction-dir is not allowed in attack mode 9 (association).");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2016-09-20 15:04:31 +00:00
|
|
|
}
|
|
|
|
|
2018-11-20 11:32:24 +00:00
|
|
|
if (user_options->spin_damp > 100)
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2018-11-20 11:32:24 +00:00
|
|
|
event_log_error (hashcat_ctx, "Values of --spin-damp must be between 0 and 100 (inclusive).");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2021-06-12 08:47:48 +00:00
|
|
|
if (user_options->identify == true)
|
|
|
|
{
|
|
|
|
if (user_options->hash_mode_chgd == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --hash-type (-m) in identify mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 08:05:56 +00:00
|
|
|
if (user_options->benchmark == true)
|
2017-10-14 14:58:18 +00:00
|
|
|
{
|
2019-10-25 08:05:56 +00:00
|
|
|
// sanity checks based on automatically overwritten configuration variables by
|
|
|
|
// benchmark mode section in user_options_preprocess()
|
2017-10-14 14:58:18 +00:00
|
|
|
|
2019-10-25 08:05:56 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
if (user_options->brain_client == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Brain client (-z) is not allowed in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->brain_server == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Brain server is not allowed in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
2017-10-14 14:58:18 +00:00
|
|
|
|
2016-09-20 15:04:31 +00:00
|
|
|
if (user_options->attack_mode_chgd == true)
|
|
|
|
{
|
2019-10-25 08:05:56 +00:00
|
|
|
event_log_error (hashcat_ctx, "Can't change --attack-mode (-a) in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->bitmap_min != BITMAP_MIN)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --bitmap-min in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->bitmap_max != BITMAP_MAX)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --bitmap-max in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->hwmon_temp_abort != HWMON_TEMP_ABORT)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --hwmon-temp-abort in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->left == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --left in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->show == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --show in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->speed_only == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --speed-only in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->progress_only == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --progress-only in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2021-06-19 10:32:02 +00:00
|
|
|
if (user_options->hash_info == true)
|
|
|
|
{
|
2021-06-19 15:12:08 +00:00
|
|
|
event_log_error (hashcat_ctx, "Use of --hash-info is not allowed in benchmark mode.");
|
2021-06-19 10:32:02 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-10-25 08:05:56 +00:00
|
|
|
if (user_options->increment == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --increment (-i) in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->restore == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --restore in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->status == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --status in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->spin_damp_chgd == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Can't change --spin-damp in benchmark mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((user_options->custom_charset_1 != NULL)
|
|
|
|
|| (user_options->custom_charset_2 != NULL)
|
|
|
|
|| (user_options->custom_charset_3 != NULL)
|
|
|
|
|| (user_options->custom_charset_4 != NULL))
|
|
|
|
{
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
2016-09-20 15:04:31 +00:00
|
|
|
{
|
2019-10-25 08:05:56 +00:00
|
|
|
event_log_error (hashcat_ctx, "Custom charsets are not supported in benchmark mode.");
|
2016-09-20 15:04:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
|
2018-08-23 07:10:54 +00:00
|
|
|
if (user_options->markov_hcstat2 != NULL)
|
2017-03-19 13:18:11 +00:00
|
|
|
{
|
2018-08-23 07:10:54 +00:00
|
|
|
if (strlen (user_options->markov_hcstat2) == 0)
|
2017-03-19 13:18:11 +00:00
|
|
|
{
|
2018-08-23 07:10:54 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --markov-hcstat2 value - must not be empty.");
|
2017-03-19 13:18:11 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->restore_file_path != NULL)
|
|
|
|
{
|
|
|
|
if (strlen (user_options->restore_file_path) == 0)
|
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --restore-file-path value - must not be empty.");
|
2017-03-19 13:18:11 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->outfile != NULL)
|
|
|
|
{
|
|
|
|
if (strlen (user_options->outfile) == 0)
|
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --outfile value - must not be empty.");
|
2017-03-19 13:18:11 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->debug_file != NULL)
|
|
|
|
{
|
|
|
|
if (strlen (user_options->debug_file) == 0)
|
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --debug-file value - must not be empty.");
|
2017-03-19 13:18:11 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->session != NULL)
|
|
|
|
{
|
|
|
|
if (strlen (user_options->session) == 0)
|
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --session value - must not be empty.");
|
2017-03-19 13:18:11 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->cpu_affinity != NULL)
|
|
|
|
{
|
|
|
|
if (strlen (user_options->cpu_affinity) == 0)
|
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --cpu-affinity value - must not be empty.");
|
2017-03-19 13:18:11 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
if (user_options->backend_devices != NULL)
|
2017-03-19 13:18:11 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
if (strlen (user_options->backend_devices) == 0)
|
2017-03-19 13:18:11 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --backend-devices value - must not be empty.");
|
2017-03-19 13:18:11 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->opencl_device_types != NULL)
|
|
|
|
{
|
|
|
|
if (strlen (user_options->opencl_device_types) == 0)
|
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Invalid --opencl-device-types value - must not be empty.");
|
2017-03-19 13:18:11 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2019-04-06 22:35:33 +00:00
|
|
|
|
2018-10-31 10:37:06 +00:00
|
|
|
if (user_options->stdin_timeout_abort_chgd == true)
|
|
|
|
{
|
|
|
|
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Use of --stdin-timeout-abort is only allowed in attack mode 0 (straight).");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --stdin-timeout-abort can only be used in stdin mode
|
|
|
|
|
|
|
|
if (user_options->hc_argc != 1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Use of --stdin-timeout-abort is only allowed in stdin mode (pipe).");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
if ((user_options->brain_client == true) && (user_options->remove == true))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Using --remove is not allowed if --brain-client is used.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((user_options->brain_client == true) && (user_options->potfile_disable == true))
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Using --potfile-disable is not allowed if --brain-client is used.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-02-10 08:08:19 +00:00
|
|
|
// custom charset checks
|
|
|
|
|
|
|
|
if ((user_options->custom_charset_1 != NULL)
|
|
|
|
|| (user_options->custom_charset_2 != NULL)
|
|
|
|
|| (user_options->custom_charset_3 != NULL)
|
|
|
|
|| (user_options->custom_charset_4 != NULL))
|
|
|
|
{
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
2017-04-02 08:18:59 +00:00
|
|
|
event_log_error (hashcat_ctx, "Custom charsets are not supported in attack mode 0 (straight).");
|
2017-02-10 08:08:19 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2017-11-05 06:39:03 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
2017-02-10 08:08:19 +00:00
|
|
|
{
|
2018-10-04 19:31:13 +00:00
|
|
|
event_log_error (hashcat_ctx, "Custom charsets are not supported in attack mode 1 (combination).");
|
2017-02-10 08:08:19 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Custom charsets are not supported in attack mode 9 (association).");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-03-11 07:25:58 +00:00
|
|
|
// detect if mask was specified:
|
|
|
|
|
|
|
|
bool mask_is_missing = true;
|
|
|
|
|
|
|
|
if (user_options->keyspace == true) // special case if --keyspace was used: we need the mask but no hash file
|
2017-02-10 08:08:19 +00:00
|
|
|
{
|
2017-03-11 07:25:58 +00:00
|
|
|
if (user_options->hc_argc > 0) mask_is_missing = false;
|
|
|
|
}
|
|
|
|
else if (user_options->stdout_flag == true) // special case if --stdout was used: we need the mask but no hash file
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc > 0) mask_is_missing = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc > 1) mask_is_missing = false;
|
|
|
|
}
|
2017-02-10 08:08:19 +00:00
|
|
|
|
2017-03-11 07:25:58 +00:00
|
|
|
if (mask_is_missing == true)
|
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "If you specify a custom charset, you must also specify a mask.");
|
2017-03-11 07:25:58 +00:00
|
|
|
|
|
|
|
return -1;
|
2017-02-10 08:08:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
else if (user_options->brain_server == true)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
#endif
|
2016-10-02 23:30:58 +00:00
|
|
|
else if (user_options->benchmark == true)
|
2016-10-02 21:30:31 +00:00
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 0)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
2020-12-29 03:58:58 +00:00
|
|
|
else if (user_options->hash_info == true)
|
2017-08-22 09:09:46 +00:00
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 0)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
2019-05-01 13:52:56 +00:00
|
|
|
else if (user_options->backend_info == true)
|
2016-09-21 14:07:49 +00:00
|
|
|
{
|
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;
|
|
|
|
}
|
|
|
|
}
|
2020-09-29 13:56:32 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
if (user_options->hc_argc == 1)
|
|
|
|
{
|
|
|
|
show_error = false;
|
|
|
|
}
|
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
}
|
|
|
|
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
|
|
|
}
|
2020-09-29 13:56:32 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
2018-10-20 16:00:42 +00:00
|
|
|
|
|
|
|
if (user_options->hc_argc == 1)
|
|
|
|
{
|
|
|
|
// stdin mode
|
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
if (user_options->brain_client == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Use of --brain-client is not possible in stdin mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-10-20 16:00:42 +00:00
|
|
|
if (user_options->slow_candidates == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Use of --slow-candidates is not possible in stdin mode.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
2020-09-29 13:56:32 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2017-03-02 18:57:34 +00:00
|
|
|
void user_options_session_auto (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2017-03-07 13:41:58 +00:00
|
|
|
if (strcmp (user_options->session, PROGNAME) == 0)
|
2017-03-02 18:57:34 +00:00
|
|
|
{
|
|
|
|
if (user_options->benchmark == true)
|
|
|
|
{
|
|
|
|
user_options->session = "benchmark";
|
|
|
|
}
|
|
|
|
|
2020-12-29 03:58:58 +00:00
|
|
|
if (user_options->hash_info == true)
|
2017-08-22 09:09:46 +00:00
|
|
|
{
|
2020-12-29 03:58:58 +00:00
|
|
|
user_options->session = "hash_info";
|
2017-08-22 09:09:46 +00:00
|
|
|
}
|
|
|
|
|
2019-01-06 12:23:45 +00:00
|
|
|
if (user_options->usage == true)
|
|
|
|
{
|
|
|
|
user_options->session = "usage";
|
|
|
|
}
|
|
|
|
|
2017-03-02 18:57:34 +00:00
|
|
|
if (user_options->speed_only == true)
|
|
|
|
{
|
2017-08-22 09:09:46 +00:00
|
|
|
user_options->session = "speed_only";
|
2017-03-02 18:57:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->progress_only == true)
|
|
|
|
{
|
2017-08-22 09:09:46 +00:00
|
|
|
user_options->session = "progress_only";
|
2017-03-02 18:57:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->keyspace == true)
|
|
|
|
{
|
|
|
|
user_options->session = "keyspace";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->stdout_flag == true)
|
|
|
|
{
|
|
|
|
user_options->session = "stdout";
|
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
if (user_options->backend_info == true)
|
2017-03-02 18:57:34 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
user_options->session = "backend_info";
|
2017-03-02 18:57:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->show == true)
|
|
|
|
{
|
|
|
|
user_options->session = "show";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->left == true)
|
|
|
|
{
|
|
|
|
user_options->session = "left";
|
|
|
|
}
|
2021-06-12 08:47:48 +00:00
|
|
|
|
|
|
|
if (user_options->identify == true)
|
|
|
|
{
|
|
|
|
user_options->session = "identify";
|
|
|
|
}
|
2017-03-02 18:57:34 +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
|
|
|
// some options can influence or overwrite other options
|
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
if (user_options->brain_client == true)
|
|
|
|
{
|
|
|
|
user_options->slow_candidates = true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-11-01 11:21:32 +00:00
|
|
|
if (user_options->stdout_flag)
|
|
|
|
{
|
2018-11-09 11:48:27 +00:00
|
|
|
user_options->hwmon_disable = true;
|
2018-11-01 11:21:32 +00:00
|
|
|
user_options->left = false;
|
|
|
|
user_options->logfile_disable = true;
|
2018-11-20 11:32:24 +00:00
|
|
|
user_options->spin_damp = 0;
|
2018-11-01 11:21:32 +00:00
|
|
|
user_options->outfile_check_timer = 0;
|
|
|
|
user_options->potfile_disable = true;
|
|
|
|
user_options->restore_disable = true;
|
|
|
|
user_options->restore = false;
|
|
|
|
user_options->restore_timer = 0;
|
|
|
|
user_options->show = false;
|
|
|
|
user_options->status = false;
|
|
|
|
user_options->status_timer = 0;
|
|
|
|
user_options->bitmap_min = 1;
|
|
|
|
user_options->bitmap_max = 1;
|
|
|
|
}
|
|
|
|
|
2020-12-29 06:56:20 +00:00
|
|
|
if (user_options->hash_info == true
|
2019-05-01 13:52:56 +00:00
|
|
|
|| user_options->backend_info == true
|
2017-08-22 09:09:46 +00:00
|
|
|
|| user_options->keyspace == true
|
|
|
|
|| user_options->speed_only == true
|
2019-01-06 12:23:45 +00:00
|
|
|
|| user_options->progress_only == true
|
2021-06-12 08:47:48 +00:00
|
|
|
|| user_options->identify == true
|
2019-01-06 12:23:45 +00:00
|
|
|
|| user_options->usage == true)
|
2016-09-21 09:09:12 +00:00
|
|
|
{
|
2018-11-09 11:48:27 +00:00
|
|
|
user_options->hwmon_disable = true;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->left = false;
|
|
|
|
user_options->logfile_disable = true;
|
2018-11-20 11:32:24 +00:00
|
|
|
user_options->spin_damp = 0;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->outfile_check_timer = 0;
|
2016-10-02 21:30:31 +00:00
|
|
|
user_options->potfile_disable = true;
|
|
|
|
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;
|
2018-08-24 10:59:28 +00:00
|
|
|
user_options->bitmap_min = 1;
|
|
|
|
user_options->bitmap_max = 1;
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
user_options->brain_client = false;
|
|
|
|
#endif
|
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;
|
2018-11-17 13:40:30 +00:00
|
|
|
user_options->hwmon_temp_abort = 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;
|
2018-11-20 11:32:24 +00:00
|
|
|
user_options->spin_damp = 0;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->potfile_disable = true;
|
2017-07-18 11:23:42 +00:00
|
|
|
user_options->progress_only = false;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->restore_disable = true;
|
|
|
|
user_options->restore = false;
|
|
|
|
user_options->restore_timer = 0;
|
|
|
|
user_options->show = false;
|
2017-07-18 11:23:42 +00:00
|
|
|
user_options->speed_only = true;
|
2016-11-10 16:50:29 +00:00
|
|
|
user_options->status = false;
|
|
|
|
user_options->status_timer = 0;
|
2018-08-24 10:59:28 +00:00
|
|
|
user_options->bitmap_min = 1;
|
|
|
|
user_options->bitmap_max = 1;
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
user_options->brain_client = false;
|
|
|
|
#endif
|
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
|
|
|
{
|
2017-07-18 11:23:42 +00:00
|
|
|
user_options->optimized_kernel_enable = true;
|
|
|
|
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
|
|
|
|
2020-12-29 03:58:58 +00:00
|
|
|
if (user_options->hash_info == true)
|
2017-08-22 09:09:46 +00:00
|
|
|
{
|
|
|
|
user_options->quiet = true;
|
|
|
|
}
|
|
|
|
|
2019-01-06 12:23:45 +00:00
|
|
|
if (user_options->usage == true)
|
|
|
|
{
|
|
|
|
user_options->quiet = true;
|
|
|
|
}
|
|
|
|
|
2016-12-09 22:44:43 +00:00
|
|
|
if (user_options->progress_only == true)
|
|
|
|
{
|
2017-07-18 11:23:42 +00:00
|
|
|
user_options->speed_only = true;
|
2016-12-09 22:44:43 +00:00
|
|
|
}
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->keyspace == true)
|
|
|
|
{
|
2017-07-18 11:23:42 +00:00
|
|
|
user_options->quiet = true;
|
2016-10-02 21:30:31 +00:00
|
|
|
}
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2018-09-01 10:31:17 +00:00
|
|
|
if (user_options->slow_candidates == true)
|
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
user_options->backend_vector_width = 1;
|
2018-09-01 10:31:17 +00:00
|
|
|
}
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->stdout_flag == true)
|
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
user_options->force = true;
|
|
|
|
user_options->hash_mode = 2000;
|
|
|
|
user_options->kernel_accel = 1024;
|
|
|
|
user_options->backend_vector_width = 1;
|
2020-01-24 17:43:13 +00:00
|
|
|
user_options->outfile_format = OUTFILE_FMT_PLAIN;
|
2019-05-01 13:52:56 +00:00
|
|
|
user_options->quiet = true;
|
2017-08-23 10:43:59 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
|
|
|
user_options->kernel_loops = KERNEL_RULES;
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
|
|
|
{
|
|
|
|
user_options->kernel_loops = KERNEL_COMBS;
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
{
|
|
|
|
user_options->kernel_loops = KERNEL_BFS;
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
|
|
|
{
|
|
|
|
user_options->kernel_loops = KERNEL_COMBS;
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
|
|
|
{
|
|
|
|
user_options->kernel_loops = KERNEL_COMBS;
|
|
|
|
}
|
2020-09-29 13:56:32 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
user_options->kernel_loops = KERNEL_RULES;
|
|
|
|
}
|
2016-10-02 21:30:31 +00:00
|
|
|
}
|
2016-09-21 09:09:12 +00:00
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
if (user_options->backend_info == true)
|
2016-10-02 21:30:31 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
user_options->backend_devices = NULL;
|
2016-11-20 21:54:52 +00:00
|
|
|
user_options->opencl_device_types = hcstrdup ("1,2,3");
|
2017-07-18 11:23:42 +00:00
|
|
|
user_options->quiet = true;
|
2016-09-21 09:09:12 +00:00
|
|
|
}
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
if (user_options->left == true)
|
|
|
|
{
|
2020-01-24 17:43:13 +00:00
|
|
|
user_options->outfile_format = OUTFILE_FMT_HASH;
|
2016-10-02 21:30:31 +00:00
|
|
|
}
|
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->markov_threshold == 0)
|
|
|
|
{
|
|
|
|
user_options->markov_threshold = 0x100;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->segment_size_chgd == true)
|
|
|
|
{
|
|
|
|
user_options->segment_size *= (1024 * 1024);
|
|
|
|
}
|
|
|
|
|
2018-08-28 20:28:44 +00:00
|
|
|
#if !defined (WITH_HWMON)
|
2018-11-09 11:48:27 +00:00
|
|
|
user_options->hwmon_disable = true;
|
2018-08-28 20:28:44 +00:00
|
|
|
#endif // WITH_HWMON
|
|
|
|
|
2018-11-09 11:48:27 +00:00
|
|
|
if (user_options->hwmon_disable == true)
|
2016-10-02 21:30:31 +00:00
|
|
|
{
|
2018-11-09 11:48:27 +00:00
|
|
|
user_options->hwmon_temp_abort = 0;
|
2016-10-02 21:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// default mask
|
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
|
|
|
{
|
2020-12-29 06:56:20 +00:00
|
|
|
if (user_options->hash_info == true)
|
2017-08-22 09:09:46 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2019-05-01 13:52:56 +00:00
|
|
|
else if (user_options->backend_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
|
|
|
}
|
2020-09-29 13:56:32 +00:00
|
|
|
|
|
|
|
// association limitations
|
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
user_options->potfile_disable = true;
|
|
|
|
}
|
2021-06-06 10:29:07 +00:00
|
|
|
|
2021-06-06 13:48:04 +00:00
|
|
|
if (user_options->stdout_flag == false && user_options->benchmark == false && user_options->keyspace == false)
|
2021-06-06 10:29:07 +00:00
|
|
|
{
|
|
|
|
if (user_options->hash_mode == 0 && user_options->hash_mode_chgd == false)
|
|
|
|
{
|
|
|
|
user_options->autodetect = true;
|
|
|
|
}
|
|
|
|
}
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-14 10:54:34 +00:00
|
|
|
void user_options_info (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
if (user_options->quiet == true) return;
|
|
|
|
|
2017-10-14 14:58:18 +00:00
|
|
|
if (user_options->benchmark == false) return;
|
|
|
|
|
2017-10-14 10:54:34 +00:00
|
|
|
if (user_options->machine_readable == false)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "Benchmark relevant options:");
|
|
|
|
event_log_info (hashcat_ctx, "===========================");
|
|
|
|
|
2017-12-05 10:08:59 +00:00
|
|
|
if (user_options->benchmark_all == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "* --benchmark-all");
|
|
|
|
}
|
|
|
|
|
2017-10-14 10:54:34 +00:00
|
|
|
if (user_options->force == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "* --force");
|
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
if (user_options->backend_devices)
|
2017-10-14 10:54:34 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
event_log_info (hashcat_ctx, "* --backend-devices=%s", user_options->backend_devices);
|
2017-10-14 10:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->opencl_device_types)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "* --opencl-device-types=%s", user_options->opencl_device_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->optimized_kernel_enable == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "* --optimized-kernel-enable");
|
|
|
|
}
|
|
|
|
|
2021-07-21 13:47:05 +00:00
|
|
|
if (user_options->multiply_accel_disable == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "* --multiply-accel-disable");
|
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
if (user_options->backend_vector_width_chgd == true)
|
2017-10-14 10:54:34 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
event_log_info (hashcat_ctx, "* --backend-vector-width=%u", user_options->backend_vector_width);
|
2017-10-14 10:54:34 +00:00
|
|
|
}
|
|
|
|
|
2018-11-06 15:06:06 +00:00
|
|
|
if (user_options->kernel_accel_chgd == true)
|
2017-10-14 10:54:34 +00:00
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "* --kernel-accel=%u", user_options->kernel_accel);
|
2018-11-06 15:06:06 +00:00
|
|
|
}
|
|
|
|
else if (user_options->kernel_loops_chgd == true)
|
|
|
|
{
|
2017-10-14 10:54:34 +00:00
|
|
|
event_log_info (hashcat_ctx, "* --kernel-loops=%u", user_options->kernel_loops);
|
|
|
|
}
|
2018-11-06 15:06:06 +00:00
|
|
|
else if (user_options->kernel_threads_chgd == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "* --kernel-threads=%u", user_options->kernel_threads);
|
|
|
|
}
|
2017-10-14 10:54:34 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (user_options->workload_profile_chgd == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "* --workload-profile=%u", user_options->workload_profile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
event_log_info (hashcat_ctx, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-12-05 10:08:59 +00:00
|
|
|
if (user_options->benchmark_all == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "# option: --benchmark-all");
|
|
|
|
}
|
|
|
|
|
2017-10-14 10:54:34 +00:00
|
|
|
if (user_options->force == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "# option: --force");
|
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
if (user_options->backend_devices)
|
2017-10-14 10:54:34 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
event_log_info (hashcat_ctx, "# option: --backend-devices=%s", user_options->backend_devices);
|
2017-10-14 10:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->opencl_device_types)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "# option: --opencl-device-types=%s", user_options->opencl_device_types);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (user_options->optimized_kernel_enable == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "# option: --optimized-kernel-enable");
|
|
|
|
}
|
|
|
|
|
2021-07-21 13:47:05 +00:00
|
|
|
if (user_options->multiply_accel_disable == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "# option: --multiply-accel-disable");
|
|
|
|
}
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
if (user_options->backend_vector_width_chgd == true)
|
2017-10-14 10:54:34 +00:00
|
|
|
{
|
2019-05-01 13:52:56 +00:00
|
|
|
event_log_info (hashcat_ctx, "# option: --backend-vector-width=%u", user_options->backend_vector_width);
|
2017-10-14 10:54:34 +00:00
|
|
|
}
|
|
|
|
|
2018-11-06 15:06:06 +00:00
|
|
|
if (user_options->kernel_accel_chgd == true)
|
2017-10-14 10:54:34 +00:00
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "# option: --kernel-accel=%u", user_options->kernel_accel);
|
2018-11-06 15:06:06 +00:00
|
|
|
}
|
|
|
|
else if (user_options->kernel_loops_chgd == true)
|
|
|
|
{
|
2017-10-14 10:54:34 +00:00
|
|
|
event_log_info (hashcat_ctx, "# option: --kernel-loops=%u", user_options->kernel_loops);
|
|
|
|
}
|
2018-11-06 15:06:06 +00:00
|
|
|
else if (user_options->kernel_threads_chgd == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "# option: --kernel-threads=%u", user_options->kernel_threads);
|
|
|
|
}
|
2017-10-14 10:54:34 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (user_options->workload_profile_chgd == true)
|
|
|
|
{
|
|
|
|
event_log_info (hashcat_ctx, "# option: --workload-profile=%u", user_options->workload_profile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
2021-07-22 16:54:02 +00:00
|
|
|
// separator
|
|
|
|
|
|
|
|
if (user_options->separator)
|
|
|
|
{
|
|
|
|
user_options_extra->separator = user_options->separator[0];
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2021-07-22 16:54:02 +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;
|
|
|
|
case ATTACK_MODE_ASSOCIATION: user_options_extra->attack_kern = ATTACK_KERN_STRAIGHT; break;
|
2016-10-02 21:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
{
|
|
|
|
|
2017-08-22 09:09:46 +00:00
|
|
|
}
|
2020-12-29 03:58:58 +00:00
|
|
|
else if (user_options->hash_info == true)
|
2017-08-22 09:09:46 +00:00
|
|
|
{
|
|
|
|
|
2016-10-02 21:30:31 +00:00
|
|
|
}
|
2019-05-01 13:52:56 +00:00
|
|
|
else if (user_options->backend_info == true)
|
2016-10-02 21:30:31 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
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;
|
2018-09-01 10:31:17 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
2016-10-06 19:37:03 +00:00
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
2018-09-01 10:31:17 +00:00
|
|
|
if (user_options->slow_candidates == true)
|
2016-10-06 19:37:03 +00:00
|
|
|
{
|
2018-09-01 10:31:17 +00:00
|
|
|
return 1;
|
2016-10-06 19:37:03 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
|
|
|
|
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT)
|
2016-10-06 19:37:03 +00:00
|
|
|
{
|
2019-08-04 02:09:07 +00:00
|
|
|
if (straight_ctx->kernel_rules_cnt)
|
2016-10-06 19:37:03 +00:00
|
|
|
{
|
2019-08-04 02:09:07 +00:00
|
|
|
return straight_ctx->kernel_rules_cnt;
|
2016-10-06 19:37:03 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
}
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI)
|
|
|
|
{
|
|
|
|
if (combinator_ctx->combs_cnt)
|
2016-10-06 19:37:03 +00:00
|
|
|
{
|
2019-08-04 02:09:07 +00:00
|
|
|
return combinator_ctx->combs_cnt;
|
2018-09-01 10:31:17 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
}
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_BF)
|
|
|
|
{
|
|
|
|
if (mask_ctx->bfs_cnt)
|
2018-09-01 10:31:17 +00:00
|
|
|
{
|
2019-08-04 02:09:07 +00:00
|
|
|
return mask_ctx->bfs_cnt;
|
2016-10-06 19:37:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
// brain
|
|
|
|
|
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
if (user_options->brain_host)
|
|
|
|
{
|
|
|
|
struct addrinfo hints;
|
|
|
|
|
|
|
|
memset (&hints, 0, sizeof (hints));
|
|
|
|
|
|
|
|
hints.ai_family = AF_INET;
|
|
|
|
hints.ai_socktype = SOCK_STREAM;
|
|
|
|
|
|
|
|
struct addrinfo *address_info = NULL;
|
|
|
|
|
|
|
|
const int rc_getaddrinfo = getaddrinfo (user_options->brain_host, NULL, &hints, &address_info);
|
|
|
|
|
|
|
|
if (rc_getaddrinfo != 0)
|
|
|
|
{
|
|
|
|
fprintf (stderr, "%s: %s\n", user_options->brain_host, gai_strerror (rc_getaddrinfo));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
freeaddrinfo (address_info);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
// common folders
|
|
|
|
|
2017-12-02 14:24:10 +00:00
|
|
|
#if defined (_WIN)
|
|
|
|
if (hc_path_read (".") == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", ".", strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#else
|
2017-01-27 13:50:39 +00:00
|
|
|
if (hc_path_read (folder_config->cwd) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", folder_config->cwd, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2017-12-02 14:24:10 +00:00
|
|
|
#endif
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
if (hc_path_read (folder_config->install_dir) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", folder_config->install_dir, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_read (folder_config->profile_dir) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", folder_config->profile_dir, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_write (folder_config->session_dir) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", folder_config->session_dir, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_read (folder_config->shared_dir) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", folder_config->shared_dir, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_read (folder_config->cpath_real) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", folder_config->cpath_real, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// hashfile - can be NULL
|
|
|
|
|
|
|
|
if (user_options_extra->hc_hash != NULL)
|
|
|
|
{
|
2017-01-27 22:18:22 +00:00
|
|
|
if (hc_path_exist (user_options_extra->hc_hash) == true)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (user_options_extra->hc_hash) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a hashfile argument.", user_options_extra->hc_hash);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 22:18:22 +00:00
|
|
|
if (hc_path_read (user_options_extra->hc_hash) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", user_options_extra->hc_hash, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 22:18:22 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2018-07-30 11:23:48 +00:00
|
|
|
|
|
|
|
if (hc_path_has_bom (user_options_extra->hc_hash) == true)
|
|
|
|
{
|
2021-06-29 18:42:22 +00:00
|
|
|
event_log_warning (hashcat_ctx, "%s: Byte Order Mark (BOM) was detected", user_options_extra->hc_hash);
|
2018-07-30 11:23:48 +00:00
|
|
|
|
2021-06-29 18:42:22 +00:00
|
|
|
//return -1;
|
2018-07-30 11:23:48 +00:00
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", wlfile, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", rp_file, strerror (errno));
|
2017-01-27 15:34:48 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2017-03-19 12:59:36 +00:00
|
|
|
|
2017-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (rp_file) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a rulefile argument.", rp_file);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_read (rp_file) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", rp_file, strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2018-07-30 11:23:48 +00:00
|
|
|
|
|
|
|
if (hc_path_has_bom (rp_file) == true)
|
|
|
|
{
|
2021-06-29 18:42:22 +00:00
|
|
|
event_log_warning (hashcat_ctx, "%s: Byte Order Mark (BOM) was detected", rp_file);
|
2018-07-30 11:23:48 +00:00
|
|
|
|
2021-06-29 18:42:22 +00:00
|
|
|
//return -1;
|
2018-07-30 11:23:48 +00:00
|
|
|
}
|
2017-01-27 15:34:48 +00:00
|
|
|
}
|
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-03-19 12:59:36 +00:00
|
|
|
if (hc_path_exist (dictfile1) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (dictfile1) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a wordlist argument.", dictfile1);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (dictfile1) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
|
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
|
|
|
|
2018-07-30 11:23:48 +00:00
|
|
|
if (hc_path_has_bom (dictfile1) == true)
|
|
|
|
{
|
2021-06-29 18:42:22 +00:00
|
|
|
event_log_warning (hashcat_ctx, "%s: Byte Order Mark (BOM) was detected", dictfile1);
|
2018-07-30 11:23:48 +00:00
|
|
|
|
2021-06-29 18:42:22 +00:00
|
|
|
//return -1;
|
2018-07-30 11:23:48 +00:00
|
|
|
}
|
|
|
|
|
2017-03-19 12:59:36 +00:00
|
|
|
if (hc_path_exist (dictfile2) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (dictfile2) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a wordlist argument.", dictfile2);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (dictfile2) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
|
2017-01-27 14:06:31 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2018-07-30 11:23:48 +00:00
|
|
|
|
|
|
|
if (hc_path_has_bom (dictfile2) == true)
|
|
|
|
{
|
2021-06-29 18:42:22 +00:00
|
|
|
event_log_warning (hashcat_ctx, "%s: Byte Order Mark (BOM) was detected", dictfile2);
|
2018-07-30 11:23:48 +00:00
|
|
|
|
2021-06-29 18:42:22 +00:00
|
|
|
//return -1;
|
2018-07-30 11:23:48 +00:00
|
|
|
}
|
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-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (maskfile) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a maskfile argument.", maskfile);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (maskfile) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", maskfile, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2018-07-30 11:23:48 +00:00
|
|
|
|
|
|
|
if (hc_path_has_bom (maskfile) == true)
|
|
|
|
{
|
2021-06-29 18:42:22 +00:00
|
|
|
event_log_warning (hashcat_ctx, "%s: Byte Order Mark (BOM) was detected", maskfile);
|
2018-07-30 11:23:48 +00:00
|
|
|
|
2021-06-29 18:42:22 +00:00
|
|
|
//return -1;
|
2018-07-30 11:23:48 +00:00
|
|
|
}
|
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)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", wlfile, strerror (errno));
|
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-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (maskfile) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a maskfile argument.", maskfile);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (maskfile) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", maskfile, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2018-07-30 11:23:48 +00:00
|
|
|
|
|
|
|
if (hc_path_has_bom (maskfile) == true)
|
|
|
|
{
|
2021-06-29 18:42:22 +00:00
|
|
|
event_log_warning (hashcat_ctx, "%s: Byte Order Mark (BOM) was detected", maskfile);
|
2018-07-30 11:23:48 +00:00
|
|
|
|
2021-06-29 18:42:22 +00:00
|
|
|
//return -1;
|
2018-07-30 11:23:48 +00:00
|
|
|
}
|
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)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", wlfile, strerror (errno));
|
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-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (maskfile) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a maskfile argument.", maskfile);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_read (maskfile) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", maskfile, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2018-07-30 11:23:48 +00:00
|
|
|
|
|
|
|
if (hc_path_has_bom (maskfile) == true)
|
|
|
|
{
|
2021-06-29 18:42:22 +00:00
|
|
|
event_log_warning (hashcat_ctx, "%s: Byte Order Mark (BOM) was detected", maskfile);
|
2018-07-30 11:23:48 +00:00
|
|
|
|
2021-06-29 18:42:22 +00:00
|
|
|
//return -1;
|
2018-07-30 11:23:48 +00:00
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-09-29 13:56:32 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
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: %s", wlfile, strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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: %s", rp_file, strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_is_directory (rp_file) == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a rulefile argument.", rp_file);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_read (rp_file) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", rp_file, strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hc_path_has_bom (rp_file) == true)
|
|
|
|
{
|
2021-06-29 18:42:22 +00:00
|
|
|
event_log_warning (hashcat_ctx, "%s: Byte Order Mark (BOM) was detected", rp_file);
|
2020-09-29 13:56:32 +00:00
|
|
|
|
2021-06-29 18:42:22 +00:00
|
|
|
//return -1;
|
2020-09-29 13:56:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
// logfile
|
|
|
|
|
|
|
|
if (logfile_ctx->enabled == true)
|
|
|
|
{
|
|
|
|
if (hc_path_exist (logfile_ctx->logfile) == true)
|
|
|
|
{
|
2017-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (logfile_ctx->logfile) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a logfile argument.", logfile_ctx->logfile);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
if (hc_path_write (logfile_ctx->logfile) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", logfile_ctx->logfile, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 23:08:12 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (hc_path_create (logfile_ctx->logfile) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", logfile_ctx->logfile, strerror (errno));
|
2017-01-27 23:08:12 +00:00
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// outfile_check
|
|
|
|
|
|
|
|
if (outcheck_ctx->enabled == true)
|
|
|
|
{
|
|
|
|
if (hc_path_exist (outcheck_ctx->root_directory) == true)
|
|
|
|
{
|
2017-03-19 12:59:36 +00:00
|
|
|
if (hc_path_is_directory (outcheck_ctx->root_directory) == false)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "Directory specified in outfile-check '%s' is not a directory.", outcheck_ctx->root_directory);
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// outfile - can be NULL
|
|
|
|
|
|
|
|
if (outfile_ctx->filename != NULL)
|
|
|
|
{
|
2017-01-27 22:44:49 +00:00
|
|
|
if (hc_path_exist (outfile_ctx->filename) == true)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (outfile_ctx->filename) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as an outfile.", outfile_ctx->filename);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 22:44:49 +00:00
|
|
|
if (hc_path_write (outfile_ctx->filename) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", outfile_ctx->filename, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 23:08:12 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (hc_path_create (outfile_ctx->filename) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", outfile_ctx->filename, strerror (errno));
|
2017-01-27 23:08:12 +00:00
|
|
|
|
2017-01-27 22:44:49 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
2017-01-27 22:44:49 +00:00
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
// check for outfile vs. hashfile
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
if (hc_same_files (outfile_ctx->filename, user_options_extra->hc_hash) == true)
|
2017-01-27 22:44:49 +00:00
|
|
|
{
|
2017-10-10 09:30:20 +00:00
|
|
|
event_log_error (hashcat_ctx, "Outfile and hashfile cannot point to the same file.");
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-02-14 15:25:38 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
// check for outfile vs. cached wordlists
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < user_options_extra->hc_workc; i++)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-10-10 09:30:20 +00:00
|
|
|
char *wlfile = user_options_extra->hc_workv[i];
|
|
|
|
|
|
|
|
if (hc_same_files (outfile_ctx->filename, wlfile) == true)
|
2017-02-14 15:25:38 +00:00
|
|
|
{
|
2017-10-10 09:30:20 +00:00
|
|
|
event_log_error (hashcat_ctx, "Outfile and wordlist cannot point to the same file.");
|
2017-02-14 15:25:38 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
2017-10-10 09:30:20 +00:00
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
|
|
|
{
|
|
|
|
if (user_options_extra->hc_workc == 2)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-10-10 09:30:20 +00:00
|
|
|
char *dictfile1 = user_options_extra->hc_workv[0];
|
|
|
|
char *dictfile2 = user_options_extra->hc_workv[1];
|
|
|
|
|
|
|
|
if (hc_same_files (outfile_ctx->filename, dictfile1) == true)
|
2017-02-14 15:25:38 +00:00
|
|
|
{
|
2017-10-10 09:30:20 +00:00
|
|
|
event_log_error (hashcat_ctx, "Outfile and wordlist cannot point to the same file.");
|
2017-02-14 15:25:38 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
if (hc_same_files (outfile_ctx->filename, dictfile2) == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Outfile and wordlist cannot point to the same file.");
|
2017-02-14 15:25:38 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
2017-10-10 09:30:20 +00:00
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
|
|
|
{
|
|
|
|
if (user_options_extra->hc_workc == 2)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-10-10 09:30:20 +00:00
|
|
|
char *wlfile = user_options_extra->hc_workv[0];
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
if (hc_same_files (outfile_ctx->filename, wlfile) == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Outfile and wordlist cannot point to the same file.");
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
|
|
|
{
|
|
|
|
if (user_options_extra->hc_workc == 2)
|
|
|
|
{
|
|
|
|
char *wlfile = user_options_extra->hc_workv[1];
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-10-10 09:30:20 +00:00
|
|
|
if (hc_same_files (outfile_ctx->filename, wlfile) == true)
|
2017-01-27 13:50:39 +00:00
|
|
|
{
|
2017-10-10 09:30:20 +00:00
|
|
|
event_log_error (hashcat_ctx, "Outfile and wordlist cannot point to the same file.");
|
2017-01-27 13:50:39 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-09-29 13:56:32 +00:00
|
|
|
else if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < user_options_extra->hc_workc; i++)
|
|
|
|
{
|
|
|
|
char *wlfile = user_options_extra->hc_workv[i];
|
|
|
|
|
|
|
|
if (hc_same_files (outfile_ctx->filename, wlfile) == true)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "Outfile and wordlist cannot point to the same file.");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 15:29:18 +00:00
|
|
|
// pidfile
|
|
|
|
|
|
|
|
if (hc_path_exist (pidfile_ctx->filename) == true)
|
|
|
|
{
|
2017-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (pidfile_ctx->filename) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a pidfile argument.", pidfile_ctx->filename);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 15:29:18 +00:00
|
|
|
if (hc_path_write (pidfile_ctx->filename) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", pidfile_ctx->filename, strerror (errno));
|
2017-01-27 15:29:18 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2017-01-27 23:08:12 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (hc_path_create (pidfile_ctx->filename) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", pidfile_ctx->filename, strerror (errno));
|
2017-01-27 23:08:12 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2017-01-27 15:29:18 +00:00
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
// potfile
|
|
|
|
|
|
|
|
if (potfile_ctx->enabled == true)
|
|
|
|
{
|
|
|
|
if (hc_path_exist (potfile_ctx->filename) == true)
|
|
|
|
{
|
2017-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (potfile_ctx->filename) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a potfile argument.", potfile_ctx->filename);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
if (hc_path_write (potfile_ctx->filename) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", potfile_ctx->filename, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 23:08:12 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (hc_path_create (potfile_ctx->filename) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", potfile_ctx->filename, strerror (errno));
|
2017-01-27 23:08:12 +00:00
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
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-03-27 08:27:53 +00:00
|
|
|
if (hc_path_is_directory (dictstat_ctx->filename) == true)
|
2017-03-19 12:59:36 +00:00
|
|
|
{
|
2017-04-02 07:50:06 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: A directory cannot be used as a dictstat argument.", dictstat_ctx->filename);
|
2017-03-19 12:59:36 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
if (hc_path_write (dictstat_ctx->filename) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictstat_ctx->filename, strerror (errno));
|
2017-01-27 13:50:39 +00:00
|
|
|
|
2017-01-27 23:08:12 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (hc_path_create (dictstat_ctx->filename) == false)
|
|
|
|
{
|
2017-02-04 01:53:50 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", dictstat_ctx->filename, strerror (errno));
|
2017-01-27 23:08:12 +00:00
|
|
|
|
2017-01-27 14:06:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-01-27 13:50:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-27 08:47:28 +00:00
|
|
|
// single kernel and module existence check to detect "7z e" errors
|
|
|
|
|
|
|
|
char *modulefile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
module_filename (folder_config, 0, modulefile, HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
if (hc_path_exist (modulefile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", modulefile, strerror (errno));
|
|
|
|
|
2021-07-02 06:58:04 +00:00
|
|
|
event_log_warning (hashcat_ctx, "If you are using the hashcat binary package, this may be an extraction issue.");
|
2019-02-27 08:47:28 +00:00
|
|
|
event_log_warning (hashcat_ctx, "For example, using \"7z e\" instead of using \"7z x\".");
|
|
|
|
event_log_warning (hashcat_ctx, NULL);
|
|
|
|
|
2021-07-02 06:58:04 +00:00
|
|
|
hcfree (modulefile);
|
2019-02-27 08:47:28 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2021-07-02 06:58:04 +00:00
|
|
|
hcfree (modulefile);
|
2019-02-27 08:47:28 +00:00
|
|
|
|
2021-07-02 06:58:04 +00:00
|
|
|
const bool quiet_save = user_options->quiet;
|
2019-02-27 08:47:28 +00:00
|
|
|
|
2021-07-02 06:58:04 +00:00
|
|
|
user_options->quiet = true;
|
2019-02-27 08:47:28 +00:00
|
|
|
|
|
|
|
const int rc = hashconfig_init (hashcat_ctx);
|
|
|
|
|
2021-07-02 06:58:04 +00:00
|
|
|
user_options->quiet = quiet_save;
|
2019-02-27 08:47:28 +00:00
|
|
|
|
2019-04-06 22:35:33 +00:00
|
|
|
if (rc == -1) return -1;
|
2019-02-27 08:47:28 +00:00
|
|
|
|
|
|
|
hashconfig_destroy (hashcat_ctx);
|
|
|
|
|
2019-05-01 13:52:56 +00:00
|
|
|
// same check but for an backend kernel
|
2019-02-27 08:47:28 +00:00
|
|
|
|
|
|
|
char *kernelfile = (char *) hcmalloc (HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
generate_source_kernel_filename (false, ATTACK_EXEC_OUTSIDE_KERNEL, ATTACK_KERN_STRAIGHT, 400, 0, folder_config->shared_dir, kernelfile);
|
|
|
|
|
|
|
|
if (hc_path_read (kernelfile) == false)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", kernelfile, strerror (errno));
|
|
|
|
|
2021-07-02 06:58:04 +00:00
|
|
|
event_log_warning (hashcat_ctx, "If you are using the hashcat binary package, this may be an extraction issue.");
|
2019-02-27 08:47:28 +00:00
|
|
|
event_log_warning (hashcat_ctx, "For example, using \"7z e\" instead of using \"7z x\".");
|
|
|
|
event_log_warning (hashcat_ctx, NULL);
|
|
|
|
|
2021-07-02 06:58:04 +00:00
|
|
|
hcfree (kernelfile);
|
|
|
|
|
2019-02-27 08:47:28 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
hcfree (kernelfile);
|
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
// loopback - can't check at this point
|
|
|
|
|
|
|
|
// tuning file check already done
|
|
|
|
|
|
|
|
// debugfile check already done
|
|
|
|
|
2018-11-15 13:35:51 +00:00
|
|
|
// dictstat
|
|
|
|
|
2018-11-25 17:21:07 +00:00
|
|
|
if (user_options->keyboard_layout_mapping != NULL)
|
2018-11-15 13:35:51 +00:00
|
|
|
{
|
2018-11-25 17:21:07 +00:00
|
|
|
if (hc_path_exist (user_options->keyboard_layout_mapping) == true)
|
2018-11-15 13:35:51 +00:00
|
|
|
{
|
2018-11-25 17:21:07 +00:00
|
|
|
if (hc_path_read (user_options->keyboard_layout_mapping) == false)
|
2018-11-15 13:35:51 +00:00
|
|
|
{
|
2018-11-25 17:21:07 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", user_options->keyboard_layout_mapping, strerror (errno));
|
2018-11-15 13:35:51 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-25 17:21:07 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", user_options->keyboard_layout_mapping, strerror (errno));
|
2018-11-15 13:35:51 +00:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-02 16:58:01 +00:00
|
|
|
/**
|
|
|
|
* default building options
|
|
|
|
*/
|
|
|
|
|
2020-06-03 09:10:31 +00:00
|
|
|
/* temporary disabled due to https://github.com/hashcat/hashcat/issues/2379
|
2019-03-02 16:58:01 +00:00
|
|
|
if (chdir (folder_config->cpath_real) == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", folder_config->cpath_real, strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
2020-06-03 09:10:31 +00:00
|
|
|
*/
|
2019-03-02 16:58:01 +00:00
|
|
|
|
|
|
|
// include check
|
|
|
|
// this test needs to be done manually because of macOS opencl runtime
|
|
|
|
// if there's a problem with permission, its not reporting back and erroring out silently
|
|
|
|
|
2019-03-21 22:00:38 +00:00
|
|
|
const char *files_names[] =
|
2019-03-02 16:58:01 +00:00
|
|
|
{
|
|
|
|
"inc_cipher_aes.cl",
|
|
|
|
"inc_cipher_serpent.cl",
|
|
|
|
"inc_cipher_twofish.cl",
|
|
|
|
"inc_common.cl",
|
|
|
|
"inc_comp_multi_bs.cl",
|
|
|
|
"inc_comp_multi.cl",
|
|
|
|
"inc_comp_single_bs.cl",
|
|
|
|
"inc_comp_single.cl",
|
|
|
|
"inc_rp_optimized.cl",
|
|
|
|
"inc_rp_optimized.h",
|
|
|
|
"inc_simd.cl",
|
|
|
|
"inc_scalar.cl",
|
2019-03-21 22:00:38 +00:00
|
|
|
"inc_types.h",
|
|
|
|
"inc_vendor.h",
|
|
|
|
NULL
|
2019-03-02 16:58:01 +00:00
|
|
|
};
|
|
|
|
|
2019-03-21 22:00:38 +00:00
|
|
|
for (int i = 0; files_names[i] != NULL; i++)
|
2019-03-02 16:58:01 +00:00
|
|
|
{
|
2020-06-03 09:10:31 +00:00
|
|
|
char *temp_filename = NULL;
|
|
|
|
|
|
|
|
hc_asprintf (&temp_filename, "%s/%s", folder_config->cpath_real, files_names[i]);
|
|
|
|
|
|
|
|
if (hc_path_read (temp_filename) == false)
|
2019-03-02 16:58:01 +00:00
|
|
|
{
|
2020-06-03 09:10:31 +00:00
|
|
|
event_log_error (hashcat_ctx, "%s: %s", temp_filename, strerror (errno));
|
2019-03-02 16:58:01 +00:00
|
|
|
|
2021-05-04 11:48:04 +00:00
|
|
|
hcfree (temp_filename);
|
|
|
|
|
2019-03-02 16:58:01 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2021-05-04 11:48:04 +00:00
|
|
|
|
|
|
|
hcfree (temp_filename);
|
2019-03-02 16:58:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// return back to the folder we came from initially (workaround)
|
|
|
|
|
2020-06-03 09:10:31 +00:00
|
|
|
/* temporary disabled due to https://github.com/hashcat/hashcat/issues/2379
|
2019-03-02 16:58:01 +00:00
|
|
|
#if defined (_WIN)
|
|
|
|
if (chdir ("..") == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", "..", strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (chdir (folder_config->cwd) == -1)
|
|
|
|
{
|
|
|
|
event_log_error (hashcat_ctx, "%s: %s", folder_config->cwd, strerror (errno));
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
2020-06-03 09:10:31 +00:00
|
|
|
*/
|
2019-03-02 16:58:01 +00:00
|
|
|
|
2017-01-27 13:50:39 +00:00
|
|
|
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;
|
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
logfile_top_string (user_options->brain_session_whitelist);
|
|
|
|
#endif
|
2016-10-14 19:38:52 +00:00
|
|
|
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);
|
2017-04-14 14:36:28 +00:00
|
|
|
logfile_top_string (user_options->encoding_from);
|
|
|
|
logfile_top_string (user_options->encoding_to);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_string (user_options->induction_dir);
|
2018-11-25 17:21:07 +00:00
|
|
|
logfile_top_string (user_options->keyboard_layout_mapping);
|
2018-08-23 07:10:54 +00:00
|
|
|
logfile_top_string (user_options->markov_hcstat2);
|
2019-05-01 13:52:56 +00:00
|
|
|
logfile_top_string (user_options->backend_devices);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_string (user_options->opencl_device_types);
|
|
|
|
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]);
|
2021-08-14 09:43:32 +00:00
|
|
|
logfile_top_string (user_options->rp_gen_func_sel);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_string (user_options->rule_buf_l);
|
|
|
|
logfile_top_string (user_options->rule_buf_r);
|
|
|
|
logfile_top_string (user_options->session);
|
2021-07-22 16:54:02 +00:00
|
|
|
logfile_top_string (user_options->separator);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_string (user_options->truecrypt_keyfiles);
|
|
|
|
logfile_top_string (user_options->veracrypt_keyfiles);
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
logfile_top_string (user_options->brain_host);
|
|
|
|
#endif
|
2016-10-14 19:38:52 +00:00
|
|
|
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);
|
2017-12-05 10:08:59 +00:00
|
|
|
logfile_top_uint (user_options->benchmark_all);
|
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);
|
2020-12-29 06:56:20 +00:00
|
|
|
logfile_top_uint (user_options->hash_info);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->force);
|
2018-11-09 11:48:27 +00:00
|
|
|
logfile_top_uint (user_options->hwmon_disable);
|
|
|
|
logfile_top_uint (user_options->hwmon_temp_abort);
|
2016-10-14 19:38:52 +00:00
|
|
|
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);
|
2019-11-02 09:29:34 +00:00
|
|
|
logfile_top_uint (user_options->hook_threads);
|
2021-06-12 08:47:48 +00:00
|
|
|
logfile_top_uint (user_options->identify);
|
2016-09-23 19:41:05 +00:00
|
|
|
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);
|
2018-11-06 15:06:06 +00:00
|
|
|
logfile_top_uint (user_options->kernel_threads);
|
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);
|
2021-07-07 08:32:08 +00:00
|
|
|
logfile_top_uint (user_options->markov_inverse);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->markov_threshold);
|
2021-07-21 13:47:05 +00:00
|
|
|
logfile_top_uint (user_options->multiply_accel_disable);
|
2019-05-01 13:52:56 +00:00
|
|
|
logfile_top_uint (user_options->backend_info);
|
|
|
|
logfile_top_uint (user_options->backend_vector_width);
|
2017-07-18 11:23:42 +00:00
|
|
|
logfile_top_uint (user_options->optimized_kernel_enable);
|
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);
|
2020-01-24 17:43:13 +00:00
|
|
|
logfile_top_uint (user_options->outfile_format);
|
2017-08-16 10:07:14 +00:00
|
|
|
logfile_top_uint (user_options->wordlist_autohex_disable);
|
2016-09-23 19:41:05 +00:00
|
|
|
logfile_top_uint (user_options->potfile_disable);
|
2017-06-29 10:19:05 +00:00
|
|
|
logfile_top_uint (user_options->progress_only);
|
2016-09-23 19:41:05 +00:00
|
|
|
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);
|
2017-06-29 10:19:05 +00:00
|
|
|
logfile_top_uint (user_options->self_test_disable);
|
2018-09-01 10:31:17 +00:00
|
|
|
logfile_top_uint (user_options->slow_candidates);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->show);
|
2017-06-29 10:19:05 +00:00
|
|
|
logfile_top_uint (user_options->speed_only);
|
2018-11-20 11:32:24 +00:00
|
|
|
logfile_top_uint (user_options->spin_damp);
|
2016-10-14 19:38:52 +00:00
|
|
|
logfile_top_uint (user_options->status);
|
2019-03-27 10:09:24 +00:00
|
|
|
logfile_top_uint (user_options->status_json);
|
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->usage);
|
|
|
|
logfile_top_uint (user_options->username);
|
2019-03-15 20:48:49 +00:00
|
|
|
logfile_top_uint (user_options->veracrypt_pim_start);
|
|
|
|
logfile_top_uint (user_options->veracrypt_pim_stop);
|
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->workload_profile);
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
logfile_top_uint (user_options->brain_client);
|
|
|
|
logfile_top_uint (user_options->brain_client_features);
|
|
|
|
logfile_top_uint (user_options->brain_server);
|
2020-01-11 09:46:11 +00:00
|
|
|
logfile_top_uint (user_options->brain_server_timer);
|
2018-10-28 15:47:13 +00:00
|
|
|
logfile_top_uint (user_options->brain_port);
|
|
|
|
logfile_top_uint (user_options->brain_session);
|
|
|
|
#endif
|
2016-09-23 19:41:05 +00:00
|
|
|
}
|