diff --git a/docs/changes.txt b/docs/changes.txt index b3defa74b..f5f46ca37 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -19,6 +19,7 @@ ## - Fixed a problem where --keyspace combined with custom charsets incorrectly displayed an error message +- Fixed a problem where --stdout combined with custom charsets incorrectly displayed an error message - Fixed a typo that resulted in the minimum password length not being correctly initialized - Fixed a problem with parsing and displaying -m 7000 = Fortigate (FortiOS) hashes diff --git a/src/user_options.c b/src/user_options.c index 938e7d49c..f5362bff1 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -821,14 +821,28 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) return -1; } - if (user_options->hc_argc < 2) + // 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 { - if (user_options->keyspace == false) // --keyspace would be a special case, i.e. we do not need a hash file - { - event_log_error (hashcat_ctx, "You need to specify a mask if you specify a custom-charset"); + 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; + } - return -1; - } + if (mask_is_missing == true) + { + event_log_error (hashcat_ctx, "You need to specify a mask if you specify a custom-charset"); + + return -1; } }