Debug Rules: Set --debug-file to $session.debugfile if --debug-mode was set by the user and --debug-file was not set

pull/3264/head
Jens Steube 2 years ago
parent a841af000f
commit ec7eae9886

@ -72,6 +72,7 @@
- Backend: with kernel build options, switch from -I to -D INCLUDE_PATH, in order to support Apple Metal runtime
- CUDA Backend: moved functions to ext_cuda.c/ext_nvrtc.c and includes to ext_cuda.h/ext_nvrtc.h
- Command Line: Disallow combinations of some options. for instance, using -t in -a 0 mode
- Debug Rules: Set --debug-file to $session.debugfile if --debug-mode was set by the user and --debug-file was not set
- Hardware Monitor: Add support for GPU device utilization readings using iokit on Apple Silicon (OpenCL and Metal)
- Hash Info: show more information (Updated Hash-Format. Added Autodetect, Self-Test, Potfile and Plaintext encoding)
- HIP Backend: moved functions to ext_hip.c/ext_hiprtc.c and includes to ext_hip.h/ext_hiprtc.h

@ -88,8 +88,9 @@ void debugfile_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *rule_buf, con
int debugfile_init (hashcat_ctx_t *hashcat_ctx)
{
debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
const folder_config_t *folder_config = hashcat_ctx->folder_config;
const user_options_t *user_options = hashcat_ctx->user_options;
debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx;
debugfile_ctx->enabled = false;
@ -109,38 +110,31 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx)
debugfile_ctx->enabled = true;
debugfile_ctx->mode = user_options->debug_mode;
debugfile_ctx->filename = user_options->debug_file;
debugfile_ctx->mode = user_options->debug_mode;
if (debugfile_ctx->filename)
if (user_options->debug_file == NULL)
{
if (hc_fopen (&debugfile_ctx->fp, debugfile_ctx->filename, "ab") == false)
{
event_log_error (hashcat_ctx, "Could not open --debug-file file for writing.");
return -1;
}
if (hc_lockfile (&debugfile_ctx->fp) == -1)
{
hc_fclose (&debugfile_ctx->fp);
hc_asprintf (&debugfile_ctx->filename, "%s/hashcat.debugfile", folder_config->profile_dir);
}
else
{
debugfile_ctx->filename = user_options->debug_file;
}
event_log_error (hashcat_ctx, "%s: %s", debugfile_ctx->filename, strerror (errno));
if (hc_fopen (&debugfile_ctx->fp, debugfile_ctx->filename, "ab") == false)
{
event_log_error (hashcat_ctx, "Could not open --debug-file file for writing.");
return -1;
}
return -1;
}
else
if (hc_lockfile (&debugfile_ctx->fp) == -1)
{
HCFILE *fp = &debugfile_ctx->fp;
fp->fd = fileno (stdout);
fp->pfp = stdout;
fp->gfp = NULL;
fp->ufp = NULL;
fp->bom_size = 0;
fp->path = NULL;
fp->mode = NULL;
hc_fclose (&debugfile_ctx->fp);
event_log_error (hashcat_ctx, "%s: %s", debugfile_ctx->filename, strerror (errno));
return -1;
}
return 0;

@ -1114,16 +1114,6 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->debug_file != NULL)
{
if (user_options->debug_mode < 1)
{
event_log_error (hashcat_ctx, "Parameter --debug-file requires --debug-mode.");
return -1;
}
}
if (user_options->induction_dir != NULL)
{
if (user_options->attack_mode == ATTACK_MODE_BF)

Loading…
Cancel
Save