1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-27 08:58:10 +00:00

remove original commented code

This commit is contained in:
Gabriele Gristina 2019-06-22 15:00:50 +02:00
parent 05dfa7f3aa
commit b2529af172
72 changed files with 0 additions and 433 deletions

View File

@ -10,10 +10,8 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
//u64 count_lines (FILE *fd);
u64 count_lines (fp_tmp_t *fp_t); u64 count_lines (fp_tmp_t *fp_t);
//size_t fgetl (FILE *fp, char *line_buf);
size_t fgetl (fp_tmp_t *fp_t, char *line_buf); size_t fgetl (fp_tmp_t *fp_t, char *line_buf);
size_t superchop_with_length (char *buf, const size_t len); size_t superchop_with_length (char *buf, const size_t len);

View File

@ -15,7 +15,6 @@ const char *strhlfmt (const u32 hashfile_format);
void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len); void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len);
void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len); void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len);
//u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check);
u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, u32 max_check); u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, u32 max_check);
#endif // _HLFMT_H #endif // _HLFMT_H

View File

@ -62,8 +62,6 @@ bool hc_string_is_digit (const char *s);
void hc_string_trim_trailing (char *s); void hc_string_trim_trailing (char *s);
void hc_string_trim_leading (char *s); void hc_string_trim_leading (char *s);
//size_t hc_fread (void *ptr, size_t size, size_t nmemb, FILE *stream);
//size_t hc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
bool hc_fopen(fp_tmp_t *fp_t, const char *path, char *mode); bool hc_fopen(fp_tmp_t *fp_t, const char *path, char *mode);
size_t hc_fread (void *ptr, size_t size, size_t nmemb, fp_tmp_t *fp_t); size_t hc_fread (void *ptr, size_t size, size_t nmemb, fp_tmp_t *fp_t);
size_t hc_fread_direct (void *ptr, size_t size, size_t nmemb, FILE *stream); size_t hc_fread_direct (void *ptr, size_t size, size_t nmemb, FILE *stream);

View File

