diff --git a/docs/changes.txt b/docs/changes.txt index 94481a3d6..328e886b8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -9,6 +9,7 @@ - Added self-test functionality to detect broken OpenCL runtimes on startup - Added option --self-test-disable to disable self-test functionality on startup - Added option --wordlist-autohex-disable to disable the automatical conversion of $HEX[] words from the word list +- Added option --example-hashes to show an example hash for each hash-mode ## ## Algorithms diff --git a/extra/tab_completion/hashcat.sh b/extra/tab_completion/hashcat.sh index 96d654e81..9fd3968dd 100644 --- a/extra/tab_completion/hashcat.sh +++ b/extra/tab_completion/hashcat.sh @@ -189,8 +189,8 @@ _hashcat () local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H' local SHORT_OPTS="-m -a -V -v -h -b -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O" - local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --weak-hash-threshold --markov-hcstat --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-disable --gpu-temp-abort --gpu-temp-retain --powertune-enable --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyfiles --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable" - local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --weak-hash-threshold --markov-hcstat --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-abort --gpu-temp-retain -disable --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --truecrypt-keyfiles --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable" + local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --weak-hash-threshold --markov-hcstat --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-disable --gpu-temp-abort --gpu-temp-retain --powertune-enable --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyfiles --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable" + local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --weak-hash-threshold --markov-hcstat --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-abort --gpu-temp-retain --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --truecrypt-keyfiles --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to" COMPREPLY=() local cur="${COMP_WORDS[COMP_CWORD]}" diff --git a/include/terminal.h b/include/terminal.h index 4cf4747d2..7bbcc3acf 100644 --- a/include/terminal.h +++ b/include/terminal.h @@ -41,6 +41,8 @@ int tty_fix(void); void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginning, const size_t keep_from_end); +void example_hashes (hashcat_ctx_t *hashcat_ctx); + void opencl_info (hashcat_ctx_t *hashcat_ctx); void opencl_info_compact (hashcat_ctx_t *hashcat_ctx); diff --git a/include/types.h b/include/types.h index f66ca7f36..b2b39004f 100644 --- a/include/types.h +++ b/include/types.h @@ -523,6 +523,7 @@ typedef enum user_options_defaults BITMAP_MAX = 24, BITMAP_MIN = 16, DEBUG_MODE = 0, + EXAMPLE_HASHES = false, FORCE = false, GPU_TEMP_ABORT = 90, GPU_TEMP_DISABLE = false, @@ -549,6 +550,7 @@ typedef enum user_options_defaults MARKOV_THRESHOLD = 0, NONCE_ERROR_CORRECTIONS = 8, NVIDIA_SPIN_DAMP = 100, + OPENCL_INFO = false, OPENCL_VECTOR_WIDTH = 0, OPTIMIZED_KERNEL_ENABLE = false, OUTFILE_AUTOHEX = true, @@ -603,83 +605,84 @@ typedef enum user_options_map IDX_DEBUG_MODE = 0xff05, IDX_ENCODING_FROM = 0xff06, IDX_ENCODING_TO = 0xff07, - IDX_FORCE = 0xff08, - IDX_GPU_TEMP_ABORT = 0xff09, - IDX_GPU_TEMP_DISABLE = 0xff0a, - IDX_GPU_TEMP_RETAIN = 0xff0b, + IDX_EXAMPLE_HASHES = 0xff08, + IDX_FORCE = 0xff09, + IDX_GPU_TEMP_ABORT = 0xff0a, + IDX_GPU_TEMP_DISABLE = 0xff0b, + IDX_GPU_TEMP_RETAIN = 0xff0c, IDX_HASH_MODE = 'm', - IDX_HCCAPX_MESSAGE_PAIR = 0xff0c, + IDX_HCCAPX_MESSAGE_PAIR = 0xff0d, IDX_HELP = 'h', - IDX_HEX_CHARSET = 0xff0d, - IDX_HEX_SALT = 0xff0e, - IDX_HEX_WORDLIST = 0xff0f, + IDX_HEX_CHARSET = 0xff0e, + IDX_HEX_SALT = 0xff0f, + IDX_HEX_WORDLIST = 0xff10, IDX_INCREMENT = 'i', - IDX_INCREMENT_MAX = 0xff10, - IDX_INCREMENT_MIN = 0xff11, - IDX_INDUCTION_DIR = 0xff12, - IDX_KEEP_GUESSING = 0xff13, + IDX_INCREMENT_MAX = 0xff11, + IDX_INCREMENT_MIN = 0xff12, + IDX_INDUCTION_DIR = 0xff13, + IDX_KEEP_GUESSING = 0xff14, IDX_KERNEL_ACCEL = 'n', IDX_KERNEL_LOOPS = 'u', - IDX_KEYSPACE = 0xff14, - IDX_LEFT = 0xff15, + IDX_KEYSPACE = 0xff15, + IDX_LEFT = 0xff16, IDX_LIMIT = 'l', - IDX_LOGFILE_DISABLE = 0xff16, - IDX_LOOPBACK = 0xff17, - IDX_MACHINE_READABLE = 0xff18, - IDX_MARKOV_CLASSIC = 0xff19, - IDX_MARKOV_DISABLE = 0xff1a, - IDX_MARKOV_HCSTAT = 0xff1b, + IDX_LOGFILE_DISABLE = 0xff17, + IDX_LOOPBACK = 0xff18, + IDX_MACHINE_READABLE = 0xff19, + IDX_MARKOV_CLASSIC = 0xff1a, + IDX_MARKOV_DISABLE = 0xff1b, + IDX_MARKOV_HCSTAT = 0xff1c, IDX_MARKOV_THRESHOLD = 't', - IDX_NONCE_ERROR_CORRECTIONS = 0xff1c, - IDX_NVIDIA_SPIN_DAMP = 0xff1d, + IDX_NONCE_ERROR_CORRECTIONS = 0xff1d, + IDX_NVIDIA_SPIN_DAMP = 0xff1e, IDX_OPENCL_DEVICES = 'd', IDX_OPENCL_DEVICE_TYPES = 'D', IDX_OPENCL_INFO = 'I', - IDX_OPENCL_PLATFORMS = 0xff1e, - IDX_OPENCL_VECTOR_WIDTH = 0xff1f, + IDX_OPENCL_PLATFORMS = 0xff1f, + IDX_OPENCL_VECTOR_WIDTH = 0xff20, IDX_OPTIMIZED_KERNEL_ENABLE = 'O', - IDX_OUTFILE_AUTOHEX_DISABLE = 0xff20, - IDX_OUTFILE_CHECK_DIR = 0xff21, - IDX_OUTFILE_CHECK_TIMER = 0xff22, - IDX_OUTFILE_FORMAT = 0xff23, + IDX_OUTFILE_AUTOHEX_DISABLE = 0xff21, + IDX_OUTFILE_CHECK_DIR = 0xff22, + IDX_OUTFILE_CHECK_TIMER = 0xff23, + IDX_OUTFILE_FORMAT = 0xff24, IDX_OUTFILE = 'o', - IDX_WORDLIST_AUTOHEX_DISABLE = 0xff24, - IDX_POTFILE_DISABLE = 0xff25, - IDX_POTFILE_PATH = 0xff26, - IDX_POWERTUNE_ENABLE = 0xff27, - IDX_QUIET = 0xff28, - IDX_REMOVE = 0xff29, - IDX_REMOVE_TIMER = 0xff2a, - IDX_RESTORE = 0xff2b, - IDX_RESTORE_DISABLE = 0xff2c, - IDX_RESTORE_FILE_PATH = 0xff2d, + IDX_WORDLIST_AUTOHEX_DISABLE = 0xff25, + IDX_POTFILE_DISABLE = 0xff26, + IDX_POTFILE_PATH = 0xff27, + IDX_POWERTUNE_ENABLE = 0xff28, + IDX_QUIET = 0xff29, + IDX_REMOVE = 0xff2a, + IDX_REMOVE_TIMER = 0xff2b, + IDX_RESTORE = 0xff2c, + IDX_RESTORE_DISABLE = 0xff2d, + IDX_RESTORE_FILE_PATH = 0xff2e, IDX_RP_FILE = 'r', - IDX_RP_GEN_FUNC_MAX = 0xff2e, - IDX_RP_GEN_FUNC_MIN = 0xff2f, + IDX_RP_GEN_FUNC_MAX = 0xff2f, + IDX_RP_GEN_FUNC_MIN = 0xff30, IDX_RP_GEN = 'g', - IDX_RP_GEN_SEED = 0xff30, + IDX_RP_GEN_SEED = 0xff31, IDX_RULE_BUF_L = 'j', IDX_RULE_BUF_R = 'k', - IDX_RUNTIME = 0xff31, - IDX_SCRYPT_TMTO = 0xff32, - IDX_SELF_TEST_DISABLE = 0xff33, + IDX_RUNTIME = 0xff32, + IDX_SCRYPT_TMTO = 0xff33, + IDX_SELF_TEST_DISABLE = 0xff34, IDX_SEGMENT_SIZE = 'c', IDX_SEPARATOR = 'p', - IDX_SESSION = 0xff34, - IDX_SHOW = 0xff35, + IDX_SESSION = 0xff35, + IDX_SHOW = 0xff36, IDX_SKIP = 's', - IDX_STATUS = 0xff36, - IDX_STATUS_TIMER = 0xff37, - IDX_STDOUT_FLAG = 0xff38, - IDX_SPEED_ONLY = 0xff39, - IDX_PROGRESS_ONLY = 0xff3a, - IDX_TRUECRYPT_KEYFILES = 0xff3b, - IDX_USERNAME = 0xff3c, - IDX_VERACRYPT_KEYFILES = 0xff3d, - IDX_VERACRYPT_PIM = 0xff3e, + IDX_STATUS = 0xff37, + IDX_STATUS_TIMER = 0xff38, + IDX_STDOUT_FLAG = 0xff39, + IDX_SPEED_ONLY = 0xff3a, + IDX_PROGRESS_ONLY = 0xff3b, + IDX_TRUECRYPT_KEYFILES = 0xff3c, + IDX_USERNAME = 0xff3d, + IDX_VERACRYPT_KEYFILES = 0xff3e, + IDX_VERACRYPT_PIM = 0xff3f, IDX_VERSION_LOWER = 'v', IDX_VERSION = 'V', - IDX_WEAK_HASH_THRESHOLD = 0xff3f, + IDX_WEAK_HASH_THRESHOLD = 0xff40, IDX_WORKLOAD_PROFILE = 'w' } user_options_map_t; @@ -1471,6 +1474,7 @@ typedef struct user_options bool advice_disable; bool benchmark; + bool example_hashes; bool force; bool gpu_temp_disable; bool hex_charset; diff --git a/src/bitmap.c b/src/bitmap.c index 5de583830..a51e96e9f 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -78,12 +78,13 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx) bitmap_ctx->enabled = false; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; bitmap_ctx->enabled = true; diff --git a/src/combinator.c b/src/combinator.c index 316a0568a..608290730 100644 --- a/src/combinator.c +++ b/src/combinator.c @@ -20,11 +20,12 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) combinator_ctx->enabled = false; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; if ((user_options->attack_mode != ATTACK_MODE_COMBI) && (user_options->attack_mode != ATTACK_MODE_HYBRID1) diff --git a/src/cpt.c b/src/cpt.c index 72a7887c6..9d67d8220 100644 --- a/src/cpt.c +++ b/src/cpt.c @@ -16,12 +16,13 @@ int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx) cpt_ctx->enabled = false; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; cpt_ctx->enabled = true; diff --git a/src/debugfile.c b/src/debugfile.c index 97cfe6836..11a521c15 100644 --- a/src/debugfile.c +++ b/src/debugfile.c @@ -87,17 +87,18 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx) debugfile_ctx->enabled = false; - if (user_options->benchmark == true) return 0; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->stdout_flag == true) return 0; - if (user_options->speed_only == true) return 0; - if (user_options->progress_only == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; - if (user_options->debug_mode == 0) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->stdout_flag == true) return 0; + if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; + if (user_options->debug_mode == 0) return 0; debugfile_ctx->enabled = true; diff --git a/src/dictstat.c b/src/dictstat.c index febdf385b..bc5ab6763 100644 --- a/src/dictstat.c +++ b/src/dictstat.c @@ -37,13 +37,14 @@ int dictstat_init (hashcat_ctx_t *hashcat_ctx) dictstat_ctx->enabled = false; - if (user_options->benchmark == true) return 0; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; if (user_options->attack_mode == ATTACK_MODE_BF) return 0; diff --git a/src/hashcat.c b/src/hashcat.c index 495a5f573..7ffe38c5d 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -415,7 +415,12 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) const int rc_hashconfig = hashconfig_init (hashcat_ctx); - if (rc_hashconfig == -1) return -1; + if (rc_hashconfig == -1) + { + event_log_error (hashcat_ctx, "Unknown hash-type '%u' selected.", user_options->hash_mode); + + return -1; + } /** * load hashes, stage 1 diff --git a/src/hashes.c b/src/hashes.c index dac9e5e2b..5af9c7f56 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -672,6 +672,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) hashes_cnt = 1; } + else if (user_options->example_hashes == true) + { + } else if (user_options->keyspace == true) { } diff --git a/src/hwmon.c b/src/hwmon.c index 10edb0592..d6c933ed4 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -3328,6 +3328,7 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx) hwmon_ctx->enabled = false; + if (user_options->example_hashes == true) return 0; if (user_options->keyspace == true) return 0; if (user_options->left == true) return 0; if (user_options->opencl_info == true) return 0; diff --git a/src/induct.c b/src/induct.c index a2022386f..ba02be91d 100644 --- a/src/induct.c +++ b/src/induct.c @@ -36,16 +36,17 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx) induct_ctx->enabled = false; - if (user_options->benchmark == true) return 0; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->stdout_flag == true) return 0; - if (user_options->speed_only == true) return 0; - if (user_options->progress_only == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->stdout_flag == true) return 0; + if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; if (user_options->attack_mode == ATTACK_MODE_BF) return 0; if (user_options->attack_mode == ATTACK_MODE_COMBI) return 0; diff --git a/src/interface.c b/src/interface.c index 2d25676d1..f0bbff074 100644 --- a/src/interface.c +++ b/src/interface.c @@ -34,7 +34,6 @@ static char ST_PASS_BIN_09710[] = "\x91\xb2\xe0\x62\xb9"; static char ST_PASS_BIN_09810[] = "\xb8\xf6\x36\x19\xca"; static char ST_PASS_BIN_10410[] = "\x6a\x8a\xed\xcc\xb7"; - /** * Missing self-test hashes: * @@ -24312,8 +24311,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) hashconfig->st_pass = ST_PASS_HASHCAT_PLAIN; break; - default: event_log_error (hashcat_ctx, "Unknown hash-type '%u' selected.", hashconfig->hash_mode); - return -1; + default: return -1; } if (user_options->hex_salt) @@ -24338,36 +24336,39 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) // some kernels do not have an optimized kernel, simply because they do not need them // or because they are not yet converted, for them we should switch off optimized mode - if (user_options->optimized_kernel_enable == true) + if (user_options->example_hashes == false) { - char source_file[256] = { 0 }; - - generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, true, folder_config->shared_dir, source_file); - - if (hc_path_read (source_file) == false) + if (user_options->optimized_kernel_enable == true) { - if (user_options->quiet == false) event_log_warning (hashcat_ctx, "%s: Optimized kernel not found, falling back to pure kernel", source_file); + char source_file[256] = { 0 }; + + generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, true, folder_config->shared_dir, source_file); + + if (hc_path_read (source_file) == false) + { + if (user_options->quiet == false) event_log_warning (hashcat_ctx, "%s: Optimized kernel not found, falling back to pure kernel", source_file); + } + else + { + hashconfig->opti_type |= OPTI_TYPE_OPTIMIZED_KERNEL; + } } else { - hashconfig->opti_type |= OPTI_TYPE_OPTIMIZED_KERNEL; - } - } - else - { - char source_file[256] = { 0 }; + char source_file[256] = { 0 }; - generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, false, folder_config->shared_dir, source_file); + generate_source_kernel_filename (hashconfig->attack_exec, user_options_extra->attack_kern, hashconfig->kern_type, false, folder_config->shared_dir, source_file); - if (hc_path_read (source_file) == false) - { - if (user_options->quiet == false) event_log_warning (hashcat_ctx, "%s: Pure kernel not found, falling back to optimized kernel", source_file); + if (hc_path_read (source_file) == false) + { + if (user_options->quiet == false) event_log_warning (hashcat_ctx, "%s: Pure kernel not found, falling back to optimized kernel", source_file); - hashconfig->opti_type |= OPTI_TYPE_OPTIMIZED_KERNEL; - } - else - { - // nothing to do + hashconfig->opti_type |= OPTI_TYPE_OPTIMIZED_KERNEL; + } + else + { + // nothing to do + } } } diff --git a/src/loopback.c b/src/loopback.c index 7712e52ab..12b8c1998 100644 --- a/src/loopback.c +++ b/src/loopback.c @@ -60,16 +60,17 @@ int loopback_init (hashcat_ctx_t *hashcat_ctx) loopback_ctx->enabled = false; - if (user_options->benchmark == true) return 0; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->stdout_flag == true) return 0; - if (user_options->speed_only == true) return 0; - if (user_options->progress_only == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->stdout_flag == true) return 0; + if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; loopback_ctx->enabled = true; loopback_ctx->fp = NULL; diff --git a/src/main.c b/src/main.c index 480ce9926..50586284f 100644 --- a/src/main.c +++ b/src/main.c @@ -187,7 +187,7 @@ static void main_outerloop_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MA status_ctx->shutdown_outer = false; - if ((user_options->keyspace == false) && (user_options->stdout_flag == false) && (user_options->opencl_info == false) && (user_options->speed_only == false)) + if ((user_options->example_hashes == false) && (user_options->keyspace == false) && (user_options->stdout_flag == false) && (user_options->opencl_info == false) && (user_options->speed_only == false)) { if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) { @@ -250,9 +250,10 @@ static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB const user_options_t *user_options = hashcat_ctx->user_options; const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; - if (user_options->keyspace == true) return; - if (user_options->opencl_info == true) return; - if (user_options->stdout_flag == true) return; + if (user_options->example_hashes == true) return; + if (user_options->keyspace == true) return; + if (user_options->opencl_info == true) return; + if (user_options->stdout_flag == true) return; // if we had a prompt, clear it @@ -1035,6 +1036,13 @@ int main (int argc, char **argv) return 0; } + if (user_options->example_hashes == true) + { + example_hashes (hashcat_ctx); + + return 0; + } + // init a hashcat session; this initializes opencl devices, hwmon, etc welcome_screen (hashcat_ctx, VERSION_TAG); diff --git a/src/mpsp.c b/src/mpsp.c index 8cc0cc5c8..0e753494d 100644 --- a/src/mpsp.c +++ b/src/mpsp.c @@ -1372,11 +1372,12 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx) mask_ctx->enabled = false; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; if (user_options->attack_mode == ATTACK_MODE_STRAIGHT) return 0; if (user_options->attack_mode == ATTACK_MODE_COMBI) return 0; diff --git a/src/opencl.c b/src/opencl.c index b000d8c4e..6b1e3271c 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -2360,11 +2360,12 @@ int opencl_ctx_init (hashcat_ctx_t *hashcat_ctx) opencl_ctx->enabled = false; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->show == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->show == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; hc_device_param_t *devices_param = (hc_device_param_t *) hccalloc (DEVICES_MAX, sizeof (hc_device_param_t)); diff --git a/src/outfile_check.c b/src/outfile_check.c index d3bdcdd8d..50f947e6e 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -311,11 +311,12 @@ int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx) outcheck_ctx->enabled = false; - if (user_options->keyspace == true) return 0; - if (user_options->benchmark == true) return 0; - if (user_options->speed_only == true) return 0; - if (user_options->progress_only == true) return 0; - if (user_options->opencl_info == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; + if (user_options->opencl_info == true) return 0; if (user_options->outfile_check_timer == 0) return 0; diff --git a/src/potfile.c b/src/potfile.c index 0939ee759..01ddd610e 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -64,6 +64,7 @@ int potfile_init (hashcat_ctx_t *hashcat_ctx) potfile_ctx->enabled = false; if (user_options->benchmark == true) return 0; + if (user_options->example_hashes == true) return 0; if (user_options->keyspace == true) return 0; if (user_options->opencl_info == true) return 0; if (user_options->stdout_flag == true) return 0; diff --git a/src/restore.c b/src/restore.c index d7d621452..042555433 100644 --- a/src/restore.c +++ b/src/restore.c @@ -301,6 +301,7 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) restore_ctx->enabled = false; if (user_options->benchmark == true) return 0; + if (user_options->example_hashes == true) return 0; if (user_options->keyspace == true) return 0; if (user_options->left == true) return 0; if (user_options->opencl_info == true) return 0; diff --git a/src/straight.c b/src/straight.c index b8d0918c2..dfc49602f 100644 --- a/src/straight.c +++ b/src/straight.c @@ -207,11 +207,12 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx) straight_ctx->enabled = false; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; if (user_options->attack_mode == ATTACK_MODE_BF) return 0; diff --git a/src/terminal.c b/src/terminal.c index 764caa9df..fc47805a8 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -513,6 +513,69 @@ void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginn *ptr1 = 0; } +void example_hashes (hashcat_ctx_t *hashcat_ctx) +{ + user_options_t *user_options = hashcat_ctx->user_options; + + if (user_options->hash_mode_chgd == true) + { + const int rc = hashconfig_init (hashcat_ctx); + + if (rc == 0) + { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + + event_log_info (hashcat_ctx, "MODE: %s", strhashtype (hashconfig->hash_mode)); + + if ((hashconfig->st_hash != NULL) && (hashconfig->st_pass != NULL)) + { + event_log_info (hashcat_ctx, "HASH: %s", hashconfig->st_hash); + event_log_info (hashcat_ctx, "PASS: %s", hashconfig->st_pass); + } + else + { + event_log_info (hashcat_ctx, "HASH: not stored"); + event_log_info (hashcat_ctx, "PASS: not stored"); + } + + event_log_info (hashcat_ctx, NULL); + } + + hashconfig_destroy (hashcat_ctx); + } + else + { + for (int i = 0; i < 100000; i++) + { + user_options->hash_mode = i; + + const int rc = hashconfig_init (hashcat_ctx); + + if (rc == 0) + { + hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + + event_log_info (hashcat_ctx, "MODE: %s", strhashtype (hashconfig->hash_mode)); + + if ((hashconfig->st_hash != NULL) && (hashconfig->st_pass != NULL)) + { + event_log_info (hashcat_ctx, "HASH: %s", hashconfig->st_hash); + event_log_info (hashcat_ctx, "PASS: %s", hashconfig->st_pass); + } + else + { + event_log_info (hashcat_ctx, "HASH: not stored"); + event_log_info (hashcat_ctx, "PASS: not stored"); + } + + event_log_info (hashcat_ctx, NULL); + } + + hashconfig_destroy (hashcat_ctx); + } + } +} + void opencl_info (hashcat_ctx_t *hashcat_ctx) { const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx; diff --git a/src/tuningdb.c b/src/tuningdb.c index 39de14732..ffb699d64 100644 --- a/src/tuningdb.c +++ b/src/tuningdb.c @@ -59,12 +59,13 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx) tuning_db->enabled = false; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; tuning_db->enabled = true; diff --git a/src/usage.c b/src/usage.c index 0265d7e50..5fc35b3a1 100644 --- a/src/usage.c +++ b/src/usage.c @@ -84,6 +84,7 @@ static const char *USAGE_BIG[] = " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24", " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-max=24", " --cpu-affinity | Str | Locks to CPU devices, separated with commas | --cpu-affinity=1,2,3", + " --example-hashes | | Show an example hash for each hash-mode |", " -I, --opencl-info | | Show info about detected OpenCL platforms/devices | -I", " --opencl-platforms | Str | OpenCL platforms to use, separated with commas | --opencl-platforms=2", " -d, --opencl-devices | Str | OpenCL devices to use, separated with commas | -d 1", diff --git a/src/user_options.c b/src/user_options.c index 766bf7fab..dc0c8b46e 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -32,6 +32,7 @@ static const struct option long_options[] = {"debug-mode", required_argument, 0, IDX_DEBUG_MODE}, {"encoding-from", required_argument, 0, IDX_ENCODING_FROM}, {"encoding-to", required_argument, 0, IDX_ENCODING_TO}, + {"example-hashes", no_argument, 0, IDX_EXAMPLE_HASHES}, {"force", no_argument, 0, IDX_FORCE}, {"generate-rules-func-max", required_argument, 0, IDX_RP_GEN_FUNC_MAX}, {"generate-rules-func-min", required_argument, 0, IDX_RP_GEN_FUNC_MIN}, @@ -139,6 +140,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx) user_options->custom_charset_4 = NULL; user_options->debug_file = NULL; user_options->debug_mode = DEBUG_MODE; + user_options->example_hashes = EXAMPLE_HASHES; user_options->encoding_from = ENCODING_FROM; user_options->encoding_to = ENCODING_TO; user_options->force = FORCE; @@ -171,7 +173,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx) user_options->nvidia_spin_damp = NVIDIA_SPIN_DAMP; user_options->opencl_devices = NULL; user_options->opencl_device_types = NULL; - user_options->opencl_info = 0; + user_options->opencl_info = OPENCL_INFO; user_options->opencl_platforms = NULL; user_options->opencl_vector_width = OPENCL_VECTOR_WIDTH; user_options->optimized_kernel_enable = OPTIMIZED_KERNEL_ENABLE; @@ -335,6 +337,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) 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; + case IDX_EXAMPLE_HASHES: user_options->example_hashes = true; break; 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 = atoll (optarg); break; @@ -1028,6 +1031,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) show_error = false; } } + else if (user_options->example_hashes == true) + { + if (user_options->hc_argc == 0) + { + show_error = false; + } + } else if (user_options->opencl_info == true) { if (user_options->hc_argc == 0) @@ -1177,14 +1187,19 @@ void user_options_session_auto (hashcat_ctx_t *hashcat_ctx) user_options->session = "benchmark"; } + if (user_options->example_hashes == true) + { + user_options->session = "example_hashes"; + } + if (user_options->speed_only == true) { - user_options->session = "speed-only"; + user_options->session = "speed_only"; } if (user_options->progress_only == true) { - user_options->session = "progress-only"; + user_options->session = "progress_only"; } if (user_options->keyspace == true) @@ -1227,11 +1242,12 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) // some options can influence or overwrite other options - if (user_options->opencl_info == true - || user_options->keyspace == true - || user_options->stdout_flag == true - || user_options->speed_only == true - || user_options->progress_only == true) + if (user_options->example_hashes == true + || user_options->opencl_info == true + || user_options->keyspace == true + || user_options->stdout_flag == true + || user_options->speed_only == true + || user_options->progress_only == true) { user_options->gpu_temp_disable = true; user_options->left = false; @@ -1277,6 +1293,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) } } + if (user_options->example_hashes == true) + { + user_options->quiet = true; + } + if (user_options->progress_only == true) { user_options->speed_only = true; @@ -1373,7 +1394,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) if (user_options->attack_mode == ATTACK_MODE_BF) { - if (user_options->opencl_info == true) + if (user_options->example_hashes == true) + { + + } + else if (user_options->opencl_info == true) { } @@ -1462,6 +1487,10 @@ void user_options_extra_init (hashcat_ctx_t *hashcat_ctx) if (user_options->benchmark == true) { + } + else if (user_options->example_hashes == true) + { + } else if (user_options->opencl_info == true) { @@ -2107,6 +2136,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx) logfile_top_uint (user_options->bitmap_max); logfile_top_uint (user_options->bitmap_min); logfile_top_uint (user_options->debug_mode); + logfile_top_uint (user_options->example_hashes); logfile_top_uint (user_options->force); logfile_top_uint (user_options->gpu_temp_abort); logfile_top_uint (user_options->gpu_temp_disable); diff --git a/src/wordlist.c b/src/wordlist.c index 30597754e..82395c964 100644 --- a/src/wordlist.c +++ b/src/wordlist.c @@ -498,11 +498,12 @@ int wl_data_init (hashcat_ctx_t *hashcat_ctx) wl_data->enabled = false; - if (user_options->benchmark == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->example_hashes == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; wl_data->enabled = true;