1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-21 23:58:07 +00:00

Prepare options and usage for --outfile-json

This commit is contained in:
jsteube 2023-10-06 08:21:07 +00:00
parent ec4ce2ed89
commit e6715fbd89
2 changed files with 12 additions and 0 deletions

View File

@ -57,6 +57,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
" --restore-file-path | File | Specific path to restore file | --restore-file-path=x.restore",
" -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
" --outfile-format | Str | Outfile format to use, separated with commas | --outfile-format=1,3",
" --outfile-json | | Force JSON format in outfile format |",
" --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
" --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check-timer=30",
" --wordlist-autohex-disable | | Disable the conversion of $HEX[] from the wordlist |",

View File

@ -103,6 +103,7 @@ static const struct option long_options[] =
{"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-json", no_argument, NULL, IDX_OUTFILE_JSON},
{"outfile", required_argument, NULL, IDX_OUTFILE},
{"potfile-disable", no_argument, NULL, IDX_POTFILE_DISABLE},
{"potfile-path", required_argument, NULL, IDX_POTFILE_PATH},
@ -246,6 +247,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->outfile_check_dir = NULL;
user_options->outfile_check_timer = OUTFILE_CHECK_TIMER;
user_options->outfile_format = OUTFILE_FORMAT;
user_options->outfile_json = OUTFILE_JSON;
user_options->outfile = NULL;
user_options->potfile_disable = POTFILE_DISABLE;
user_options->potfile_path = NULL;
@ -463,6 +465,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
user_options->outfile_chgd = true; break;
case IDX_OUTFILE_FORMAT: user_options->outfile_format = outfile_format_parse (optarg);
user_options->outfile_format_chgd = true; break;
case IDX_OUTFILE_JSON: user_options->outfile_json = 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;
@ -1078,6 +1081,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->outfile_json == false)
{
event_log_error (hashcat_ctx, "Mixing --outfile-json is not allowed with --show.");
return -1;
}
}
if (user_options->keyspace == true)
@ -3252,6 +3262,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_uint (user_options->outfile_autohex);
logfile_top_uint (user_options->outfile_check_timer);
logfile_top_uint (user_options->outfile_format);
logfile_top_uint (user_options->outfile_json);
logfile_top_uint (user_options->wordlist_autohex_disable);
logfile_top_uint (user_options->potfile_disable);
logfile_top_uint (user_options->progress_only);