mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-09 07:11:03 +00:00
Added support to include source wordlist in debugging format
This commit is contained in:
parent
c625272929
commit
2ff7d0bb4d
@ -62,12 +62,14 @@ static void debugfile_format_plain (hashcat_ctx_t *hashcat_ctx, const u8 *plain_
|
||||
void debugfile_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *rule_buf, const u32 rule_len, const u8 *mod_plain_ptr, const u32 mod_plain_len, const u8 *orig_plain_ptr, const u32 orig_plain_len)
|
||||
{
|
||||
debugfile_ctx_t *debugfile_ctx = hashcat_ctx->debugfile_ctx;
|
||||
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||
|
||||
if (debugfile_ctx->enabled == false) return;
|
||||
|
||||
const u32 debug_mode = debugfile_ctx->mode;
|
||||
|
||||
if ((debug_mode == 2) || (debug_mode == 3) || (debug_mode == 4))
|
||||
if ((debug_mode == 2) || (debug_mode == 3) || (debug_mode == 4) || (debug_mode == 5))
|
||||
{
|
||||
debugfile_format_plain (hashcat_ctx, orig_plain_ptr, orig_plain_len);
|
||||
|
||||
@ -76,13 +78,31 @@ void debugfile_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *rule_buf, con
|
||||
|
||||
hc_fwrite ((void *) rule_buf, rule_len, 1, &debugfile_ctx->fp);
|
||||
|
||||
if (debug_mode == 4)
|
||||
if ((debug_mode == 4) || (debug_mode == 5))
|
||||
{
|
||||
hc_fputc (':', &debugfile_ctx->fp);
|
||||
|
||||
debugfile_format_plain (hashcat_ctx, mod_plain_ptr, mod_plain_len);
|
||||
}
|
||||
|
||||
if (debug_mode == 5)
|
||||
{
|
||||
hc_fputc (':', &debugfile_ctx->fp);
|
||||
|
||||
if (user_options_extra->wordlist_mode == WL_MODE_FILE)
|
||||
{
|
||||
hc_fprintf (&debugfile_ctx->fp, "%s", straight_ctx->dict);
|
||||
}
|
||||
else if (user_options_extra->wordlist_mode == WL_MODE_STDIN)
|
||||
{
|
||||
hc_fprintf (&debugfile_ctx->fp, "<stdin>");
|
||||
}
|
||||
else
|
||||
{
|
||||
hc_fprintf (&debugfile_ctx->fp, "<none>");
|
||||
}
|
||||
}
|
||||
|
||||
hc_fwrite (EOL, strlen (EOL), 1, &debugfile_ctx->fp);
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
pw_pre_t *pw_base = device_param->pws_base_buf + gidvid;
|
||||
|
||||
// save rule
|
||||
if ((debug_mode == 1) || (debug_mode == 3) || (debug_mode == 4))
|
||||
if ((debug_mode == 1) || (debug_mode == 3) || (debug_mode == 4) || (debug_mode == 5))
|
||||
{
|
||||
const int len = kernel_rule_to_cpu_rule ((char *) debug_rule_buf, &straight_ctx->kernel_rules_buf[pw_base->rule_idx]);
|
||||
|
||||
@ -449,7 +449,7 @@ int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
}
|
||||
|
||||
// save plain
|
||||
if ((debug_mode == 2) || (debug_mode == 3) || (debug_mode == 4))
|
||||
if ((debug_mode == 2) || (debug_mode == 3) || (debug_mode == 4) || (debug_mode == 5))
|
||||
{
|
||||
memcpy (debug_plain_ptr, pw_base->base_buf, pw_base->base_len);
|
||||
|
||||
@ -471,7 +471,7 @@ int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
const u64 off = device_param->innerloop_pos + il_pos;
|
||||
|
||||
// save rule
|
||||
if ((debug_mode == 1) || (debug_mode == 3) || (debug_mode == 4))
|
||||
if ((debug_mode == 1) || (debug_mode == 3) || (debug_mode == 4) || (debug_mode == 5))
|
||||
{
|
||||
const int len = kernel_rule_to_cpu_rule ((char *) debug_rule_buf, &straight_ctx->kernel_rules_buf[off]);
|
||||
|
||||
@ -481,7 +481,7 @@ int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
|
||||
}
|
||||
|
||||
// save plain
|
||||
if ((debug_mode == 2) || (debug_mode == 3) || (debug_mode == 4))
|
||||
if ((debug_mode == 2) || (debug_mode == 3) || (debug_mode == 4) || (debug_mode == 5))
|
||||
{
|
||||
memcpy (debug_plain_ptr, (char *) pw.i, (size_t) plain_len);
|
||||
|
||||
|
@ -1107,7 +1107,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->debug_mode > 4)
|
||||
if (user_options->debug_mode > 5)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Invalid --debug-mode value specified.");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user