@ -10,7 +10,6 @@ typedef struct extra_info_straight
{ {
u64 pos; u64 pos;
// FILE *fp;
fp_tmp_t *fp_t; fp_tmp_t *fp_t;
u64 rule_pos_prev; u64 rule_pos_prev;
@ -28,8 +27,6 @@ typedef struct extra_info_combi
{ {
u64 pos; u64 pos;
// FILE *base_fp;
// FILE *combs_fp;
fp_tmp_t *base_fp_t; fp_tmp_t *base_fp_t;
fp_tmp_t *combs_fp_t; fp_tmp_t *combs_fp_t;

View File

@ -1165,7 +1165,6 @@ typedef struct hc_device_param
char *scratch_buf; char *scratch_buf;
// FILE *combs_fp;
fp_tmp_t *combs_fp_t; fp_tmp_t *combs_fp_t;
pw_t *combs_buf; pw_t *combs_buf;

View File

@ -19,9 +19,6 @@ void get_next_word_lm (char *buf, u64 sz, u64 *len, u64 *off);
void get_next_word_uc (char *buf, u64 sz, u64 *len, u64 *off); void get_next_word_uc (char *buf, u64 sz, u64 *len, u64 *off);
void get_next_word_std (char *buf, u64 sz, u64 *len, u64 *off); void get_next_word_std (char *buf, u64 sz, u64 *len, u64 *off);
//void get_next_word (hashcat_ctx_t *hashcat_ctx, FILE *fd, char **out_buf, u32 *out_len);
//int load_segment (hashcat_ctx_t *hashcat_ctx, FILE *fd);
//int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64 *result);
void get_next_word (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, char **out_buf, u32 *out_len); void get_next_word (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, char **out_buf, u32 *out_len);
int load_segment (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t); int load_segment (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t);
int count_words (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, const char *dictfile, u64 *result); int count_words (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, const char *dictfile, u64 *result);

View File

@ -457,7 +457,6 @@ static bool read_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_f
char *buf = (char *) hcmalloc (st.st_size + 1 + EXTRASZ); char *buf = (char *) hcmalloc (st.st_size + 1 + EXTRASZ);
// size_t num_read = hc_fread (buf, sizeof (char), st.st_size, fp);
size_t num_read = hc_fread_direct (buf, sizeof (char), st.st_size, fp); size_t num_read = hc_fread_direct (buf, sizeof (char), st.st_size, fp);
fclose (fp); fclose (fp);
@ -522,7 +521,6 @@ static bool write_kernel_binary (hashcat_ctx_t *hashcat_ctx, char *kernel_file,
return false; return false;
} }
// hc_fwrite (binary, sizeof (char), binary_size, fp);
hc_fwrite_direct (binary, sizeof (char), binary_size, fp); hc_fwrite_direct (binary, sizeof (char), binary_size, fp);
fflush (fp); fflush (fp);
@ -4377,7 +4375,6 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
device_param->kernel_params_buf32[31] = salt_buf->digests_cnt; device_param->kernel_params_buf32[31] = salt_buf->digests_cnt;
device_param->kernel_params_buf32[32] = salt_buf->digests_offset; device_param->kernel_params_buf32[32] = salt_buf->digests_offset;
// FILE *combs_fp = device_param->combs_fp;
fp_tmp_t *combs_fp_t = device_param->combs_fp_t; fp_tmp_t *combs_fp_t = device_param->combs_fp_t;
if (user_options->slow_candidates == true) if (user_options->slow_candidates == true)
@ -4387,7 +4384,6 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
{ {
if ((user_options->attack_mode == ATTACK_MODE_COMBI) || (((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) && (user_options->attack_mode == ATTACK_MODE_HYBRID2))) if ((user_options->attack_mode == ATTACK_MODE_COMBI) || (((hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL) == 0) && (user_options->attack_mode == ATTACK_MODE_HYBRID2)))
{ {
// rewind (combs_fp);
hc_rewind (combs_fp_t); hc_rewind (combs_fp_t);
} }
} }
@ -4482,10 +4478,8 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
while (i < innerloop_left) while (i < innerloop_left)
{ {
// if (feof (combs_fp)) break;
if (hc_feof (combs_fp_t)) break; if (hc_feof (combs_fp_t)) break;
// size_t line_len = fgetl (combs_fp, line_buf);
size_t line_len = fgetl (combs_fp_t, line_buf); size_t line_len = fgetl (combs_fp_t, line_buf);
line_len = convert_from_hex (hashcat_ctx, line_buf, line_len); line_len = convert_from_hex (hashcat_ctx, line_buf, line_len);
@ -4649,10 +4643,8 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
while (i < innerloop_left) while (i < innerloop_left)
{ {
// if (feof (combs_fp)) break;
if (hc_feof (combs_fp_t)) break; if (hc_feof (combs_fp_t)) break;
// size_t line_len = fgetl (combs_fp, line_buf);
size_t line_len = fgetl (combs_fp_t, line_buf); size_t line_len = fgetl (combs_fp_t, line_buf);
line_len = convert_from_hex (hashcat_ctx, line_buf, line_len); line_len = convert_from_hex (hashcat_ctx, line_buf, line_len);

View File

@ -60,12 +60,9 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// FILE *fp1 = NULL;
// FILE *fp2 = NULL;
fp_tmp_t fp1_t; fp_tmp_t fp1_t;
fp_tmp_t fp2_t; fp_tmp_t fp2_t;
// if ((fp1 = fopen (dictfile1, "rb")) == NULL)
if (hc_fopen (&fp1_t, dictfile1, "rb") == false) if (hc_fopen (&fp1_t, dictfile1, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
@ -73,12 +70,10 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// if ((fp2 = fopen (dictfile2, "rb")) == NULL)
if (hc_fopen (&fp2_t, dictfile2, "rb") == false) if (hc_fopen (&fp2_t, dictfile2, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
// fclose (fp1);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
return -1; return -1;
@ -88,15 +83,12 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
u64 words1_cnt = 0; u64 words1_cnt = 0;
// const int rc1 = count_words (hashcat_ctx, fp1, dictfile1, &words1_cnt);
const int rc1 = count_words (hashcat_ctx, &fp1_t, dictfile1, &words1_cnt); const int rc1 = count_words (hashcat_ctx, &fp1_t, dictfile1, &words1_cnt);
if (rc1 == -1) if (rc1 == -1)
{ {
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1); event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1);
// fclose (fp1);
// fclose (fp2);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
hc_fclose (&fp2_t); hc_fclose (&fp2_t);
@ -107,8 +99,6 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
{ {
event_log_error (hashcat_ctx, "%s: empty file.", dictfile1); event_log_error (hashcat_ctx, "%s: empty file.", dictfile1);
// fclose (fp1);
// fclose (fp2);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
hc_fclose (&fp2_t); hc_fclose (&fp2_t);
@ -119,11 +109,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
u64 words2_cnt = 0; u64 words2_cnt = 0;
// const int rc2 = count_words (hashcat_ctx, fp2, dictfile2, &words2_cnt);
const int rc2 = count_words (hashcat_ctx, &fp2_t, dictfile2, &words2_cnt); const int rc2 = count_words (hashcat_ctx, &fp2_t, dictfile2, &words2_cnt);
// fclose (fp1);
// fclose (fp2);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
hc_fclose (&fp2_t); hc_fclose (&fp2_t);
@ -176,12 +163,9 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// FILE *fp1 = NULL;
// FILE *fp2 = NULL;
fp_tmp_t fp1_t; fp_tmp_t fp1_t;
fp_tmp_t fp2_t; fp_tmp_t fp2_t;
// if ((fp1 = fopen (dictfile1, "rb")) == NULL)
if (hc_fopen (&fp1_t, dictfile1, "rb") == false) if (hc_fopen (&fp1_t, dictfile1, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
@ -189,12 +173,10 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// if ((fp2 = fopen (dictfile2, "rb")) == NULL)
if (hc_fopen (&fp2_t, dictfile2, "rb") == false) if (hc_fopen (&fp2_t, dictfile2, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
// fclose (fp1);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
return -1; return -1;
@ -204,15 +186,12 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
u64 words1_cnt = 0; u64 words1_cnt = 0;
// const int rc1 = count_words (hashcat_ctx, fp1, dictfile1, &words1_cnt);
const int rc1 = count_words (hashcat_ctx, &fp1_t, dictfile1, &words1_cnt); const int rc1 = count_words (hashcat_ctx, &fp1_t, dictfile1, &words1_cnt);
if (rc1 == -1) if (rc1 == -1)
{ {
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1); event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1);
// fclose (fp1);
// fclose (fp2);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
hc_fclose (&fp2_t); hc_fclose (&fp2_t);
@ -223,8 +202,6 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
{ {
event_log_error (hashcat_ctx, "%s: empty file.", dictfile1); event_log_error (hashcat_ctx, "%s: empty file.", dictfile1);
// fclose (fp1);
// fclose (fp2);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
hc_fclose (&fp2_t); hc_fclose (&fp2_t);
@ -235,11 +212,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
u64 words2_cnt = 0; u64 words2_cnt = 0;
// const int rc2 = count_words (hashcat_ctx, fp2, dictfile2, &words2_cnt);
const int rc2 = count_words (hashcat_ctx, &fp2_t, dictfile2, &words2_cnt); const int rc2 = count_words (hashcat_ctx, &fp2_t, dictfile2, &words2_cnt);
// fclose (fp1);
// fclose (fp2);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
hc_fclose (&fp2_t); hc_fclose (&fp2_t);
@ -320,12 +294,9 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// FILE *fp1 = NULL;
// FILE *fp2 = NULL;
fp_tmp_t fp1_t; fp_tmp_t fp1_t;
fp_tmp_t fp2_t; fp_tmp_t fp2_t;
// if ((fp1 = fopen (dictfile1, "rb")) == NULL)
if (hc_fopen (&fp1_t, dictfile1, "rb") == false) if (hc_fopen (&fp1_t, dictfile1, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
@ -333,12 +304,10 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// if ((fp2 = fopen (dictfile2, "rb")) == NULL)
if (hc_fopen (&fp2_t, dictfile2, "rb") == false) if (hc_fopen (&fp2_t, dictfile2, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
// fclose (fp1);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
return -1; return -1;
@ -348,15 +317,12 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
u64 words1_cnt = 0; u64 words1_cnt = 0;
// const int rc1 = count_words (hashcat_ctx, fp1, dictfile1, &words1_cnt);
const int rc1 = count_words (hashcat_ctx, &fp1_t, dictfile1, &words1_cnt); const int rc1 = count_words (hashcat_ctx, &fp1_t, dictfile1, &words1_cnt);
if (rc1 == -1) if (rc1 == -1)
{ {
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1); event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1);
// fclose (fp1);
// fclose (fp2);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
hc_fclose (&fp2_t); hc_fclose (&fp2_t);
@ -367,8 +333,6 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
{ {
event_log_error (hashcat_ctx, "%s: empty file.", dictfile1); event_log_error (hashcat_ctx, "%s: empty file.", dictfile1);
// fclose (fp1);
// fclose (fp2);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
hc_fclose (&fp2_t); hc_fclose (&fp2_t);
@ -379,11 +343,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
u64 words2_cnt = 0; u64 words2_cnt = 0;
// const int rc2 = count_words (hashcat_ctx, fp2, dictfile2, &words2_cnt);
const int rc2 = count_words (hashcat_ctx, &fp2_t, dictfile2, &words2_cnt); const int rc2 = count_words (hashcat_ctx, &fp2_t, dictfile2, &words2_cnt);
// fclose (fp1);
// fclose (fp2);
hc_fclose (&fp1_t); hc_fclose (&fp1_t);
hc_fclose (&fp2_t); hc_fclose (&fp2_t);
@ -426,10 +387,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// FILE *fp = NULL;
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if ((fp = fopen (dictfile, "rb")) == NULL)
if (hc_fopen (&fp_t, dictfile, "rb") == false) if (hc_fopen (&fp_t, dictfile, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
@ -441,7 +400,6 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
u64 words_cnt = 0; u64 words_cnt = 0;
// const int rc = count_words (hashcat_ctx, fp, dictfile, &words_cnt);
const int rc = count_words (hashcat_ctx, &fp_t, dictfile, &words_cnt); const int rc = count_words (hashcat_ctx, &fp_t, dictfile, &words_cnt);
hc_fclose (&fp_t); hc_fclose (&fp_t);
@ -450,13 +408,9 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
{ {
event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile); event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile);
// fclose (fp);
return -1; return -1;
} }
// fclose (fp);
combinator_ctx->combs_cnt = words_cnt; combinator_ctx->combs_cnt = words_cnt;
combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT; combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT;
} }

View File

@ -98,7 +98,6 @@ int cpu_crc32 (const char *filename, u8 keytab[64])
u8 *buf = (u8 *) hcmalloc (MAX_KEY_SIZE + 1); u8 *buf = (u8 *) hcmalloc (MAX_KEY_SIZE + 1);
// size_t nread = hc_fread (buf, sizeof (u8), MAX_KEY_SIZE, fd);
size_t nread = hc_fread_direct (buf, sizeof (u8), MAX_KEY_SIZE, fd); size_t nread = hc_fread_direct (buf, sizeof (u8), MAX_KEY_SIZE, fd);
fclose (fd); fclose (fd);

View File

@ -48,7 +48,6 @@ static void debugfile_format_plain (hashcat_ctx_t *hashcat_ctx, const u8 *plain_
} }
else else
{ {
// hc_fwrite (plain_ptr, plain_len, 1, debugfile_ctx->fp);
hc_fwrite_direct (plain_ptr, plain_len, 1, debugfile_ctx->fp); hc_fwrite_direct (plain_ptr, plain_len, 1, debugfile_ctx->fp);
} }
} }
@ -68,7 +67,6 @@ void debugfile_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *rule_buf, con
if ((debug_mode == 3) || (debug_mode == 4)) fputc (':', debugfile_ctx->fp); if ((debug_mode == 3) || (debug_mode == 4)) fputc (':', debugfile_ctx->fp);
} }
// hc_fwrite (rule_buf, rule_len, 1, debugfile_ctx->fp);
hc_fwrite_direct (rule_buf, rule_len, 1, debugfile_ctx->fp); hc_fwrite_direct (rule_buf, rule_len, 1, debugfile_ctx->fp);
if (debug_mode == 4) if (debug_mode == 4)
@ -78,7 +76,6 @@ void debugfile_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *rule_buf, con
debugfile_format_plain (hashcat_ctx, mod_plain_ptr, mod_plain_len); debugfile_format_plain (hashcat_ctx, mod_plain_ptr, mod_plain_len);
} }
// hc_fwrite (EOL, strlen (EOL), 1, debugfile_ctx->fp);
hc_fwrite_direct (EOL, strlen (EOL), 1, debugfile_ctx->fp); hc_fwrite_direct (EOL, strlen (EOL), 1, debugfile_ctx->fp);
} }

View File

@ -110,8 +110,6 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx)
u64 v; u64 v;
u64 z; u64 z;
// const size_t nread1 = hc_fread (&v, sizeof (u64), 1, fp);
// const size_t nread2 = hc_fread (&z, sizeof (u64), 1, fp);
const size_t nread1 = hc_fread_direct (&v, sizeof (u64), 1, fp); const size_t nread1 = hc_fread_direct (&v, sizeof (u64), 1, fp);
const size_t nread2 = hc_fread_direct (&z, sizeof (u64), 1, fp); const size_t nread2 = hc_fread_direct (&z, sizeof (u64), 1, fp);
@ -160,7 +158,6 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx)
{ {
dictstat_t d; dictstat_t d;
// const size_t nread = hc_fread (&d, sizeof (dictstat_t), 1, fp);
const size_t nread = hc_fread_direct (&d, sizeof (dictstat_t), 1, fp); const size_t nread = hc_fread_direct (&d, sizeof (dictstat_t), 1, fp);
if (nread == 0) continue; if (nread == 0) continue;
@ -213,14 +210,11 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx)
v = byte_swap_64 (v); v = byte_swap_64 (v);
z = byte_swap_64 (z); z = byte_swap_64 (z);
// hc_fwrite (&v, sizeof (u64), 1, fp);
// hc_fwrite (&z, sizeof (u64), 1, fp);
hc_fwrite_direct (&v, sizeof (u64), 1, fp); hc_fwrite_direct (&v, sizeof (u64), 1, fp);
hc_fwrite_direct (&z, sizeof (u64), 1, fp); hc_fwrite_direct (&z, sizeof (u64), 1, fp);
// data // data
// hc_fwrite (dictstat_ctx->base, sizeof (dictstat_t), dictstat_ctx->cnt, fp);
hc_fwrite_direct (dictstat_ctx->base, sizeof (dictstat_t), dictstat_ctx->cnt, fp); hc_fwrite_direct (dictstat_ctx->base, sizeof (dictstat_t), dictstat_ctx->cnt, fp);
fclose (fp); fclose (fp);

View File

@ -427,10 +427,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
{ {
char *dictfile = straight_ctx->dict; char *dictfile = straight_ctx->dict;
// FILE *fp = fopen (dictfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL)
if (hc_fopen (&fp_t, dictfile, "rb") == false) if (hc_fopen (&fp_t, dictfile, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
@ -442,7 +440,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
memset (&extra_info_straight, 0, sizeof (extra_info_straight)); memset (&extra_info_straight, 0, sizeof (extra_info_straight));
// extra_info_straight.fp = fp;
extra_info_straight.fp_t = &fp_t; extra_info_straight.fp_t = &fp_t;
hashcat_ctx_t *hashcat_ctx_tmp = (hashcat_ctx_t *) hcmalloc (sizeof (hashcat_ctx_t)); hashcat_ctx_t *hashcat_ctx_tmp = (hashcat_ctx_t *) hcmalloc (sizeof (hashcat_ctx_t));
@ -455,7 +452,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (rc_wl_data_init == -1) if (rc_wl_data_init == -1)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
hcfree (hashcat_ctx_tmp->wl_data); hcfree (hashcat_ctx_tmp->wl_data);
@ -667,7 +663,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (CL_rc == -1) if (CL_rc == -1)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
hcfree (hashcat_ctx_tmp->wl_data); hcfree (hashcat_ctx_tmp->wl_data);
@ -681,7 +676,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (CL_rc == -1) if (CL_rc == -1)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
hcfree (hashcat_ctx_tmp->wl_data); hcfree (hashcat_ctx_tmp->wl_data);
@ -727,7 +721,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (words_fin == 0) break; if (words_fin == 0) break;
} }
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
wl_data_destroy (hashcat_ctx_tmp); wl_data_destroy (hashcat_ctx_tmp);
@ -754,10 +747,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
combs_file = combinator_ctx->dict1; combs_file = combinator_ctx->dict1;
} }
// FILE *base_fp = fopen (base_file, "rb");
fp_tmp_t base_fp_t; fp_tmp_t base_fp_t;
// if (base_fp == NULL)
if (hc_fopen (&base_fp_t, base_file, "rb") == false) if (hc_fopen (&base_fp_t, base_file, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", base_file, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", base_file, strerror (errno));
@ -765,10 +756,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
return -1; return -1;
} }
// FILE *combs_fp = fopen (combs_file, "rb");
fp_tmp_t combs_fp_t; fp_tmp_t combs_fp_t;
// if (combs_fp == NULL)
if (hc_fopen (&combs_fp_t, combs_file, "rb") == false) if (hc_fopen (&combs_fp_t, combs_file, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", combs_file, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", combs_file, strerror (errno));
@ -780,8 +769,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
memset (&extra_info_combi, 0, sizeof (extra_info_combi)); memset (&extra_info_combi, 0, sizeof (extra_info_combi));
// extra_info_combi.base_fp = base_fp;
// extra_info_combi.combs_fp = combs_fp;
extra_info_combi.base_fp_t = &base_fp_t; extra_info_combi.base_fp_t = &base_fp_t;
extra_info_combi.combs_fp_t = &combs_fp_t; extra_info_combi.combs_fp_t = &combs_fp_t;
extra_info_combi.scratch_buf = device_param->scratch_buf; extra_info_combi.scratch_buf = device_param->scratch_buf;
@ -796,10 +783,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (rc_wl_data_init == -1) if (rc_wl_data_init == -1)
{ {
// fclose (combs_fp);
hc_fclose (&combs_fp_t); hc_fclose (&combs_fp_t);
// fclose (base_fp);
hc_fclose (&base_fp_t); hc_fclose (&base_fp_t);
hcfree (hashcat_ctx_tmp->wl_data); hcfree (hashcat_ctx_tmp->wl_data);
@ -1011,10 +996,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (CL_rc == -1) if (CL_rc == -1)
{ {
// fclose (combs_fp);
hc_fclose (&combs_fp_t); hc_fclose (&combs_fp_t);
// fclose (base_fp);
hc_fclose (&base_fp_t); hc_fclose (&base_fp_t);
hcfree (hashcat_ctx_tmp->wl_data); hcfree (hashcat_ctx_tmp->wl_data);
@ -1028,10 +1011,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (CL_rc == -1) if (CL_rc == -1)
{ {
// fclose (combs_fp);
hc_fclose (&combs_fp_t); hc_fclose (&combs_fp_t);
// fclose (base_fp);
hc_fclose (&base_fp_t); hc_fclose (&base_fp_t);
hcfree (hashcat_ctx_tmp->wl_data); hcfree (hashcat_ctx_tmp->wl_data);
@ -1077,10 +1058,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (words_fin == 0) break; if (words_fin == 0) break;
} }
// fclose (combs_fp);
hc_fclose (&combs_fp_t); hc_fclose (&combs_fp_t);
// fclose (base_fp);
hc_fclose (&base_fp_t); hc_fclose (&base_fp_t);
wl_data_destroy (hashcat_ctx_tmp); wl_data_destroy (hashcat_ctx_tmp);
@ -1343,10 +1322,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
{ {
char *dictfile = straight_ctx->dict; char *dictfile = straight_ctx->dict;
// FILE *combs_fp = fopen (dictfile, "rb");
fp_tmp_t combs_fp_t; fp_tmp_t combs_fp_t;
// if (combs_fp == NULL)
if (hc_fopen (&combs_fp_t, dictfile, "rb") == false) if (hc_fopen (&combs_fp_t, dictfile, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
@ -1354,7 +1331,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
return -1; return -1;
} }
// device_param->combs_fp = combs_fp;
device_param->combs_fp_t = &combs_fp_t; device_param->combs_fp_t = &combs_fp_t;
} }
@ -1412,10 +1388,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
{ {
const char *dictfilec = combinator_ctx->dict2; const char *dictfilec = combinator_ctx->dict2;
// FILE *combs_fp = fopen (dictfilec, "rb");
fp_tmp_t combs_fp_t; fp_tmp_t combs_fp_t;
// if (combs_fp == NULL)
if (hc_fopen (&combs_fp_t, dictfilec, "rb") == false) if (hc_fopen (&combs_fp_t, dictfilec, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", combinator_ctx->dict2, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", combinator_ctx->dict2, strerror (errno));
@ -1423,17 +1397,14 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
return -1; return -1;
} }
// device_param->combs_fp = combs_fp;
device_param->combs_fp_t = &combs_fp_t; device_param->combs_fp_t = &combs_fp_t;
} }
else if (combs_mode == COMBINATOR_MODE_BASE_RIGHT) else if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
{ {
const char *dictfilec = combinator_ctx->dict1; const char *dictfilec = combinator_ctx->dict1;
// FILE *combs_fp = fopen (dictfilec, "rb");
fp_tmp_t combs_fp_t; fp_tmp_t combs_fp_t;
// if (combs_fp == NULL)
if (hc_fopen (&combs_fp_t, dictfilec, "rb") == false) if (hc_fopen (&combs_fp_t, dictfilec, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfilec, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfilec, strerror (errno));
@ -1441,15 +1412,12 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
return -1; return -1;
} }
// device_param->combs_fp = combs_fp;
device_param->combs_fp_t = &combs_fp_t; device_param->combs_fp_t = &combs_fp_t;
} }
} }
// FILE *fd = fopen (dictfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fd == NULL)
if (hc_fopen (&fp_t, dictfile, "rb") == false) if (hc_fopen (&fp_t, dictfile, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
@ -1467,10 +1435,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (rc_wl_data_init == -1) if (rc_wl_data_init == -1)
{ {
// if (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp);
if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t); if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t);
// fclose (fd);
hc_fclose (&fp_t); hc_fclose (&fp_t);
hcfree (hashcat_ctx_tmp->wl_data); hcfree (hashcat_ctx_tmp->wl_data);
@ -1510,12 +1476,10 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
char rule_buf_out[RP_PASSWORD_SIZE]; char rule_buf_out[RP_PASSWORD_SIZE];
// for ( ; words_cur < words_off; words_cur++) get_next_word (hashcat_ctx_tmp, fd, &line_buf, &line_len);
for ( ; words_cur < words_off; words_cur++) get_next_word (hashcat_ctx_tmp, &fp_t, &line_buf, &line_len); for ( ; words_cur < words_off; words_cur++) get_next_word (hashcat_ctx_tmp, &fp_t, &line_buf, &line_len);
for ( ; words_cur < words_fin; words_cur++) for ( ; words_cur < words_fin; words_cur++)
{ {
// get_next_word (hashcat_ctx_tmp, fd, &line_buf, &line_len);
get_next_word (hashcat_ctx_tmp, &fp_t, &line_buf, &line_len); get_next_word (hashcat_ctx_tmp, &fp_t, &line_buf, &line_len);
line_len = (u32) convert_from_hex (hashcat_ctx, line_buf, line_len); line_len = (u32) convert_from_hex (hashcat_ctx, line_buf, line_len);
@ -1603,10 +1567,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (CL_rc == -1) if (CL_rc == -1)
{ {
// if (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp);
if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t); if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t);
// fclose (fd);
hc_fclose (&fp_t); hc_fclose (&fp_t);
hcfree (hashcat_ctx_tmp->wl_data); hcfree (hashcat_ctx_tmp->wl_data);
@ -1620,10 +1582,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (CL_rc == -1) if (CL_rc == -1)
{ {
// if (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp);
if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t); if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t);
// fclose (fd);
hc_fclose (&fp_t); hc_fclose (&fp_t);
hcfree (hashcat_ctx_tmp->wl_data); hcfree (hashcat_ctx_tmp->wl_data);
@ -1678,10 +1638,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (words_fin == 0) break; if (words_fin == 0) break;
} }
// if (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp);
if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t); if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t);
// fclose (fd);
hc_fclose (&fp_t); hc_fclose (&fp_t);
wl_data_destroy (hashcat_ctx_tmp); wl_data_destroy (hashcat_ctx_tmp);

View File

@ -9,7 +9,6 @@
#include "shared.h" #include "shared.h"
#include "filehandling.h" #include "filehandling.h"
//u64 count_lines (FILE *fd)
u64 count_lines (fp_tmp_t *fp_t) u64 count_lines (fp_tmp_t *fp_t)
{ {
u64 cnt = 0; u64 cnt = 0;
@ -18,10 +17,8 @@ u64 count_lines (fp_tmp_t *fp_t)
char prev = '\n'; char prev = '\n';
// while (!feof (fd))
while (!hc_feof (fp_t)) while (!hc_feof (fp_t))
{ {
// size_t nread = hc_fread (buf, sizeof (char), HCBUFSIZ_LARGE, fd);
size_t nread = hc_fread (buf, sizeof (char), HCBUFSIZ_LARGE, fp_t); size_t nread = hc_fread (buf, sizeof (char), HCBUFSIZ_LARGE, fp_t);
if (nread < 1) continue; if (nread < 1) continue;
@ -41,15 +38,12 @@ u64 count_lines (fp_tmp_t *fp_t)
return cnt; return cnt;
} }
//size_t fgetl (FILE *fp, char *line_buf)
size_t fgetl (fp_tmp_t *fp_t, char *line_buf) size_t fgetl (fp_tmp_t *fp_t, char *line_buf)
{ {
size_t line_len = 0; size_t line_len = 0;
// while (!feof (fp))
while (!hc_feof (fp_t)) while (!hc_feof (fp_t))
{ {
// const int c = fgetc (fp);
const int c = hc_fgetc (fp_t); const int c = hc_fgetc (fp_t);
if (c == EOF) break; if (c == EOF) break;

View File

@ -228,7 +228,6 @@ int save_hash (hashcat_ctx_t *hashcat_ctx)
const int binary_len = module_ctx->module_hash_binary_save (hashes, salt_pos, digest_pos, &binary_buf); const int binary_len = module_ctx->module_hash_binary_save (hashes, salt_pos, digest_pos, &binary_buf);
// hc_fwrite (binary_buf, binary_len, 1, fp);
hc_fwrite_direct (binary_buf, binary_len, 1, fp); hc_fwrite_direct (binary_buf, binary_len, 1, fp);
hcfree (binary_buf); hcfree (binary_buf);
@ -675,10 +674,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
} }
else if (hashlist_mode == HL_MODE_FILE_PLAIN) else if (hashlist_mode == HL_MODE_FILE_PLAIN)
{ {
// FILE *fp = NULL;
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if ((fp = fopen (hashfile, "rb")) == NULL)
if (hc_fopen (&fp_t, hashfile, "rb") == false) if (hc_fopen (&fp_t, hashfile, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", hashfile, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", hashfile, strerror (errno));
@ -688,25 +685,21 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
EVENT_DATA (EVENT_HASHLIST_COUNT_LINES_PRE, hashfile, strlen (hashfile)); EVENT_DATA (EVENT_HASHLIST_COUNT_LINES_PRE, hashfile, strlen (hashfile));
// hashes_avail = count_lines (fp);
hashes_avail = count_lines (&fp_t); hashes_avail = count_lines (&fp_t);
EVENT_DATA (EVENT_HASHLIST_COUNT_LINES_POST, hashfile, strlen (hashfile)); EVENT_DATA (EVENT_HASHLIST_COUNT_LINES_POST, hashfile, strlen (hashfile));
// rewind (fp);
hc_rewind (&fp_t); hc_rewind (&fp_t);
if (hashes_avail == 0) if (hashes_avail == 0)
{ {
event_log_error (hashcat_ctx, "hashfile is empty or corrupt."); event_log_error (hashcat_ctx, "hashfile is empty or corrupt.");
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return -1; return -1;
} }
// hashlist_format = hlfmt_detect (hashcat_ctx, fp, 100); // 100 = max numbers to "scan". could be hashes_avail, too
hashlist_format = hlfmt_detect (hashcat_ctx, &fp_t, 100); // 100 = max numbers to "scan". could be hashes_avail, too hashlist_format = hlfmt_detect (hashcat_ctx, &fp_t, 100); // 100 = max numbers to "scan". could be hashes_avail, too
hc_fclose (&fp_t); hc_fclose (&fp_t);
@ -715,12 +708,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
{ {
event_log_error (hashcat_ctx, "Use of --remove is not supported in native hashfile-format mode."); event_log_error (hashcat_ctx, "Use of --remove is not supported in native hashfile-format mode.");
// fclose (fp);
return -1; return -1;
} }
// fclose (fp);
} }
else if (hashlist_mode == HL_MODE_FILE_BINARY) else if (hashlist_mode == HL_MODE_FILE_BINARY)
{ {
@ -1005,10 +994,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
} }
else if (hashlist_mode == HL_MODE_FILE_PLAIN) else if (hashlist_mode == HL_MODE_FILE_PLAIN)
{ {
// FILE *fp;
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if ((fp = fopen (hashfile, "rb")) == NULL)
if (hc_fopen (&fp_t, hashfile, "rb") == false) if (hc_fopen (&fp_t, hashfile, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", hashfile, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", hashfile, strerror (errno));
@ -1023,12 +1010,10 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
time_t prev = 0; time_t prev = 0;
time_t now = 0; time_t now = 0;
// while (!feof (fp))
while (!hc_feof (&fp_t)) while (!hc_feof (&fp_t))
{ {
line_num++; line_num++;
// const size_t line_len = fgetl (fp, line_buf);
const size_t line_len = fgetl (&fp_t, line_buf); const size_t line_len = fgetl (&fp_t, line_buf);
if (line_len == 0) continue; if (line_len == 0) continue;
@ -1250,7 +1235,6 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
hcfree (line_buf); hcfree (line_buf);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
} }
else if (hashlist_mode == HL_MODE_FILE_BINARY) else if (hashlist_mode == HL_MODE_FILE_BINARY)
@ -1806,7 +1790,6 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
hc_asprintf (&tmpfile_bin, "%s/selftest.hash", folder_config->session_dir); hc_asprintf (&tmpfile_bin, "%s/selftest.hash", folder_config->session_dir);
// FILE *fp = fopen (tmpfile_bin, "wb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
hc_fopen (&fp_t, tmpfile_bin, "wb"); hc_fopen (&fp_t, tmpfile_bin, "wb");
@ -1817,11 +1800,9 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
{ {
const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + i); const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + i);
// fputc (c, fp);
hc_fputc (c, &fp_t); hc_fputc (c, &fp_t);
} }
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
parser_status = module_ctx->module_hash_decode (hashconfig, hash.digest, hash.salt, hash.esalt, hash.hook_salt, hash.hash_info, tmpfile_bin, strlen (tmpfile_bin)); parser_status = module_ctx->module_hash_decode (hashconfig, hash.digest, hash.salt, hash.esalt, hash.hook_salt, hash.hash_info, tmpfile_bin, strlen (tmpfile_bin));

View File

@ -334,7 +334,6 @@ void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf
} }
} }
//u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check)
u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, u32 max_check) u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, u32 max_check)
{ {
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -349,10 +348,8 @@ u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, u32 max_check)
char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
// while (!feof (fp))
while (!hc_feof (fp_t)) while (!hc_feof (fp_t))
{ {
// const size_t line_len = fgetl (fp, line_buf);
const size_t line_len = fgetl (fp_t, line_buf); const size_t line_len = fgetl (fp_t, line_buf);
if (line_len == 0) continue; if (line_len == 0) continue;

View File

@ -22,18 +22,14 @@ bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_m
{ {
char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
// FILE *fp = fopen (filename, "r");
fp_tmp_t fp_t; fp_tmp_t fp_t;
if (hc_fopen(&fp_t, filename, "r") == false) return false; if (hc_fopen(&fp_t, filename, "r") == false) return false;
// if (fp == NULL) return false;
int maps_cnt = 0; int maps_cnt = 0;
// while (!feof (fp))
while (!hc_feof (&fp_t)) while (!hc_feof (&fp_t))
{ {
// const size_t line_len = fgetl (fp, line_buf);
const size_t line_len = fgetl (&fp_t, line_buf); const size_t line_len = fgetl (&fp_t, line_buf);
if (line_len == 0) continue; if (line_len == 0) continue;
@ -56,7 +52,6 @@ bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_m
if (rc_tokenizer != PARSER_OK) if (rc_tokenizer != PARSER_OK)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
free (line_buf); free (line_buf);
@ -72,7 +67,6 @@ bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_m
if (maps_cnt == 256) if (maps_cnt == 256)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
free (line_buf); free (line_buf);
@ -85,7 +79,6 @@ bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_m
*keyboard_layout_mapping_cnt = maps_cnt; *keyboard_layout_mapping_cnt = maps_cnt;
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
free (line_buf); free (line_buf);

View File

@ -62,7 +62,6 @@ void logfile_append (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
va_end (ap); va_end (ap);
// hc_fwrite (EOL, strlen (EOL), 1, fp);
hc_fwrite_direct (EOL, strlen (EOL), 1, fp); hc_fwrite_direct (EOL, strlen (EOL), 1, fp);
fflush (fp); fflush (fp);

View File

@ -49,7 +49,6 @@ static void loopback_format_plain (hashcat_ctx_t *hashcat_ctx, const u8 *plain_p
} }
else else
{ {
// hc_fwrite (plain_ptr, plain_len, 1, loopback_ctx->fp);
hc_fwrite_direct (plain_ptr, plain_len, 1, loopback_ctx->fp); hc_fwrite_direct (plain_ptr, plain_len, 1, loopback_ctx->fp);
} }
} }
@ -161,7 +160,6 @@ void loopback_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *plain_ptr, con
lock_file (fp); lock_file (fp);
// hc_fwrite (EOL, strlen (EOL), 1, fp);
hc_fwrite_direct (EOL, strlen (EOL), 1, fp); hc_fwrite_direct (EOL, strlen (EOL), 1, fp);
fflush (fp); fflush (fp);

View File

@ -100,10 +100,6 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
#else #else
switch (loglevel) switch (loglevel)
{ {
// case LOGLEVEL_INFO: break;
// case LOGLEVEL_WARNING: hc_fwrite ("\033[33m", 5, 1, fp); break;
// case LOGLEVEL_ERROR: hc_fwrite ("\033[31m", 5, 1, fp); break;
// case LOGLEVEL_ADVICE: hc_fwrite ("\033[33m", 5, 1, fp); break;
case LOGLEVEL_INFO: break; case LOGLEVEL_INFO: break;
case LOGLEVEL_WARNING: hc_fwrite_direct ("\033[33m", 5, 1, fp); break; case LOGLEVEL_WARNING: hc_fwrite_direct ("\033[33m", 5, 1, fp); break;
case LOGLEVEL_ERROR: hc_fwrite_direct ("\033[31m", 5, 1, fp); break; case LOGLEVEL_ERROR: hc_fwrite_direct ("\033[31m", 5, 1, fp); break;
@ -113,7 +109,6 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
// finally, print // finally, print
// hc_fwrite (msg_buf, msg_len, 1, fp);
hc_fwrite_direct (msg_buf, msg_len, 1, fp); hc_fwrite_direct (msg_buf, msg_len, 1, fp);
// color stuff post // color stuff post
@ -129,10 +124,6 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
#else #else
switch (loglevel) switch (loglevel)
{ {
// case LOGLEVEL_INFO: break;
// case LOGLEVEL_WARNING: hc_fwrite ("\033[0m", 4, 1, fp); break;
// case LOGLEVEL_ERROR: hc_fwrite ("\033[0m", 4, 1, fp); break;
// case LOGLEVEL_ADVICE: hc_fwrite ("\033[0m", 4, 1, fp); break;
case LOGLEVEL_INFO: break; case LOGLEVEL_INFO: break;
case LOGLEVEL_WARNING: hc_fwrite_direct ("\033[0m", 4, 1, fp); break; case LOGLEVEL_WARNING: hc_fwrite_direct ("\033[0m", 4, 1, fp); break;
case LOGLEVEL_ERROR: hc_fwrite_direct ("\033[0m", 4, 1, fp); break; case LOGLEVEL_ERROR: hc_fwrite_direct ("\033[0m", 4, 1, fp); break;
@ -144,14 +135,12 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
if (msg_newline == true) if (msg_newline == true)
{ {
// hc_fwrite (EOL, strlen (EOL), 1, fp);
hc_fwrite_direct (EOL, strlen (EOL), 1, fp); hc_fwrite_direct (EOL, strlen (EOL), 1, fp);
// on error, add another newline // on error, add another newline
if (loglevel == LOGLEVEL_ERROR) if (loglevel == LOGLEVEL_ERROR)
{ {
// hc_fwrite (EOL, strlen (EOL), 1, fp);
hc_fwrite_direct (EOL, strlen (EOL), 1, fp); hc_fwrite_direct (EOL, strlen (EOL), 1, fp);
} }
} }
@ -351,8 +340,6 @@ static void main_cracker_hash_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx,
if (outfile_ctx->filename == NULL) if (user_options->quiet == false) clear_prompt (hashcat_ctx); if (outfile_ctx->filename == NULL) if (user_options->quiet == false) clear_prompt (hashcat_ctx);
} }
// hc_fwrite (buf, len, 1, stdout);
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (buf, len, 1, stdout); hc_fwrite_direct (buf, len, 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
@ -399,8 +386,6 @@ static void main_potfile_hash_show (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY
if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile
// hc_fwrite (buf, len, 1, stdout);
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (buf, len, 1, stdout); hc_fwrite_direct (buf, len, 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
} }
@ -411,8 +396,6 @@ static void main_potfile_hash_left (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY
if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile if (outfile_ctx->fp != NULL) return; // cracked hash was not written to an outfile
// hc_fwrite (buf, len, 1, stdout);
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (buf, len, 1, stdout); hc_fwrite_direct (buf, len, 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
} }

View File

@ -374,18 +374,14 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
int hashes_cnt = 0; int hashes_cnt = 0;
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return -1;
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return -1; if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return -1;
char *in = (char *) hcmalloc (sizeof (hccapx_t)); char *in = (char *) hcmalloc (sizeof (hccapx_t));
// while (!feof (fp))
while (!hc_feof (&fp_t)) while (!hc_feof (&fp_t))
{ {
// const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, fp);
const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, &fp_t); const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, &fp_t);
if (nread == 0) break; if (nread == 0) break;
@ -462,7 +458,6 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
hcfree (in); hcfree (in);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return hashes_cnt; return hashes_cnt;

View File

@ -349,18 +349,14 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
int hashes_cnt = 0; int hashes_cnt = 0;
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return -1;
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return -1; if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return -1;
char *in = (char *) hcmalloc (sizeof (hccapx_t)); char *in = (char *) hcmalloc (sizeof (hccapx_t));
// while (!feof (fp))
while (!hc_feof (&fp_t)) while (!hc_feof (&fp_t))
{ {
// const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, fp);
const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, &fp_t); const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, &fp_t);
if (nread == 0) break; if (nread == 0) break;
@ -437,7 +433,6 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
hcfree (in); hcfree (in);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return hashes_cnt; return hashes_cnt;

View File

@ -93,20 +93,16 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (line_len == 0) return (PARSER_HASH_LENGTH); if (line_len == 0) return (PARSER_HASH_LENGTH);
// FILE *fp = fopen ((const char *) line_buf, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE);
psafe3_t in; psafe3_t in;
memset (&in, 0, sizeof (psafe3_t)); memset (&in, 0, sizeof (psafe3_t));
// const size_t n = hc_fread (&in, sizeof (psafe3_t), 1, fp);
const size_t n = hc_fread (&in, sizeof (psafe3_t), 1, &fp_t); const size_t n = hc_fread (&in, sizeof (psafe3_t), 1, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != 1) return (PARSER_PSAFE3_FILE_SIZE); if (n != 1) return (PARSER_PSAFE3_FILE_SIZE);

View File

@ -146,20 +146,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -146,20 +146,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -144,20 +144,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -144,20 +144,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -144,20 +144,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -144,20 +144,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -146,20 +146,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -146,20 +146,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -146,20 +146,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -158,20 +158,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -158,20 +158,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -158,20 +158,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define TC_HEADER_SIZE 512 #define TC_HEADER_SIZE 512
char *in = (char *) hcmalloc (TC_HEADER_SIZE); char *in = (char *) hcmalloc (TC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE);

View File

@ -156,20 +156,16 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (line_len == 0) return (PARSER_HASH_LENGTH); if (line_len == 0) return (PARSER_HASH_LENGTH);
// FILE *fp = fopen ((const char *) line_buf, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE);
psafe2_hdr buf; psafe2_hdr buf;
memset (&buf, 0, sizeof (psafe2_hdr)); memset (&buf, 0, sizeof (psafe2_hdr));
// const size_t n = hc_fread (&buf, sizeof (psafe2_hdr), 1, fp);
const size_t n = hc_fread (&buf, sizeof (psafe2_hdr), 1, &fp_t); const size_t n = hc_fread (&buf, sizeof (psafe2_hdr), 1, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != 1) return (PARSER_PSAFE2_FILE_SIZE); if (n != 1) return (PARSER_PSAFE2_FILE_SIZE);

View File

@ -172,20 +172,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -172,20 +172,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -172,20 +172,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -170,20 +170,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -170,20 +170,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -170,20 +170,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -172,20 +172,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -172,20 +172,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -172,20 +172,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -173,20 +173,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -173,20 +173,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -173,20 +173,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -172,20 +172,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -172,20 +172,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -172,20 +172,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -173,20 +173,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -173,20 +173,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -173,20 +173,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -176,20 +176,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -176,20 +176,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -176,20 +176,16 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
{ {
// note: if module_hash_binary_parse exists, then module_hash_decode is not called // note: if module_hash_binary_parse exists, then module_hash_decode is not called
// FILE *fp = fopen (hashes->hashfile, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
#define VC_HEADER_SIZE 512 #define VC_HEADER_SIZE 512
char *in = (char *) hcmalloc (VC_HEADER_SIZE); char *in = (char *) hcmalloc (VC_HEADER_SIZE);
// const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t); const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp_t);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE);

View File

@ -351,20 +351,16 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (line_len == 0) return (PARSER_HASH_LENGTH); if (line_len == 0) return (PARSER_HASH_LENGTH);
// FILE *fp = fopen ((const char *) line_buf, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL) return (PARSER_HASH_FILE);
if (hc_fopen (&fp_t, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE); if (hc_fopen (&fp_t, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE);
struct luks_phdr hdr; struct luks_phdr hdr;
// const size_t nread = hc_fread (&hdr, sizeof (hdr), 1, fp);
const size_t nread = hc_fread (&hdr, sizeof (hdr), 1, &fp_t); const size_t nread = hc_fread (&hdr, sizeof (hdr), 1, &fp_t);
if (nread != 1) if (nread != 1)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_FILE_SIZE); return (PARSER_LUKS_FILE_SIZE);
@ -389,7 +385,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (memcmp (hdr.magic, luks_magic, LUKS_MAGIC_L) != 0) if (memcmp (hdr.magic, luks_magic, LUKS_MAGIC_L) != 0)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_MAGIC); return (PARSER_LUKS_MAGIC);
@ -397,7 +392,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (byte_swap_16 (hdr.version) != 1) if (byte_swap_16 (hdr.version) != 1)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_VERSION); return (PARSER_LUKS_VERSION);
@ -417,7 +411,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
} }
else else
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_CIPHER_TYPE); return (PARSER_LUKS_CIPHER_TYPE);
@ -445,7 +438,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
} }
else else
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_CIPHER_MODE); return (PARSER_LUKS_CIPHER_MODE);
@ -473,7 +465,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
} }
else else
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_HASH_TYPE); return (PARSER_LUKS_HASH_TYPE);
@ -495,7 +486,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
} }
else else
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_KEY_SIZE); return (PARSER_LUKS_KEY_SIZE);
@ -508,7 +498,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (active != LUKS_KEY_ENABLED) if (active != LUKS_KEY_ENABLED)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_KEY_DISABLED); return (PARSER_LUKS_KEY_DISABLED);
@ -516,7 +505,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (stripes != LUKS_STRIPES) if (stripes != LUKS_STRIPES)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_KEY_STRIPES); return (PARSER_LUKS_KEY_STRIPES);
@ -545,23 +533,19 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u32 keyMaterialOffset = byte_swap_32 (hdr.keyblock[keyslot_idx].keyMaterialOffset); const u32 keyMaterialOffset = byte_swap_32 (hdr.keyblock[keyslot_idx].keyMaterialOffset);
// const int rc_seek1 = fseeko (fp, keyMaterialOffset * 512, SEEK_SET);
const int rc_seek1 = hc_fseek (&fp_t, keyMaterialOffset * 512, SEEK_SET); const int rc_seek1 = hc_fseek (&fp_t, keyMaterialOffset * 512, SEEK_SET);
if (rc_seek1 == -1) if (rc_seek1 == -1)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_FILE_SIZE); return (PARSER_LUKS_FILE_SIZE);
} }
// const size_t nread2 = hc_fread (luks->af_src_buf, keyBytes, stripes, fp);
const size_t nread2 = hc_fread (luks->af_src_buf, keyBytes, stripes, &fp_t); const size_t nread2 = hc_fread (luks->af_src_buf, keyBytes, stripes, &fp_t);
if (nread2 != stripes) if (nread2 != stripes)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_FILE_SIZE); return (PARSER_LUKS_FILE_SIZE);
@ -571,23 +555,19 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
const u32 payloadOffset = byte_swap_32 (hdr.payloadOffset); const u32 payloadOffset = byte_swap_32 (hdr.payloadOffset);
// const int rc_seek2 = fseeko (fp, payloadOffset * 512, SEEK_SET);
const int rc_seek2 = hc_fseek (&fp_t, payloadOffset * 512, SEEK_SET); const int rc_seek2 = hc_fseek (&fp_t, payloadOffset * 512, SEEK_SET);
if (rc_seek2 == -1) if (rc_seek2 == -1)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_FILE_SIZE); return (PARSER_LUKS_FILE_SIZE);
} }
// const size_t nread3 = hc_fread (luks->ct_buf, sizeof (u32), 128, fp);
const size_t nread3 = hc_fread (luks->ct_buf, sizeof (u32), 128, &fp_t); const size_t nread3 = hc_fread (luks->ct_buf, sizeof (u32), 128, &fp_t);
if (nread3 != 128) if (nread3 != 128)
{ {
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_LUKS_FILE_SIZE); return (PARSER_LUKS_FILE_SIZE);
@ -595,7 +575,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// that should be it, close the fp // that should be it, close the fp
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
return (PARSER_OK); return (PARSER_OK);

View File

@ -594,7 +594,6 @@ static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr,
{ {
char mp_file[1024]; char mp_file[1024];
// const size_t nread = hc_fread (mp_file, 1, sizeof (mp_file) - 1, fp);
const size_t nread = hc_fread_direct (mp_file, 1, sizeof (mp_file) - 1, fp); const size_t nread = hc_fread_direct (mp_file, 1, sizeof (mp_file) - 1, fp);
if (!feof (fp)) if (!feof (fp))
@ -722,7 +721,6 @@ static int sp_setup_tbl (hashcat_ctx_t *hashcat_ctx)
u8 *inbuf = (u8 *) hcmalloc (s.st_size); u8 *inbuf = (u8 *) hcmalloc (s.st_size);
// SizeT inlen = (SizeT) hc_fread (inbuf, 1, s.st_size, fd);
SizeT inlen = (SizeT) hc_fread_direct (inbuf, 1, s.st_size, fd); SizeT inlen = (SizeT) hc_fread_direct (inbuf, 1, s.st_size, fd);
if (inlen != (SizeT) s.st_size) if (inlen != (SizeT) s.st_size)
@ -1480,7 +1478,6 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
while (!feof (mask_fp)) while (!feof (mask_fp))
{ {
// const size_t line_len = fgetl (mask_fp, line_buf);
const size_t line_len = fgetl (&fp_t, line_buf); const size_t line_len = fgetl (&fp_t, line_buf);
if (line_len == 0) continue; if (line_len == 0) continue;
@ -1579,7 +1576,6 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
while (!feof (mask_fp)) while (!feof (mask_fp))
{ {
// const size_t line_len = fgetl (mask_fp, line_buf);
const size_t line_len = fgetl (&fp_t, line_buf); const size_t line_len = fgetl (&fp_t, line_buf);
if (line_len == 0) continue; if (line_len == 0) continue;
@ -1659,7 +1655,6 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
while (!feof (mask_fp)) while (!feof (mask_fp))
{ {
// const size_t line_len = fgetl (mask_fp, line_buf);
const size_t line_len = fgetl (&fp_t, line_buf); const size_t line_len = fgetl (&fp_t, line_buf);
if (line_len == 0) continue; if (line_len == 0) continue;

View File

@ -529,8 +529,6 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int ou
if (outfile_ctx->fp != NULL) if (outfile_ctx->fp != NULL)
{ {
// hc_fwrite (tmp_buf, tmp_len, 1, outfile_ctx->fp);
// hc_fwrite (EOL, strlen (EOL), 1, outfile_ctx->fp);
hc_fwrite_direct (tmp_buf, tmp_len, 1, outfile_ctx->fp); hc_fwrite_direct (tmp_buf, tmp_len, 1, outfile_ctx->fp);
hc_fwrite_direct (EOL, strlen (EOL), 1, outfile_ctx->fp); hc_fwrite_direct (EOL, strlen (EOL), 1, outfile_ctx->fp);
} }

View File

@ -190,7 +190,6 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
while (!feof (fp)) while (!feof (fp))
{ {
// size_t line_len = fgetl (fp, line_buf);
size_t line_len = fgetl (&fp_t, line_buf); size_t line_len = fgetl (&fp_t, line_buf);
if (line_len == 0) continue; if (line_len == 0) continue;

View File

@ -22,7 +22,6 @@ static int check_running_process (hashcat_ctx_t *hashcat_ctx)
pidfile_data_t *pd = (pidfile_data_t *) hcmalloc (sizeof (pidfile_data_t)); pidfile_data_t *pd = (pidfile_data_t *) hcmalloc (sizeof (pidfile_data_t));
// const size_t nread = hc_fread (pd, sizeof (pidfile_data_t), 1, fp);
const size_t nread = hc_fread_direct (pd, sizeof (pidfile_data_t), 1, fp); const size_t nread = hc_fread_direct (pd, sizeof (pidfile_data_t), 1, fp);
fclose (fp); fclose (fp);
@ -163,7 +162,6 @@ static int write_pidfile (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// hc_fwrite (pd, sizeof (pidfile_data_t), 1, fp);
hc_fwrite_direct (pd, sizeof (pidfile_data_t), 1, fp); hc_fwrite_direct (pd, sizeof (pidfile_data_t), 1, fp);
fflush (fp); fflush (fp);

View File

@ -456,7 +456,6 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
// to sort by salt and we also need to have the correct order of dgst_pos0...dgst_pos3: // to sort by salt and we also need to have the correct order of dgst_pos0...dgst_pos3:
new_entry->hashconfig = (hashconfig_t *) hashconfig; // "const hashconfig_t" gives a warning new_entry->hashconfig = (hashconfig_t *) hashconfig; // "const hashconfig_t" gives a warning
// the following function searches if the "key" is already present and if not inserts the new entry: // the following function searches if the "key" is already present and if not inserts the new entry:
void **found = tsearch (new_entry, (void **) &all_hashes_tree, sort_pot_tree_by_hash); void **found = tsearch (new_entry, (void **) &all_hashes_tree, sort_pot_tree_by_hash);
@ -534,7 +533,6 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
while (!feof (potfile_ctx->fp)) while (!feof (potfile_ctx->fp))
{ {
// size_t line_len = fgetl (potfile_ctx->fp, line_buf);
size_t line_len = fgetl (&fp_t, line_buf); size_t line_len = fgetl (&fp_t, line_buf);
if (line_len == 0) continue; if (line_len == 0) continue;

View File

@ -221,7 +221,6 @@ static int write_restore (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// hc_fwrite (rd, sizeof (restore_data_t), 1, fp);
hc_fwrite_direct (rd, sizeof (restore_data_t), 1, fp); hc_fwrite_direct (rd, sizeof (restore_data_t), 1, fp);
for (u32 i = 0; i < rd->argc; i++) for (u32 i = 0; i < rd->argc; i++)

View File

@ -733,12 +733,10 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
char *rp_file = user_options->rp_files[i]; char *rp_file = user_options->rp_files[i];
// FILE *fp = NULL;
fp_tmp_t fp_t; fp_tmp_t fp_t;
u32 rule_line = 0; u32 rule_line = 0;
// if ((fp = fopen (rp_file, "rb")) == NULL)
if (hc_fopen (&fp_t, rp_file, "rb") == false) if (hc_fopen (&fp_t, rp_file, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", rp_file, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", rp_file, strerror (errno));
@ -751,10 +749,8 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
return -1; return -1;
} }
// while (!feof (fp))
while (!hc_feof (&fp_t)) while (!hc_feof (&fp_t))
{ {
// rule_len = (u32) fgetl (fp, rule_buf);
rule_len = (u32) fgetl (&fp_t, rule_buf); rule_len = (u32) fgetl (&fp_t, rule_buf);
rule_line++; rule_line++;
@ -797,7 +793,6 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
kernel_rules_cnt++; kernel_rules_cnt++;
} }
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
all_kernel_rules_cnt[i] = kernel_rules_cnt; all_kernel_rules_cnt[i] = kernel_rules_cnt;

View File

@ -678,25 +678,12 @@ size_t hc_fread_direct (void *ptr, size_t size, size_t nmemb, FILE *stream)
return fread (ptr, size, nmemb, stream); return fread (ptr, size, nmemb, stream);
} }
/*
size_t hc_fread (void *ptr, size_t size, size_t nmemb, FILE *stream)
{
return fread (ptr, size, nmemb, stream);
}
*/
void hc_fwrite_direct (const void *ptr, size_t size, size_t nmemb, FILE *stream) void hc_fwrite_direct (const void *ptr, size_t size, size_t nmemb, FILE *stream)
{ {
size_t rc = fwrite (ptr, size, nmemb, stream); size_t rc = fwrite (ptr, size, nmemb, stream);
if (rc == 0) rc = 0; if (rc == 0) rc = 0;
} }
/*
size_t hc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream)
{
return fwrite (ptr, size, nmemb, stream);
}
*/
int hc_fseek (fp_tmp_t *fp_t, off_t offset, int whence) int hc_fseek (fp_tmp_t *fp_t, off_t offset, int whence)
{ {

View File

@ -37,10 +37,8 @@ void slow_candidates_seek (hashcat_ctx_t *hashcat_ctx, void *extra_info, const u
while (1) while (1)
{ {
// FILE *fp = extra_info_straight->fp;
fp_tmp_t *fp_t = extra_info_straight->fp_t; fp_tmp_t *fp_t = extra_info_straight->fp_t;
// get_next_word (hashcat_ctx, fp, &line_buf, &line_len);
get_next_word (hashcat_ctx, fp_t, &line_buf, &line_len); get_next_word (hashcat_ctx, fp_t, &line_buf, &line_len);
// post-process rule engine // post-process rule engine
@ -78,8 +76,6 @@ void slow_candidates_seek (hashcat_ctx_t *hashcat_ctx, void *extra_info, const u
{ {
extra_info_combi_t *extra_info_combi = (extra_info_combi_t *) extra_info; extra_info_combi_t *extra_info_combi = (extra_info_combi_t *) extra_info;
// FILE *base_fp = extra_info_combi->base_fp;
// FILE *combs_fp = extra_info_combi->combs_fp;
fp_tmp_t *base_fp_t = extra_info_combi->base_fp_t; fp_tmp_t *base_fp_t = extra_info_combi->base_fp_t;
fp_tmp_t *combs_fp_t = extra_info_combi->combs_fp_t; fp_tmp_t *combs_fp_t = extra_info_combi->combs_fp_t;
@ -92,7 +88,6 @@ void slow_candidates_seek (hashcat_ctx_t *hashcat_ctx, void *extra_info, const u
while (1) while (1)
{ {
// get_next_word (hashcat_ctx, base_fp, &line_buf, &line_len);
get_next_word (hashcat_ctx, base_fp_t, &line_buf, &line_len); get_next_word (hashcat_ctx, base_fp_t, &line_buf, &line_len);
// post-process rule engine // post-process rule engine
@ -120,7 +115,6 @@ void slow_candidates_seek (hashcat_ctx_t *hashcat_ctx, void *extra_info, const u
extra_info_combi->base_len = line_len; extra_info_combi->base_len = line_len;
// rewind (combs_fp);
hc_rewind (combs_fp_t); hc_rewind (combs_fp_t);
} }
@ -129,7 +123,6 @@ void slow_candidates_seek (hashcat_ctx_t *hashcat_ctx, void *extra_info, const u
while (1) while (1)
{ {
// line_len = (u32) fgetl (combs_fp, line_buf);
line_len = (u32) fgetl (combs_fp_t, line_buf); line_len = (u32) fgetl (combs_fp_t, line_buf);
// post-process rule engine // post-process rule engine
@ -183,10 +176,8 @@ void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info)
while (1) while (1)
{ {
// FILE *fp = extra_info_straight->fp;
fp_tmp_t *fp_t = extra_info_straight->fp_t; fp_tmp_t *fp_t = extra_info_straight->fp_t;
// get_next_word (hashcat_ctx, fp, &line_buf, &line_len);
get_next_word (hashcat_ctx, fp_t, &line_buf, &line_len); get_next_word (hashcat_ctx, fp_t, &line_buf, &line_len);
line_len = (u32) convert_from_hex (hashcat_ctx, line_buf, line_len); line_len = (u32) convert_from_hex (hashcat_ctx, line_buf, line_len);
@ -247,8 +238,6 @@ void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info)
{ {
extra_info_combi_t *extra_info_combi = (extra_info_combi_t *) extra_info; extra_info_combi_t *extra_info_combi = (extra_info_combi_t *) extra_info;
// FILE *base_fp = extra_info_combi->base_fp;
// FILE *combs_fp = extra_info_combi->combs_fp;
fp_tmp_t *base_fp_t = extra_info_combi->base_fp_t; fp_tmp_t *base_fp_t = extra_info_combi->base_fp_t;
fp_tmp_t *combs_fp_t = extra_info_combi->combs_fp_t; fp_tmp_t *combs_fp_t = extra_info_combi->combs_fp_t;
@ -259,7 +248,6 @@ void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info)
while (1) while (1)
{ {
// get_next_word (hashcat_ctx, base_fp, &line_buf, &line_len);
get_next_word (hashcat_ctx, base_fp_t, &line_buf, &line_len); get_next_word (hashcat_ctx, base_fp_t, &line_buf, &line_len);
line_len = (u32) convert_from_hex (hashcat_ctx, line_buf, line_len); line_len = (u32) convert_from_hex (hashcat_ctx, line_buf, line_len);
@ -286,7 +274,6 @@ void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info)
extra_info_combi->base_len = line_len; extra_info_combi->base_len = line_len;
// rewind (combs_fp);
hc_rewind (combs_fp_t); hc_rewind (combs_fp_t);
} }
@ -299,7 +286,6 @@ void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info)
while (1) while (1)
{ {
// line_len = (u32) fgetl (combs_fp, line_buf);
line_len = (u32) fgetl (combs_fp_t, line_buf); line_len = (u32) fgetl (combs_fp_t, line_buf);
// post-process rule engine // post-process rule engine

View File

@ -18,7 +18,6 @@ static void out_flush (out_t *out)
{ {
if (out->len == 0) return; if (out->len == 0) return;
// hc_fwrite (out->buf, 1, out->len, out->fp);
hc_fwrite_direct (out->buf, 1, out->len, out->fp); hc_fwrite_direct (out->buf, 1, out->len, out->fp);
out->len = 0; out->len = 0;

View File

@ -70,10 +70,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
logfile_sub_var_string ("rulefile", user_options->rp_files[i]); logfile_sub_var_string ("rulefile", user_options->rp_files[i]);
} }
// FILE *fd = fopen (straight_ctx->dict, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fd == NULL)
if (hc_fopen (&fp_t, straight_ctx->dict, "rb") == false) if (hc_fopen (&fp_t, straight_ctx->dict, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", straight_ctx->dict, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", straight_ctx->dict, strerror (errno));
@ -81,10 +79,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// const int rc = count_words (hashcat_ctx, fd, straight_ctx->dict, &status_ctx->words_cnt);
const int rc = count_words (hashcat_ctx, &fp_t, straight_ctx->dict, &status_ctx->words_cnt); const int rc = count_words (hashcat_ctx, &fp_t, straight_ctx->dict, &status_ctx->words_cnt);
// fclose (fd);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (rc == -1) if (rc == -1)
@ -109,10 +105,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_LEFT) if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_LEFT)
{ {
// FILE *fd = fopen (combinator_ctx->dict1, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fd == NULL)
if (hc_fopen (&fp_t, combinator_ctx->dict1, "rb") == false) if (hc_fopen (&fp_t, combinator_ctx->dict1, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", combinator_ctx->dict1, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", combinator_ctx->dict1, strerror (errno));
@ -120,10 +114,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// const int rc = count_words (hashcat_ctx, fd, combinator_ctx->dict1, &status_ctx->words_cnt);
const int rc = count_words (hashcat_ctx, &fp_t, combinator_ctx->dict1, &status_ctx->words_cnt); const int rc = count_words (hashcat_ctx, &fp_t, combinator_ctx->dict1, &status_ctx->words_cnt);
// fclose (fd);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (rc == -1) if (rc == -1)
@ -135,10 +127,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
} }
else if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_RIGHT) else if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_RIGHT)
{ {
// FILE *fd = fopen (combinator_ctx->dict2, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fd == NULL)
if (hc_fopen (&fp_t, combinator_ctx->dict2, "rb") == false) if (hc_fopen (&fp_t, combinator_ctx->dict2, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", combinator_ctx->dict2, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", combinator_ctx->dict2, strerror (errno));
@ -146,10 +136,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// const int rc = count_words (hashcat_ctx, fd, combinator_ctx->dict2, &status_ctx->words_cnt);
const int rc = count_words (hashcat_ctx, &fp_t, combinator_ctx->dict2, &status_ctx->words_cnt); const int rc = count_words (hashcat_ctx, &fp_t, combinator_ctx->dict2, &status_ctx->words_cnt);
// fclose (fd);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (rc == -1) if (rc == -1)
@ -185,10 +173,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
logfile_sub_string (straight_ctx->dict); logfile_sub_string (straight_ctx->dict);
logfile_sub_string (mask_ctx->mask); logfile_sub_string (mask_ctx->mask);
// FILE *fd = fopen (straight_ctx->dict, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fd == NULL)
if (hc_fopen (&fp_t, straight_ctx->dict, "rb") == false) if (hc_fopen (&fp_t, straight_ctx->dict, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", straight_ctx->dict, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", straight_ctx->dict, strerror (errno));
@ -196,10 +182,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
return -1; return -1;
} }
// const int rc = count_words (hashcat_ctx, fd, straight_ctx->dict, &status_ctx->words_cnt);
const int rc = count_words (hashcat_ctx, &fp_t, straight_ctx->dict, &status_ctx->words_cnt); const int rc = count_words (hashcat_ctx, &fp_t, straight_ctx->dict, &status_ctx->words_cnt);
// fclose (fd);
hc_fclose (&fp_t); hc_fclose (&fp_t);
if (rc == -1) if (rc == -1)

View File

@ -977,7 +977,6 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
printf ("%d\t", util); printf ("%d\t", util);
} }
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
fflush (stdout); fflush (stdout);
@ -1065,7 +1064,6 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
printf (" \"time_start\": %" PRIu64 ",", (u64) status_ctx->runtime_start); printf (" \"time_start\": %" PRIu64 ",", (u64) status_ctx->runtime_start);
printf (" \"estimated_stop\": %" PRIu64 " }", (u64) end); printf (" \"estimated_stop\": %" PRIu64 " }", (u64) end);
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
fflush (stdout); fflush (stdout);

View File

@ -68,10 +68,8 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
hc_asprintf (&tuning_db_file, "%s/%s", folder_config->shared_dir, TUNING_DB_FILE); hc_asprintf (&tuning_db_file, "%s/%s", folder_config->shared_dir, TUNING_DB_FILE);
// FILE *fp = fopen (tuning_db_file, "rb");
fp_tmp_t fp_t; fp_tmp_t fp_t;
// if (fp == NULL)
if (hc_fopen (&fp_t, tuning_db_file, "rb") == false) if (hc_fopen (&fp_t, tuning_db_file, "rb") == false)
{ {
event_log_error (hashcat_ctx, "%s: %s", tuning_db_file, strerror (errno)); event_log_error (hashcat_ctx, "%s: %s", tuning_db_file, strerror (errno));
@ -81,7 +79,6 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
hcfree (tuning_db_file); hcfree (tuning_db_file);
// const size_t num_lines = count_lines (fp);
const size_t num_lines = count_lines (&fp_t); const size_t num_lines = count_lines (&fp_t);
// a bit over-allocated // a bit over-allocated
@ -92,17 +89,14 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
tuning_db->entry_buf = (tuning_db_entry_t *) hccalloc (num_lines + 1, sizeof (tuning_db_entry_t)); tuning_db->entry_buf = (tuning_db_entry_t *) hccalloc (num_lines + 1, sizeof (tuning_db_entry_t));
tuning_db->entry_cnt = 0; tuning_db->entry_cnt = 0;
// rewind (fp);
hc_rewind (&fp_t); hc_rewind (&fp_t);
int line_num = 0; int line_num = 0;
char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE); char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
// while (!feof (fp))
while (!hc_feof (&fp_t)) while (!hc_feof (&fp_t))
{ {
// char *line_buf = fgets (buf, HCBUFSIZ_LARGE - 1, fp);
char *line_buf = hc_fgets (buf, HCBUFSIZ_LARGE - 1, &fp_t); char *line_buf = hc_fgets (buf, HCBUFSIZ_LARGE - 1, &fp_t);
if (line_buf == NULL) break; if (line_buf == NULL) break;
@ -276,7 +270,6 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
hcfree (buf); hcfree (buf);
// fclose (fp);
hc_fclose (&fp_t); hc_fclose (&fp_t);
// todo: print loaded 'cnt' message // todo: print loaded 'cnt' message

View File

@ -269,7 +269,6 @@ void usage_mini_print (const char *progname)
{ {
printf (USAGE_MINI[i], progname); printf (USAGE_MINI[i], progname);
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
} }
} }
@ -316,7 +315,6 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
{ {
printf ("%s", USAGE_BIG_PRE_HASHMODES[i]); printf ("%s", USAGE_BIG_PRE_HASHMODES[i]);
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
} }
@ -326,11 +324,9 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
{ {
printf ("%7d | %-48s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category)); printf ("%7d | %-48s | %s", usage_sort_buf[i].hash_mode, usage_sort_buf[i].hash_name, strhashcategory (usage_sort_buf[i].hash_category));
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
} }
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
for (int i = 0; i < usage_sort_cnt; i++) for (int i = 0; i < usage_sort_cnt; i++)
@ -344,10 +340,8 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
{ {
printf ("%s", USAGE_BIG_POST_HASHMODES[i]); printf ("%s", USAGE_BIG_POST_HASHMODES[i]);
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
} }
// hc_fwrite (EOL, strlen (EOL), 1, stdout);
hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout);
} }

View File

@ -47,7 +47,6 @@ size_t convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const size_
return (line_len); return (line_len);
} }
//int load_segment (hashcat_ctx_t *hashcat_ctx, FILE *fd)
int load_segment (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t) int load_segment (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t)
{ {
wl_data_t *wl_data = hashcat_ctx->wl_data; wl_data_t *wl_data = hashcat_ctx->wl_data;
@ -56,7 +55,6 @@ int load_segment (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t)
wl_data->pos = 0; wl_data->pos = 0;
// wl_data->cnt = hc_fread (wl_data->buf, 1, wl_data->incr - 1000, fd);
wl_data->cnt = hc_fread (wl_data->buf, 1, wl_data->incr - 1000, fp_t); wl_data->cnt = hc_fread (wl_data->buf, 1, wl_data->incr - 1000, fp_t);
wl_data->buf[wl_data->cnt] = 0; wl_data->buf[wl_data->cnt] = 0;
@ -65,7 +63,6 @@ int load_segment (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t)
if (wl_data->buf[wl_data->cnt - 1] == '\n') return 0; if (wl_data->buf[wl_data->cnt - 1] == '\n') return 0;
// while (!feof (fd))
while (!hc_feof (fp_t)) while (!hc_feof (fp_t))
{ {
if (wl_data->cnt == wl_data->avail) if (wl_data->cnt == wl_data->avail)
@ -75,7 +72,6 @@ int load_segment (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t)
wl_data->avail += wl_data->incr; wl_data->avail += wl_data->incr;
} }
// const int c = fgetc (fd);
const int c = hc_fgetc (fp_t); const int c = hc_fgetc (fp_t);
if (c == EOF) break; if (c == EOF) break;
@ -174,7 +170,6 @@ void get_next_word_std (char *buf, u64 sz, u64 *len, u64 *off)
*len = sz; *len = sz;
} }
//void get_next_word (hashcat_ctx_t *hashcat_ctx, FILE *fd, char **out_buf, u32 *out_len)
void get_next_word (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, char **out_buf, u32 *out_len) void get_next_word (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, char **out_buf, u32 *out_len)
{ {
user_options_t *user_options = hashcat_ctx->user_options; user_options_t *user_options = hashcat_ctx->user_options;
@ -230,7 +225,6 @@ void get_next_word (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, char **out_buf,
return; return;
} }
// if (feof (fd))
if (hc_feof (fp_t)) if (hc_feof (fp_t))
{ {
fprintf (stderr, "BUG feof()!!\n"); fprintf (stderr, "BUG feof()!!\n");
@ -238,10 +232,8 @@ void get_next_word (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, char **out_buf,
return; return;
} }
// load_segment (hashcat_ctx, fd);
load_segment (hashcat_ctx, fp_t); load_segment (hashcat_ctx, fp_t);
// get_next_word (hashcat_ctx, fd, out_buf, out_len);
get_next_word (hashcat_ctx, fp_t, out_buf, out_len); get_next_word (hashcat_ctx, fp_t, out_buf, out_len);
} }
@ -325,7 +317,6 @@ void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len
} }
} }
//int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64 *result)
int count_words (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, const char *dictfile, u64 *result) int count_words (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, const char *dictfile, u64 *result)
{ {
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx; combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
@ -342,7 +333,6 @@ int count_words (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, const char *dictfil
d.cnt = 0; d.cnt = 0;
// if (fstat (fileno (fd), &d.stat))
if (fstat (hc_fileno (fp_t), &d.stat)) if (fstat (hc_fileno (fp_t), &d.stat))
{ {
*result = 0; *result = 0;
@ -435,10 +425,8 @@ int count_words (hashcat_ctx_t *hashcat_ctx, fp_tmp_t *fp_t, const char *dictfil
u64 cnt = 0; u64 cnt = 0;
u64 cnt2 = 0; u64 cnt2 = 0;
// while (!feof (fd))
while (!hc_feof (fp_t)) while (!hc_feof (fp_t))
{ {
// load_segment (hashcat_ctx, fd);
load_segment (hashcat_ctx, fp_t); load_segment (hashcat_ctx, fp_t);
comp += wl_data->cnt; comp += wl_data->cnt;