mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-22 14:48:12 +00:00
update all HCFILE vars and related code
This commit is contained in:
parent
2db6dfcd4e
commit
3d39d2fc91
@ -10,7 +10,7 @@ typedef struct extra_info_straight
|
||||
{
|
||||
u64 pos;
|
||||
|
||||
HCFILE *fp;
|
||||
HCFILE fp;
|
||||
|
||||
u64 rule_pos_prev;
|
||||
u64 rule_pos;
|
||||
|
@ -1161,12 +1161,12 @@ typedef struct hc_device_param
|
||||
u32 *brain_link_out_buf;
|
||||
#endif
|
||||
|
||||
char *scratch_buf;
|
||||
char *scratch_buf;
|
||||
|
||||
HCFILE combs_fp;
|
||||
pw_t *combs_buf;
|
||||
HCFILE combs_fp;
|
||||
pw_t *combs_buf;
|
||||
|
||||
void *hooks_buf;
|
||||
void *hooks_buf;
|
||||
|
||||
pw_idx_t *pws_idx;
|
||||
u32 *pws_comp;
|
||||
@ -1555,11 +1555,12 @@ typedef aes_context_t aes_ctx;
|
||||
|
||||
typedef struct debugfile_ctx
|
||||
{
|
||||
bool enabled;
|
||||
HCFILE fp;
|
||||
|
||||
HCFILE *fp;
|
||||
char *filename;
|
||||
u32 mode;
|
||||
bool enabled;
|
||||
|
||||
char *filename;
|
||||
u32 mode;
|
||||
|
||||
} debugfile_ctx_t;
|
||||
|
||||
@ -1600,11 +1601,12 @@ typedef struct dictstat_ctx
|
||||
|
||||
typedef struct loopback_ctx
|
||||
{
|
||||
bool enabled;
|
||||
bool unused;
|
||||
HCFILE fp;
|
||||
|
||||
HCFILE *fp;
|
||||
char *filename;
|
||||
bool enabled;
|
||||
bool unused;
|
||||
|
||||
char *filename;
|
||||
|
||||
} loopback_ctx_t;
|
||||
|
||||
@ -1617,12 +1619,12 @@ typedef struct mf
|
||||
|
||||
typedef struct outfile_ctx
|
||||
{
|
||||
char *filename;
|
||||
HCFILE fp;
|
||||
|
||||
HCFILE *fp;
|
||||
u32 outfile_format;
|
||||
bool outfile_autohex;
|
||||
|
||||
u32 outfile_format;
|
||||
bool outfile_autohex;
|
||||
char *filename;
|
||||
|
||||
} outfile_ctx_t;
|
||||
|
||||
@ -1637,9 +1639,10 @@ typedef struct pot
|
||||
|
||||
typedef struct potfile_ctx
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
bool enabled;
|
||||
|
||||
HCFILE fp;
|
||||
char *filename;
|
||||
|
||||
u8 *out_buf; // allocates [HCBUFSIZ_LARGE];
|
||||
@ -1721,10 +1724,10 @@ typedef struct pidfile_ctx
|
||||
|
||||
typedef struct out
|
||||
{
|
||||
HCFILE *fp;
|
||||
HCFILE fp;
|
||||
|
||||
char buf[HCBUFSIZ_SMALL];
|
||||
int len;
|
||||
char buf[HCBUFSIZ_SMALL];
|
||||
int len;
|
||||
|
||||
} out_t;
|
||||
|
||||
|
@ -37,18 +37,18 @@ static void debugfile_format_plain (hashcat_ctx_t *hashcat_ctx, const u8 *plain_
|
||||
|
||||
if (needs_hexify == 1)
|
||||
{
|
||||
hc_fprintf (debugfile_ctx->fp, "$HEX[");
|
||||
hc_fprintf (&debugfile_ctx->fp, "$HEX[");
|
||||
|
||||
for (u32 i = 0; i < plain_len; i++)
|
||||
{
|
||||
hc_fprintf (debugfile_ctx->fp, "%02x", plain_ptr[i]);
|
||||
hc_fprintf (&debugfile_ctx->fp, "%02x", plain_ptr[i]);
|
||||
}
|
||||
|
||||
hc_fprintf (debugfile_ctx->fp, "]");
|
||||
hc_fprintf (&debugfile_ctx->fp, "]");
|
||||
}
|
||||
else
|
||||
{
|
||||
hc_fwrite ((void *)plain_ptr, plain_len, 1, debugfile_ctx->fp);
|
||||
hc_fwrite ((void *)plain_ptr, plain_len, 1, &debugfile_ctx->fp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,19 +64,19 @@ void debugfile_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *rule_buf, con
|
||||
{
|
||||
debugfile_format_plain (hashcat_ctx, orig_plain_ptr, orig_plain_len);
|
||||
|
||||
if ((debug_mode == 3) || (debug_mode == 4)) hc_fputc (':', debugfile_ctx->fp);
|
||||
if ((debug_mode == 3) || (debug_mode == 4)) hc_fputc (':', &debugfile_ctx->fp);
|
||||
}
|
||||
|
||||
hc_fwrite ((void *)rule_buf, rule_len, 1, debugfile_ctx->fp);
|
||||
hc_fwrite ((void *)rule_buf, rule_len, 1, &debugfile_ctx->fp);
|
||||
|
||||
if (debug_mode == 4)
|
||||
{
|
||||
hc_fputc (':', debugfile_ctx->fp);
|
||||
hc_fputc (':', &debugfile_ctx->fp);
|
||||
|
||||
debugfile_format_plain (hashcat_ctx, mod_plain_ptr, mod_plain_len);
|
||||
}
|
||||
|
||||
hc_fwrite (EOL, strlen (EOL), 1, debugfile_ctx->fp);
|
||||
hc_fwrite (EOL, strlen (EOL), 1, &debugfile_ctx->fp);
|
||||
}
|
||||
|
||||
int debugfile_init (hashcat_ctx_t *hashcat_ctx)
|
||||
@ -105,35 +105,29 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
debugfile_ctx->filename = user_options->debug_file;
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (debugfile_ctx->filename)
|
||||
{
|
||||
if (hc_fopen (&fp, debugfile_ctx->filename, "ab") == false)
|
||||
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 (&fp) == -1)
|
||||
if (hc_lockfile (&debugfile_ctx->fp) == -1)
|
||||
{
|
||||
hc_fclose (&fp);
|
||||
hc_fclose (&debugfile_ctx->fp);
|
||||
|
||||
event_log_error (hashcat_ctx, "%s: %s", debugfile_ctx->filename, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
debugfile_ctx->fp = &fp;
|
||||
}
|
||||
else
|
||||
{
|
||||
fp.is_gzip = false;
|
||||
fp.pfp = stdout;
|
||||
fp.fd = fileno (stdout);
|
||||
|
||||
debugfile_ctx->fp = &fp;
|
||||
debugfile_ctx->fp.is_gzip = false;
|
||||
debugfile_ctx->fp.pfp = stdout;
|
||||
debugfile_ctx->fp.fd = fileno (stdout);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -147,7 +141,7 @@ void debugfile_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (debugfile_ctx->filename)
|
||||
{
|
||||
hc_fclose (debugfile_ctx->fp);
|
||||
hc_fclose (&debugfile_ctx->fp);
|
||||
}
|
||||
|
||||
memset (debugfile_ctx, 0, sizeof (debugfile_ctx_t));
|
||||
|
@ -427,21 +427,17 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
{
|
||||
char *dictfile = straight_ctx->dict;
|
||||
|
||||
HCFILE fp;
|
||||
extra_info_straight_t extra_info_straight;
|
||||
|
||||
if (hc_fopen (&fp, dictfile, "rb") == false)
|
||||
memset (&extra_info_straight, 0, sizeof (extra_info_straight));
|
||||
|
||||
if (hc_fopen (&extra_info_straight.fp, dictfile, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
extra_info_straight_t extra_info_straight;
|
||||
|
||||
memset (&extra_info_straight, 0, sizeof (extra_info_straight));
|
||||
|
||||
extra_info_straight.fp = &fp;
|
||||
|
||||
hashcat_ctx_t *hashcat_ctx_tmp = (hashcat_ctx_t *) hcmalloc (sizeof (hashcat_ctx_t));
|
||||
|
||||
memcpy (hashcat_ctx_tmp, hashcat_ctx, sizeof (hashcat_ctx_t)); // yes we actually want to copy these pointers
|
||||
@ -452,7 +448,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
if (rc_wl_data_init == -1)
|
||||
{
|
||||
hc_fclose (&fp);
|
||||
hc_fclose (&extra_info_straight.fp);
|
||||
|
||||
hcfree (hashcat_ctx_tmp->wl_data);
|
||||
|
||||
@ -663,7 +659,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
if (CL_rc == -1)
|
||||
{
|
||||
hc_fclose (&fp);
|
||||
hc_fclose (&extra_info_straight.fp);
|
||||
|
||||
hcfree (hashcat_ctx_tmp->wl_data);
|
||||
|
||||
@ -676,7 +672,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
if (CL_rc == -1)
|
||||
{
|
||||
hc_fclose (&fp);
|
||||
hc_fclose (&extra_info_straight.fp);
|
||||
|
||||
hcfree (hashcat_ctx_tmp->wl_data);
|
||||
|
||||
@ -721,7 +717,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
if (words_fin == 0) break;
|
||||
}
|
||||
|
||||
hc_fclose (&fp);
|
||||
hc_fclose (&extra_info_straight.fp);
|
||||
|
||||
wl_data_destroy (hashcat_ctx_tmp);
|
||||
|
||||
|
@ -431,14 +431,14 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
|
||||
|
||||
// if enabled, update also the loopback file
|
||||
|
||||
if (loopback_ctx->fp != NULL)
|
||||
if (loopback_ctx->fp.pfp != NULL)
|
||||
{
|
||||
loopback_write_append (hashcat_ctx, plain_ptr, plain_len);
|
||||
}
|
||||
|
||||
// if enabled, update also the (rule) debug file
|
||||
|
||||
if (debugfile_ctx->fp != NULL)
|
||||
if (debugfile_ctx->fp.pfp != NULL)
|
||||
{
|
||||
// the next check implies that:
|
||||
// - (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
|
||||
|
@ -38,18 +38,18 @@ static void loopback_format_plain (hashcat_ctx_t *hashcat_ctx, const u8 *plain_p
|
||||
|
||||
if (needs_hexify == 1)
|
||||
{
|
||||
hc_fprintf (loopback_ctx->fp, "$HEX[");
|
||||
hc_fprintf (&loopback_ctx->fp, "$HEX[");
|
||||
|
||||
for (u32 i = 0; i < plain_len; i++)
|
||||
{
|
||||
hc_fprintf (loopback_ctx->fp, "%02x", plain_ptr[i]);
|
||||
hc_fprintf (&loopback_ctx->fp, "%02x", plain_ptr[i]);
|
||||
}
|
||||
|
||||
hc_fprintf (loopback_ctx->fp, "]");
|
||||
hc_fprintf (&loopback_ctx->fp, "]");
|
||||
}
|
||||
else
|
||||
{
|
||||
hc_fwrite ((void *)plain_ptr, plain_len, 1, loopback_ctx->fp);
|
||||
hc_fwrite ((void *)plain_ptr, plain_len, 1, &loopback_ctx->fp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ int loopback_init (hashcat_ctx_t *hashcat_ctx)
|
||||
if (user_options->version == true) return 0;
|
||||
|
||||
loopback_ctx->enabled = true;
|
||||
loopback_ctx->fp = NULL;
|
||||
loopback_ctx->fp.pfp = NULL;
|
||||
loopback_ctx->filename = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
|
||||
return 0;
|
||||
@ -105,17 +105,13 @@ int loopback_write_open (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
hc_asprintf (&loopback_ctx->filename, "%s/%s.%d_%u", induct_ctx->root_directory, LOOPBACK_FILE, (int) now, random_num);
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, loopback_ctx->filename, "ab") == false)
|
||||
if (hc_fopen (&loopback_ctx->fp, loopback_ctx->filename, "ab") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", loopback_ctx->filename, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
loopback_ctx->fp = &fp;
|
||||
|
||||
loopback_ctx->unused = true;
|
||||
|
||||
return 0;
|
||||
@ -138,9 +134,9 @@ void loopback_write_close (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (loopback_ctx->enabled == false) return;
|
||||
|
||||
if (loopback_ctx->fp == NULL) return;
|
||||
if (loopback_ctx->fp.pfp == NULL) return;
|
||||
|
||||
hc_fclose (loopback_ctx->fp);
|
||||
hc_fclose (&loopback_ctx->fp);
|
||||
|
||||
if (loopback_ctx->unused == true)
|
||||
{
|
||||
@ -154,17 +150,15 @@ void loopback_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *plain_ptr, con
|
||||
|
||||
if (loopback_ctx->enabled == false) return;
|
||||
|
||||
HCFILE *fp = loopback_ctx->fp;
|
||||
|
||||
loopback_format_plain (hashcat_ctx, plain_ptr, plain_len);
|
||||
|
||||
hc_lockfile (fp);
|
||||
hc_lockfile (&loopback_ctx->fp);
|
||||
|
||||
hc_fwrite (EOL, strlen (EOL), 1, fp);
|
||||
hc_fwrite (EOL, strlen (EOL), 1, &loopback_ctx->fp);
|
||||
|
||||
hc_fflush (fp);
|
||||
hc_fflush (&loopback_ctx->fp);
|
||||
|
||||
if (hc_unlockfile (fp))
|
||||
if (hc_unlockfile (&loopback_ctx->fp))
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: Failed to unlock file", loopback_ctx->filename);
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ static void main_cracker_hash_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||
|
||||
if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile
|
||||
if (outfile_ctx->fp.pfp != NULL) return; // cracked hash was not written to an outfile
|
||||
|
||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||
{
|
||||
@ -378,7 +378,7 @@ static void main_potfile_hash_show (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY
|
||||
{
|
||||
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
||||
|
||||
if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile
|
||||
if (outfile_ctx->fp.pfp != NULL) return; // cracked hash was not written to an outfile
|
||||
|
||||
fwrite (buf, len, 1, stdout);
|
||||
fwrite (EOL, strlen (EOL), 1, stdout);
|
||||
@ -388,7 +388,7 @@ static void main_potfile_hash_left (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY
|
||||
{
|
||||
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
||||
|
||||
if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile
|
||||
if (outfile_ctx->fp.pfp != NULL) return; // cracked hash was not written to an outfile
|
||||
|
||||
fwrite (buf, len, 1, stdout);
|
||||
fwrite (EOL, strlen (EOL), 1, stdout);
|
||||
|
@ -369,7 +369,7 @@ int outfile_init (hashcat_ctx_t *hashcat_ctx)
|
||||
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
outfile_ctx->fp = NULL;
|
||||
outfile_ctx->fp.pfp = NULL;
|
||||
outfile_ctx->filename = user_options->outfile;
|
||||
outfile_ctx->outfile_format = user_options->outfile_format;
|
||||
outfile_ctx->outfile_autohex = user_options->outfile_autohex;
|
||||
@ -390,26 +390,22 @@ int outfile_write_open (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (outfile_ctx->filename == NULL) return 0;
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, outfile_ctx->filename, "ab") == false)
|
||||
if (hc_fopen (&outfile_ctx->fp, outfile_ctx->filename, "ab") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", outfile_ctx->filename, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hc_lockfile (&fp) == -1)
|
||||
if (hc_lockfile (&outfile_ctx->fp) == -1)
|
||||
{
|
||||
hc_fclose (&fp);
|
||||
hc_fclose (&outfile_ctx->fp);
|
||||
|
||||
event_log_error (hashcat_ctx, "%s: %s", outfile_ctx->filename, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
outfile_ctx->fp = &fp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -417,16 +413,16 @@ void outfile_write_close (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
||||
|
||||
if (outfile_ctx->fp == NULL) return;
|
||||
if (outfile_ctx->fp.pfp == NULL) return;
|
||||
|
||||
hc_fclose (outfile_ctx->fp);
|
||||
hc_fclose (&outfile_ctx->fp);
|
||||
}
|
||||
|
||||
int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, 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 user_options_t *user_options = hashcat_ctx->user_options;
|
||||
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
|
||||
|
||||
const u32 outfile_format = (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_HEXIFY) ? 5 : outfile_ctx->outfile_format;
|
||||
|
||||
@ -527,10 +523,10 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int ou
|
||||
|
||||
tmp_buf[tmp_len] = 0;
|
||||
|
||||
if (outfile_ctx->fp != NULL)
|
||||
if (outfile_ctx->fp.pfp != NULL)
|
||||
{
|
||||
hc_fwrite (tmp_buf, tmp_len, 1, outfile_ctx->fp);
|
||||
hc_fwrite (EOL, strlen (EOL), 1, outfile_ctx->fp);
|
||||
hc_fwrite (tmp_buf, tmp_len, 1, &outfile_ctx->fp);
|
||||
hc_fwrite (EOL, strlen (EOL), 1, &outfile_ctx->fp);
|
||||
}
|
||||
|
||||
return tmp_len;
|
||||
|
@ -321,7 +321,7 @@ void potfile_update_hash (hashcat_ctx_t *hashcat_ctx, hash_t *found, char *line_
|
||||
|
||||
// if enabled, update also the loopback file
|
||||
|
||||
if (loopback_ctx->fp != NULL)
|
||||
if (loopback_ctx->fp.pfp != NULL)
|
||||
{
|
||||
loopback_write_append (hashcat_ctx, (u8 *) pw_buf, (unsigned int) pw_len);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ void slow_candidates_seek (hashcat_ctx_t *hashcat_ctx, void *extra_info, const u
|
||||
|
||||
while (1)
|
||||
{
|
||||
HCFILE *fp = extra_info_straight->fp;
|
||||
HCFILE *fp = &extra_info_straight->fp;
|
||||
|
||||
get_next_word (hashcat_ctx, fp, &line_buf, &line_len);
|
||||
|
||||
@ -176,7 +176,7 @@ void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info)
|
||||
|
||||
while (1)
|
||||
{
|
||||
HCFILE *fp = extra_info_straight->fp;
|
||||
HCFILE *fp = &extra_info_straight->fp;
|
||||
|
||||
get_next_word (hashcat_ctx, fp, &line_buf, &line_len);
|
||||
|
||||
|
40
src/stdout.c
40
src/stdout.c
@ -18,7 +18,7 @@ static void out_flush (out_t *out)
|
||||
{
|
||||
if (out->len == 0) return;
|
||||
|
||||
hc_fwrite (out->buf, 1, out->len, out->fp);
|
||||
hc_fwrite (out->buf, 1, out->len, &out->fp);
|
||||
|
||||
out->len = 0;
|
||||
}
|
||||
@ -59,39 +59,33 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
||||
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
out_t out;
|
||||
|
||||
HCFILE fp_tmp;
|
||||
fp_tmp.is_gzip = false;
|
||||
fp_tmp.pfp = stdout;
|
||||
|
||||
out.fp = &fp_tmp;
|
||||
|
||||
char *filename = outfile_ctx->filename;
|
||||
|
||||
out_t out;
|
||||
|
||||
if (filename)
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, filename, "ab") == false)
|
||||
if (hc_fopen (&out.fp, filename, "ab") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
fp.is_gzip = false;
|
||||
|
||||
if (hc_lockfile (&fp) == -1)
|
||||
if (hc_lockfile (&out.fp) == -1)
|
||||
{
|
||||
hc_fclose (&fp);
|
||||
hc_fclose (&out.fp);
|
||||
|
||||
event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
out.fp = &fp;
|
||||
}
|
||||
else
|
||||
{
|
||||
out.fp.is_gzip = false;
|
||||
out.fp.pfp = stdout;
|
||||
out.fp.fd = fileno (stdout);
|
||||
}
|
||||
|
||||
out.len = 0;
|
||||
@ -114,7 +108,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
if (filename) hc_fclose (out.fp);
|
||||
if (filename) hc_fclose (&out.fp);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -158,7 +152,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
if (filename) hc_fclose (out.fp);
|
||||
if (filename) hc_fclose (&out.fp);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -228,7 +222,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
if (filename) hc_fclose (out.fp);
|
||||
if (filename) hc_fclose (&out.fp);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -265,7 +259,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
if (filename) hc_fclose (out.fp);
|
||||
if (filename) hc_fclose (&out.fp);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -297,7 +291,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
||||
|
||||
out_flush (&out);
|
||||
|
||||
if (filename) hc_fclose (out.fp);
|
||||
if (filename) hc_fclose (&out.fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user