Parameter: Detect and warn when users try to use an empty string (length 0) for parameters like --session=

Fixes https://github.com/hashcat/hashcat/issues/1190
pull/1195/head
jsteube 7 years ago
parent 53acb98cf8
commit d78a58414c

@ -30,6 +30,7 @@
- Building: Added missing prototypes for atlassian_parse_hash function
- Files: Detect and warn when users try to use -r with a parameter which is not a file
- Parameter: Detect and warn when users try to use an empty string (length 0) for parameters like --session=
- Sessions: Improved string comparison in case user sets --session to "hashcat"
* changes v3.30 -> v3.40:

@ -801,6 +801,96 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
}
}
if (user_options->markov_hcstat != NULL)
{
if (strlen (user_options->markov_hcstat) == 0)
{
event_log_error (hashcat_ctx, "If selected, option markov-hcstat can not have length zero string");
return -1;
}
}
if (user_options->restore_file_path != NULL)
{
if (strlen (user_options->restore_file_path) == 0)
{
event_log_error (hashcat_ctx, "If selected, option restore-file-path can not have length zero string");
return -1;
}
}
if (user_options->outfile != NULL)
{
if (strlen (user_options->outfile) == 0)
{
event_log_error (hashcat_ctx, "If selected, option outfile can not have length zero string");
return -1;
}
}
if (user_options->debug_file != NULL)
{
if (strlen (user_options->debug_file) == 0)
{
event_log_error (hashcat_ctx, "If selected, option debug-file can not have length zero string");
return -1;
}
}
if (user_options->session != NULL)
{
if (strlen (user_options->session) == 0)
{
event_log_error (hashcat_ctx, "If selected, option session can not have length zero string");
return -1;
}
}
if (user_options->cpu_affinity != NULL)
{
if (strlen (user_options->cpu_affinity) == 0)
{
event_log_error (hashcat_ctx, "If selected, option cpu-affinity can not have length zero string");
return -1;
}
}
if (user_options->opencl_platforms != NULL)
{
if (strlen (user_options->opencl_platforms) == 0)
{
event_log_error (hashcat_ctx, "If selected, option opencl-platforms can not have length zero string");
return -1;
}
}
if (user_options->opencl_devices != NULL)
{
if (strlen (user_options->opencl_devices) == 0)
{
event_log_error (hashcat_ctx, "If selected, option opencl-devices can not have length zero string");
return -1;
}
}
if (user_options->opencl_device_types != NULL)
{
if (strlen (user_options->opencl_device_types) == 0)
{
event_log_error (hashcat_ctx, "If selected, option opencl-device-types can not have length zero string");
return -1;
}
}
// custom charset checks
if ((user_options->custom_charset_1 != NULL)

Loading…
Cancel
Save