User Options: assigned -H to --hash-info | Hash-Info: show more details using -HH

pull/3724/head
Gabriele Gristina 1 year ago
parent bf1d7d0789
commit 1ea8ff2ec2

@ -88,6 +88,8 @@
- Metal Backend: added workaround to prevent 'Infinite Loop' bug when build kernels
- User Options: added --metal-compiler-runtime option
- Help: show supported hash-modes only with -hh
- User Options: assigned -H to --hash-info
- Hash-Info: show more details using -HH
* changes v6.2.5 -> v6.2.6

@ -425,7 +425,7 @@ _hashcat ()
local HIDDEN_FILES_AGGRESSIVE="${HIDDEN_FILES}|hcmask|hcchr"
local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H'
local SHORT_OPTS="-m -a -V -h -b -t -T -o -p -c -d -D -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z -M -Y"
local SHORT_OPTS="-m -a -V -h -H -b -t -T -o -p -c -d -D -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z -M -Y"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --stdin-timeout-abort --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-inverse --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 --deprecated-check-disable --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 --hash-info --backend-ignore-cuda --backend-ignore-opencl --backend-ignore-hip --backend-ignore-metal --backend-info --backend-devices --backend-devices-virtual --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --multiply-accel-disable --self-test-disable --slow-candidates --brain-server --brain-server-timer --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password --identify"
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 --stdin-timeout-abort --markov-hcstat2 --markov-threshold --runtime --session --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 --backend-devices --backend-devices-virtual --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-server-timer --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-session-whitelist"
@ -729,11 +729,11 @@ _hashcat ()
while [ ${h} -le ${COMP_CWORD} ]; do
if [[ "${COMP_WORDS[h]}" == "-a" ]]; then
if [[ "${COMP_WORDS[h]}" == "-a" ]]; then
attack_mode=${COMP_WORDS[$((h + 1))]}
elif [[ "${COMP_WORDS[h]}" == -a* ]]; then
elif [[ "${COMP_WORDS[h]}" == -a* ]]; then
attack_mode=${COMP_WORDS[h]:2}

