diff --git a/include/types.h b/include/types.h index f7bf31599..4783170f9 100644 --- a/include/types.h +++ b/include/types.h @@ -1174,7 +1174,7 @@ typedef struct outfile_ctx FILE *fp; u32 outfile_format; - u32 outfile_autohex; + bool outfile_autohex; } outfile_ctx_t; diff --git a/src/outfile.c b/src/outfile.c index 8bb4b4624..1cb7c8645 100644 --- a/src/outfile.c +++ b/src/outfile.c @@ -326,8 +326,9 @@ void outfile_write_close (hashcat_ctx_t *hashcat_ctx) int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, char tmp_buf[HCBUFSIZ_LARGE]) { - const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; - const outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx; + const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; + const outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx; + const user_options_t *user_options = hashcat_ctx->user_options; int tmp_len = 0; @@ -366,7 +367,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign if (outfile_ctx->outfile_format & OUTFILE_FMT_PLAIN) { - if (need_hexify (plain_ptr, plain_len) == true) + if ((user_options->outfile_autohex == true) && (need_hexify (plain_ptr, plain_len) == true)) { tmp_buf[tmp_len++] = '$'; tmp_buf[tmp_len++] = 'H'; diff --git a/src/potfile.c b/src/potfile.c index 4c99054f8..3e7fd378c 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -267,7 +267,8 @@ void potfile_write_close (hashcat_ctx_t *hashcat_ctx) void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, u8 *plain_ptr, unsigned int plain_len) { - potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; + const potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx; + const user_options_t *user_options = hashcat_ctx->user_options; if (potfile_ctx->enabled == false) return; @@ -290,7 +291,7 @@ void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, u8 * if (1) { - if (need_hexify (plain_ptr, plain_len) == true) + if ((user_options->outfile_autohex == true) && (need_hexify (plain_ptr, plain_len) == true)) { tmp_buf[tmp_len++] = '$'; tmp_buf[tmp_len++] = 'H'; diff --git a/src/user_options.c b/src/user_options.c index 3446e2c6f..80a60544d 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -285,7 +285,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) case IDX_OUTFILE: user_options->outfile = optarg; break; case IDX_OUTFILE_FORMAT: user_options->outfile_format = atoi (optarg); user_options->outfile_format_chgd = true; break; - case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = 0; break; + case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = false; break; case IDX_OUTFILE_CHECK_TIMER: user_options->outfile_check_timer = atoi (optarg); break; case IDX_HEX_CHARSET: user_options->hex_charset = true; break; case IDX_HEX_SALT: user_options->hex_salt = true; break;