@ -649,7 +649,7 @@ typedef enum user_options_defaults
#else
HWMON_TEMP_ABORT = 90,
#endif
HASH_INFO = false,
HASH_INFO = 0,
HASH_MODE = 0,
HCCAPX_MESSAGE_PAIR = 0,
HEX_CHARSET = false,
@ -762,89 +762,89 @@ typedef enum user_options_map
IDX_DEPRECATED_CHECK_DISABLE = 0xff14,
IDX_ENCODING_FROM = 0xff15,
IDX_ENCODING_TO = 0xff16,
IDX_HASH_INFO = 0xff17,
IDX_FORCE = 0xff18,
IDX_HWMON_DISABLE = 0xff19,
IDX_HWMON_TEMP_ABORT = 0xff1a,
IDX_HASH_INFO = 'H',
IDX_FORCE = 0xff17,
IDX_HWMON_DISABLE = 0xff18,
IDX_HWMON_TEMP_ABORT = 0xff19,
IDX_HASH_MODE = 'm',
IDX_HCCAPX_MESSAGE_PAIR = 0xff1b,
IDX_HCCAPX_MESSAGE_PAIR = 0xff1a,
IDX_HELP = 'h',
IDX_HEX_CHARSET = 0xff1c,
IDX_HEX_SALT = 0xff1d,
IDX_HEX_WORDLIST = 0xff1e,
IDX_HOOK_THREADS = 0xff1f,
IDX_IDENTIFY = 0xff20,
IDX_HEX_CHARSET = 0xff1b,
IDX_HEX_SALT = 0xff1c,
IDX_HEX_WORDLIST = 0xff1d,
IDX_HOOK_THREADS = 0xff1e,
IDX_IDENTIFY = 0xff1f,
IDX_INCREMENT = 'i',
IDX_INCREMENT_MAX = 0xff21,
IDX_INCREMENT_MIN = 0xff22,
IDX_INDUCTION_DIR = 0xff23,
IDX_KEEP_GUESSING = 0xff24,
IDX_INCREMENT_MAX = 0xff20,
IDX_INCREMENT_MIN = 0xff21,
IDX_INDUCTION_DIR = 0xff22,
IDX_KEEP_GUESSING = 0xff23,
IDX_KERNEL_ACCEL = 'n',
IDX_KERNEL_LOOPS = 'u',
IDX_KERNEL_THREADS = 'T',
IDX_KEYBOARD_LAYOUT_MAPPING = 0xff25,
IDX_KEYSPACE = 0xff26,
IDX_LEFT = 0xff27,
IDX_KEYBOARD_LAYOUT_MAPPING = 0xff24,
IDX_KEYSPACE = 0xff25,
IDX_LEFT = 0xff26,
IDX_LIMIT = 'l',
IDX_LOGFILE_DISABLE = 0xff28,
IDX_LOOPBACK = 0xff29,
IDX_MACHINE_READABLE = 0xff2a,
IDX_MARKOV_CLASSIC = 0xff2b,
IDX_MARKOV_DISABLE = 0xff2c,
IDX_MARKOV_HCSTAT2 = 0xff2d,
IDX_MARKOV_INVERSE = 0xff2e,
IDX_LOGFILE_DISABLE = 0xff27,
IDX_LOOPBACK = 0xff28,
IDX_MACHINE_READABLE = 0xff29,
IDX_MARKOV_CLASSIC = 0xff2a,
IDX_MARKOV_DISABLE = 0xff2b,
IDX_MARKOV_HCSTAT2 = 0xff2c,
IDX_MARKOV_INVERSE = 0xff2d,
IDX_MARKOV_THRESHOLD = 't',
IDX_METAL_COMPILER_RUNTIME = 0xff2f,
IDX_NONCE_ERROR_CORRECTIONS = 0xff30,
IDX_METAL_COMPILER_RUNTIME = 0xff2e,
IDX_NONCE_ERROR_CORRECTIONS = 0xff2f,
IDX_OPENCL_DEVICE_TYPES = 'D',
IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
IDX_MULTIPLY_ACCEL_DISABLE = 'M',
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff31,
IDX_OUTFILE_CHECK_DIR = 0xff32,
IDX_OUTFILE_CHECK_TIMER = 0xff33,
IDX_OUTFILE_FORMAT = 0xff34,
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff30,
IDX_OUTFILE_CHECK_DIR = 0xff31,
IDX_OUTFILE_CHECK_TIMER = 0xff32,
IDX_OUTFILE_FORMAT = 0xff33,
IDX_OUTFILE = 'o',
IDX_POTFILE_DISABLE = 0xff35,
IDX_POTFILE_PATH = 0xff36,
IDX_PROGRESS_ONLY = 0xff37,
IDX_QUIET = 0xff38,
IDX_REMOVE = 0xff39,
IDX_REMOVE_TIMER = 0xff3a,
IDX_RESTORE = 0xff3b,
IDX_RESTORE_DISABLE = 0xff3c,
IDX_RESTORE_FILE_PATH = 0xff3d,
IDX_POTFILE_DISABLE = 0xff34,
IDX_POTFILE_PATH = 0xff35,
IDX_PROGRESS_ONLY = 0xff36,
IDX_QUIET = 0xff37,
IDX_REMOVE = 0xff38,
IDX_REMOVE_TIMER = 0xff39,
IDX_RESTORE = 0xff3a,
IDX_RESTORE_DISABLE = 0xff3b,
IDX_RESTORE_FILE_PATH = 0xff3c,
IDX_RP_FILE = 'r',
IDX_RP_GEN_FUNC_MAX = 0xff3e,
IDX_RP_GEN_FUNC_MIN = 0xff3f,
IDX_RP_GEN_FUNC_SEL = 0xff40,
IDX_RP_GEN_FUNC_MAX = 0xff3d,
IDX_RP_GEN_FUNC_MIN = 0xff3e,
IDX_RP_GEN_FUNC_SEL = 0xff3f,
IDX_RP_GEN = 'g',
IDX_RP_GEN_SEED = 0xff41,
IDX_RP_GEN_SEED = 0xff40,
IDX_RULE_BUF_L = 'j',
IDX_RULE_BUF_R = 'k',
IDX_RUNTIME = 0xff42,
IDX_SCRYPT_TMTO = 0xff43,
IDX_RUNTIME = 0xff41,
IDX_SCRYPT_TMTO = 0xff42,
IDX_SEGMENT_SIZE = 'c',
IDX_SELF_TEST_DISABLE = 0xff44,
IDX_SELF_TEST_DISABLE = 0xff43,
IDX_SEPARATOR = 'p',
IDX_SESSION = 0xff45,
IDX_SHOW = 0xff46,
IDX_SESSION = 0xff44,
IDX_SHOW = 0xff45,
IDX_SKIP = 's',
IDX_SLOW_CANDIDATES = 'S',
IDX_SPEED_ONLY = 0xff47,
IDX_SPIN_DAMP = 0xff48,
IDX_STATUS = 0xff49,
IDX_STATUS_JSON = 0xff4a,
IDX_STATUS_TIMER = 0xff4b,
IDX_STDOUT_FLAG = 0xff4c,
IDX_STDIN_TIMEOUT_ABORT = 0xff4d,
IDX_TRUECRYPT_KEYFILES = 0xff4e,
IDX_USERNAME = 0xff4f,
IDX_VERACRYPT_KEYFILES = 0xff50,
IDX_VERACRYPT_PIM_START = 0xff51,
IDX_VERACRYPT_PIM_STOP = 0xff52,
IDX_SPEED_ONLY = 0xff46,
IDX_SPIN_DAMP = 0xff47,
IDX_STATUS = 0xff48,
IDX_STATUS_JSON = 0xff49,
IDX_STATUS_TIMER = 0xff4a,
IDX_STDOUT_FLAG = 0xff4b,
IDX_STDIN_TIMEOUT_ABORT = 0xff4c,
IDX_TRUECRYPT_KEYFILES = 0xff4d,
IDX_USERNAME = 0xff4e,
IDX_VERACRYPT_KEYFILES = 0xff4f,
IDX_VERACRYPT_PIM_START = 0xff50,
IDX_VERACRYPT_PIM_STOP = 0xff51,
IDX_VERSION_LOWER = 'v',
IDX_VERSION = 'V',
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff53,
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff52,
IDX_WORKLOAD_PROFILE = 'w',
} user_options_map_t;
@ -2331,7 +2331,6 @@ typedef struct user_options
bool force;
bool deprecated_check_disable;
bool hwmon_disable;
bool hash_info;
bool hex_charset;
bool hex_salt;
bool hex_wordlist;
@ -2415,6 +2414,7 @@ typedef struct user_options
#endif
u32 debug_mode;
u32 hwmon_temp_abort;
u32 hash_info;
int hash_mode;
u32 hccapx_message_pair;
u32 hook_threads;

@ -4255,8 +4255,8 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
backend_ctx->enabled = false;
if (user_options->usage > 0) return 0;
if (user_options->hash_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;

@ -81,8 +81,8 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;

@ -21,8 +21,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;
if (user_options->version == true) return 0;

@ -17,8 +17,8 @@ int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;

@ -118,9 +118,9 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;

@ -58,9 +58,9 @@ int dictstat_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;

@ -1228,8 +1228,8 @@ int hwmon_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info > 0) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;

@ -41,9 +41,9 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;

@ -355,7 +355,7 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx)
hashconfig->has_optimized_kernel = hc_path_read (source_file);
if (user_options->hash_info == false)
if (user_options->hash_info == 0 || user_options->hash_info > 1)
{
if (user_options->optimized_kernel_enable == true)
{

@ -62,9 +62,9 @@ int loopback_init (hashcat_ctx_t *hashcat_ctx)
if (user_options->usage > 0) return 0;
if (user_options->backend_info > 0) return 0;
if (user_options->hash_info > 0) return 0;
if (user_options->benchmark == true) return 0;
if (user_options->hash_info == true) return 0;
if (user_options->keyspace == true) return 0;
if (user_options->left == true) return 0;
if (user_options->show == true) return 0;

@ -192,12 +192,13 @@ static void main_outerloop_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MA
status_ctx->shutdown_outer = false;
if (user_options->hash_info == true) return;
if (user_options->backend_info > 0) return;
if (user_options->hash_info > 0) return;
if (user_options->keyspace == true) return;
if (user_options->stdout_flag == true) return;
if (user_options->speed_only == true) return;
if (user_options->identify == true) return;
if (user_options->backend_info > 0) return;
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{
@ -269,10 +270,11 @@ 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->hash_info == true) return;
if (user_options->backend_info > 0) return;
if (user_options->hash_info > 0) return;
if (user_options->keyspace == true) return;
if (user_options->stdout_flag == true) return;
if (user_options->backend_info > 0) return;
// if we had a prompt, clear it
@ -1318,7 +1320,7 @@ int main (int argc, char **argv)
rc_final = 0;
}
else if (user_options->hash_info == true)
else if (user_options->hash_info > 0)
{
hash_info (hashcat_ctx);

@ -87,7 +87,7 @@ void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag)
event_log_info (hashcat_ctx, "%s (%s) starting in autodetect mode", PROGNAME, version_tag);
event_log_info (hashcat_ctx, NULL);
}
else if (user_options->hash_info == true)
else if (user_options->hash_info > 0)
{
event_log_info (hashcat_ctx, "%s (%s) starting in hash-info mode", PROGNAME, version_tag);
event_log_info (hashcat_ctx, NULL);
@ -634,7 +634,7 @@ void compress_terminal_line_length (char *out_buf, const size_t keep_from_beginn
*ptr1 = 0;
}
void json_encode (char *text, char *escaped)
void json_encode (const char *text, char *escaped)
{
/*
* Based on https://www.freeformatter.com/json-escape.html, below these 7 different chars
@ -667,6 +667,8 @@ void json_encode (char *text, char *escaped)
void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *user_options_extra)
{
const user_options_t *user_options = hashcat_ctx->user_options;
if (hashconfig_init (hashcat_ctx) == 0)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -677,25 +679,66 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
printf ("\"category\": \"%s\", ", strhashcategory (hashconfig->hash_category));
printf ("\"slow_hash\": %s, ", (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) ? "false" : "true");
printf ("\"password_len_min\": %u, ", hashconfig->pw_min);
printf ("\"password_len_max\": %u, ", hashconfig->pw_max);
printf ("\"is_deprecated\": %s, ", (module_ctx->module_deprecated_notice != MODULE_DEFAULT) ? "true" : "false");
if (module_ctx->module_deprecated_notice != MODULE_DEFAULT) {
const char *deprecated_notice = module_ctx->module_deprecated_notice (hashconfig, hashcat_ctx->user_options, user_options_extra);
printf ("\"deprecated_notice\": \"%s\", ", deprecated_notice);
if (module_ctx->module_deprecated_notice != MODULE_DEFAULT)
{
const char *t_deprecated_notice = module_ctx->module_deprecated_notice (hashconfig, hashcat_ctx->user_options, user_options_extra);
char *t_deprecated_notice_json_encoded = (char *) hcmalloc (strlen (t_deprecated_notice) * 2);
json_encode (t_deprecated_notice, t_deprecated_notice_json_encoded);
printf ("\"deprecated_notice\": \"%s\", ", t_deprecated_notice_json_encoded);
hcfree (t_deprecated_notice_json_encoded);
}
else
{
printf ("\"deprecated_notice\": \"%s\", ", "N/A");
}
const char *t_pw_desc = (hashconfig->opts_type & OPTS_TYPE_PT_HEX) ? "HEX" : "plain";
u32 t_pw_min = hashconfig->pw_min;
u32 t_pw_max = hashconfig->pw_max;
if (user_options->hash_info > 1)
{
if (hashconfig->opts_type & OPTS_TYPE_PT_HEX)
{
t_pw_min *= 2;
t_pw_max *= 2;
}
}
printf ("\"password_type\": %s, ", t_pw_desc);
printf ("\"password_len_min\": %u, ", t_pw_min);
printf ("\"password_len_max\": %u, ", t_pw_max);
printf ("\"is_salted\": %s, ", (hashconfig->is_salted == true) ? "true" : "false");
if (hashconfig->is_salted == true)
{
u32 t = hashconfig->salt_type;
const char *t_desc = (t == SALT_TYPE_EMBEDDED) ? "embedded" : (t == SALT_TYPE_GENERIC) ? "generic" : "virtual";
printf ("\"salt_type\": \"%s\", ", t_desc);
printf ("\"salt_len_min\": %u, ", hashconfig->salt_min);
printf ("\"salt_len_max\": %u, ", hashconfig->salt_max);
const char *t_salt_desc = (t == SALT_TYPE_EMBEDDED) ? "embedded" : (t == SALT_TYPE_GENERIC) ? "generic" : "virtual";
u32 t_salt_min = hashconfig->salt_min;
u32 t_salt_max = hashconfig->salt_max;
if (user_options->hash_info > 1)
{
if (hashconfig->opts_type & OPTS_TYPE_ST_HEX)
{
t_salt_min *= 2;
t_salt_max *= 2;
}
}
printf ("\"salt_type\": \"%s\", ", t_salt_desc);
printf ("\"salt_len_min\": %u, ", t_salt_min);
printf ("\"salt_len_max\": %u, ", t_salt_max);
}
if ((hashconfig->has_pure_kernel) && (hashconfig->has_optimized_kernel))
@ -711,6 +754,36 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
printf ("\"kernel_type\": %s, ", "[ \"optimized\" ]");
}
if (user_options->hash_info > 1)
{
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
printf ("\"kernel_type_filter\": %s, ", "[ \"optimized\" ]");
}
else
{
printf ("\"kernel_type_filter\": %s, ", "[ \"pure\" ]");
}
printf ("\"attack_mode_filter\": %d, ", user_options->attack_mode);
// almost always 1 and -1
printf ("\"hashes_count_min\": %d, ", hashconfig->hashes_count_min);
printf ("\"hashes_count_max\": %d, ", hashconfig->hashes_count_max);
bool multi_hash_same_salt = true;
if ((hashconfig->opts_type & OPTS_TYPE_DEEP_COMP_KERNEL) == 0)
{
if (hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
{
multi_hash_same_salt = false;
}
}
printf ("\"hashes_with_same_salt\": %s, ", (multi_hash_same_salt == true) ? "true" : "false");
}
if ((hashconfig->st_hash != NULL) && (hashconfig->st_pass != NULL))
{
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
@ -731,7 +804,7 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
char *example_hash_json_encoded = (char *) hcmalloc (strlen (hashconfig->st_hash) * 2);
json_encode ((char *)hashconfig->st_hash, example_hash_json_encoded);
json_encode (hashconfig->st_hash, example_hash_json_encoded);
printf ("\"example_hash\": \"%s\", ", example_hash_json_encoded);
@ -807,6 +880,7 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
printf ("\"autodetect_enabled\": %s, ", (hashconfig->opts_type & OPTS_TYPE_AUTODETECT_DISABLE) ? "false" : "true");
printf ("\"self_test_enabled\": %s, ", (hashconfig->opts_type & OPTS_TYPE_SELF_TEST_DISABLE) ? "false" : "true");
printf ("\"potfile_enabled\": %s, ", (hashconfig->opts_type & OPTS_TYPE_POTFILE_NOPASS) ? "false" : "true");
printf ("\"keep_guessing\": %s, ", (hashconfig->opts_type & OPTS_TYPE_SUGGEST_KG) ? "true" : "false");
printf ("\"custom_plugin\": %s, ", (hashconfig->opts_type & OPTS_TYPE_STOCK_MODULE) ? "false" : "true");
if (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_ASCII)
@ -821,8 +895,6 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
{
printf ("\"plaintext_encoding\": %s", "[ \"ASCII\", \"HEX\" ]");
}
event_log_info (hashcat_ctx, NULL);
}
printf (" }");
@ -832,30 +904,69 @@ void hash_info_single_json (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *us
void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *user_options_extra)
{
const user_options_t *user_options = hashcat_ctx->user_options;
if (hashconfig_init (hashcat_ctx) == 0)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
module_ctx_t *module_ctx = hashcat_ctx->module_ctx;
event_log_info (hashcat_ctx, "Hash mode #%u", hashconfig->hash_mode);
event_log_info (hashcat_ctx, " Name................: %s", hashconfig->hash_name);
event_log_info (hashcat_ctx, " Category............: %s", strhashcategory (hashconfig->hash_category));
event_log_info (hashcat_ctx, " Slow.Hash...........: %s", (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) ? "No" : "Yes");
event_log_info (hashcat_ctx, " Password.Len.Min....: %u", hashconfig->pw_min);
event_log_info (hashcat_ctx, " Password.Len.Max....: %u", hashconfig->pw_max);
event_log_info (hashcat_ctx, " Deprecated..........: %s", (module_ctx->module_deprecated_notice != MODULE_DEFAULT) ? "Yes" : "No");
char *t_deprecated_notice = "N/A\0";
if (module_ctx->module_deprecated_notice != MODULE_DEFAULT)
{
t_deprecated_notice = (char *) module_ctx->module_deprecated_notice (hashconfig, hashcat_ctx->user_options, user_options_extra);
}
event_log_info (hashcat_ctx, " Deprecated.Notice...: %s", t_deprecated_notice);
const char *t_pw_desc = (hashconfig->opts_type & OPTS_TYPE_PT_HEX) ? "HEX\0" : "plain\0";
u32 t_pw_min = hashconfig->pw_min;
u32 t_pw_max = hashconfig->pw_max;
if (user_options->hash_info > 1)
{
if (hashconfig->opts_type & OPTS_TYPE_PT_HEX)
{
t_pw_min *= 2;
t_pw_max *= 2;
}
}
event_log_info (hashcat_ctx, " Password.Type.......: %s", t_pw_desc);
event_log_info (hashcat_ctx, " Password.Len.Min....: %u", t_pw_min);
event_log_info (hashcat_ctx, " Password.Len.Max....: %u", t_pw_max);
if (hashconfig->is_salted == true)
{
u32 t = hashconfig->salt_type;
const char *t_desc = (t == SALT_TYPE_EMBEDDED) ? "Embedded\0" : (t == SALT_TYPE_GENERIC) ? "Generic\0" : "Virtual\0";
event_log_info (hashcat_ctx, " Salt.Type...........: %s", t_desc);
event_log_info (hashcat_ctx, " Salt.Len.Min........: %u", hashconfig->salt_min);
event_log_info (hashcat_ctx, " Salt.Len.Max........: %u", hashconfig->salt_max);
}
// almost always 1 and -1
//event_log_info (hashcat_ctx, " Hashes.Count.Min....: %d", hashconfig->hashes_count_min);
//event_log_info (hashcat_ctx, " Hashes.Count.Max....: %u", hashconfig->hashes_count_max);
const char *t_salt_desc = (t == SALT_TYPE_EMBEDDED) ? "Embedded\0" : (t == SALT_TYPE_GENERIC) ? "Generic\0" : "Virtual\0";
u32 t_salt_min = hashconfig->salt_min;
u32 t_salt_max = hashconfig->salt_max;
if (user_options->hash_info > 1)
{
if (hashconfig->opts_type & OPTS_TYPE_ST_HEX)
{
t_salt_min *= 2;
t_salt_max *= 2;
}
}
event_log_info (hashcat_ctx, " Salt.Type...........: %s", t_salt_desc);
event_log_info (hashcat_ctx, " Salt.Len.Min........: %u", t_salt_min);
event_log_info (hashcat_ctx, " Salt.Len.Max........: %u", t_salt_max);
}
if ((hashconfig->has_pure_kernel) && (hashconfig->has_optimized_kernel))
{
@ -870,6 +981,36 @@ void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *user_op
event_log_info (hashcat_ctx, " Kernel.Type(s)......: optimized");
}
if (user_options->hash_info > 1)
{
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
event_log_info (hashcat_ctx, " Kernel.Type.Filter..: optimized");
}
else
{
event_log_info (hashcat_ctx, " Kernel.Type.Filter..: pure");
}
event_log_info (hashcat_ctx, " Attack.Mode.Filter..: %u", user_options->attack_mode);
// almost always 1 and -1
event_log_info (hashcat_ctx, " Hashes.Count.Min....: %d", hashconfig->hashes_count_min);
event_log_info (hashcat_ctx, " Hashes.Count.Max....: %d", hashconfig->hashes_count_max);
bool multi_hash_same_salt = true;
if ((hashconfig->opts_type & OPTS_TYPE_DEEP_COMP_KERNEL) == 0)
{
if (hashconfig->attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
{
multi_hash_same_salt = false;
}
}
event_log_info (hashcat_ctx, " Hashes.w/.Same.Salt.: %s", (multi_hash_same_salt == true) ? "Allowed" : "Not allowed");
}
if ((hashconfig->st_hash != NULL) && (hashconfig->st_pass != NULL))
{
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
@ -973,6 +1114,7 @@ void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *user_op
event_log_info (hashcat_ctx, " Autodetect.Enabled..: %s", (hashconfig->opts_type & OPTS_TYPE_AUTODETECT_DISABLE) ? "No" : "Yes");
event_log_info (hashcat_ctx, " Self.Test.Enabled...: %s", (hashconfig->opts_type & OPTS_TYPE_SELF_TEST_DISABLE) ? "No" : "Yes");
event_log_info (hashcat_ctx, " Potfile.Enabled.....: %s", (hashconfig->opts_type & OPTS_TYPE_POTFILE_NOPASS) ? "No" : "Yes");
event_log_info (hashcat_ctx, " Keep.Guessing.......: %s", (hashconfig->opts_type & OPTS_TYPE_SUGGEST_KG) ? "Yes" : "No");
event_log_info (hashcat_ctx, " Custom.Plugin.......: %s", (hashconfig->opts_type & OPTS_TYPE_STOCK_MODULE) ? "No" : "Yes");
if (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_ASCII)
@ -1911,7 +2053,7 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
printf (",");
}
printf (" { \"device_id\": %u,", device_id + 1);
printf (" { \"device_id\": %d,", device_id + 1);
char *device_name_json_encoded = (char *) hcmalloc (strlen (device_info->device_name) * 2);
@ -2415,18 +2557,10 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
}
else
{
event_log_info (hashcat_ctx,
"Remaining........: %u (%.2f%%) Digests",
digests_remain,
digests_remain_percent);
event_log_info (hashcat_ctx, "Remaining........: %u (%.2f%%) Digests", digests_remain, digests_remain_percent);
}
}
if (hashcat_status->digests_cnt > 1000)
{
event_log_info (hashcat_ctx,
"Recovered/Time...: %s",
hashcat_status->cpt);
event_log_info (hashcat_ctx, "Recovered/Time...: %s", hashcat_status->cpt);
}
switch (hashcat_status->progress_mode)
@ -2750,7 +2884,7 @@ void status_speed_json (hashcat_ctx_t *hashcat_ctx)
printf (",");
}
printf (" { \"device_id\": %u,", device_id + 1);
printf (" { \"device_id\": %d,", device_id + 1);
printf (" \"speed\": %" PRIu64 " }", (u64) (device_info->hashes_msec_dev_benchmark * 1000));
device_num++;
}
@ -2867,7 +3001,7 @@ void status_progress_json (hashcat_ctx_t *hashcat_ctx)
printf (",");
}
printf (" { \"device_id\": %u,", device_id + 1);
printf (" { \"device_id\": %d,", device_id + 1);
printf (" \"progress\": %" PRIu64 ",", device_info->progress_dev);
printf (" \"runtime\": %0.2f }", device_info->runtime_msec_dev);
device_num++;

@ -92,7 +92,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
" --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",
" --hook-threads | Num | Sets number of threads for a hook (per compute unit) | --hook-threads=8",
" --hash-info | | Show information for each hash-mode |",
" -H, --hash-info | | Show information for each hash-mode | -H or -HH",
" --example-hashes | | Alias of --hash-info |",
" --backend-ignore-cuda | | Do not try to open CUDA interface on startup |",
" --backend-ignore-hip | | Do not try to open HIP interface on startup |",

@ -21,9 +21,9 @@
#endif
#ifdef WITH_BRAIN
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:OMSY:z";
static const char *const short_options = "hHVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSY:z";
#else
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:OMSY:";
static const char *const short_options = "hHVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSY:";
#endif
static char *const SEPARATOR = ":";
@ -410,7 +410,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_HASH_INFO: user_options->hash_info = true; break;
case IDX_HASH_INFO: user_options->hash_info++; 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 = hc_strtoull (optarg, NULL, 10);
@ -1275,7 +1275,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->hash_info == true)
if (user_options->hash_info > 0)
{
event_log_error (hashcat_ctx, "Use of --hash-info is not allowed in benchmark mode.");
@ -1444,6 +1444,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->hash_info > 2)
{
event_log_error (hashcat_ctx, "Invalid --hash-info/-H value, must have a value greater or equal to 0 and lower than 3.");
return -1;
}
#ifdef WITH_BRAIN
if ((user_options->brain_client == true) && (user_options->remove == true))
{
@ -1538,7 +1545,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
show_error = false;
}
}
else if (user_options->hash_info == true)
else if (user_options->hash_info > 0)
{
if (user_options->hc_argc == 0)
{
@ -1736,7 +1743,7 @@ void user_options_session_auto (hashcat_ctx_t *hashcat_ctx)
user_options->session = "benchmark";
}
if (user_options->hash_info == true)
if (user_options->hash_info > 0)
{
user_options->session = "hash_info";
}
@ -1819,12 +1826,12 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
user_options->bitmap_max = 1;
}
if (user_options->hash_info == true
|| user_options->keyspace == true
if (user_options->keyspace == true
|| user_options->speed_only == true
|| user_options->progress_only == true
|| user_options->identify == true
|| user_options->usage > 0
|| user_options->hash_info > 0
|| user_options->backend_info > 0)
{
user_options->hwmon_disable = true;
@ -1876,7 +1883,7 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
}
}
if (user_options->hash_info == true)
if (user_options->hash_info > 0)
{
user_options->quiet = true;
}
@ -1990,7 +1997,7 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
if (user_options->attack_mode == ATTACK_MODE_BF)
{
if (user_options->hash_info == true)
if (user_options->hash_info > 0)
{
}
@ -2246,7 +2253,7 @@ void user_options_extra_init (hashcat_ctx_t *hashcat_ctx)
{
}
else if (user_options->hash_info == true)
else if (user_options->hash_info > 0)
{
}

Loading…
Cancel
Save