diff --git a/include/filehandling.h b/include/filehandling.h index ebd2b4cc0..5af89b268 100644 --- a/include/filehandling.h +++ b/include/filehandling.h @@ -10,10 +10,8 @@ #include #include -//u64 count_lines (FILE *fd); 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 superchop_with_length (char *buf, const size_t len); diff --git a/include/hlfmt.h b/include/hlfmt.h index 8fa346e5d..b6c12bf52 100644 --- a/include/hlfmt.h +++ b/include/hlfmt.h @@ -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_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); #endif // _HLFMT_H diff --git a/include/shared.h b/include/shared.h index 7e988558d..8cbd58f7d 100644 --- a/include/shared.h +++ b/include/shared.h @@ -62,8 +62,6 @@ bool hc_string_is_digit (const char *s); void hc_string_trim_trailing (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); 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); diff --git a/include/slow_candidates.h b/include/slow_candidates.h index 4ba0729fc..f29b2449b 100644 --- a/include/slow_candidates.h +++ b/include/slow_candidates.h @@ -10,7 +10,6 @@ typedef struct extra_info_straight { u64 pos; -// FILE *fp; fp_tmp_t *fp_t; u64 rule_pos_prev; @@ -28,8 +27,6 @@ typedef struct extra_info_combi { u64 pos; -// FILE *base_fp; -// FILE *combs_fp; fp_tmp_t *base_fp_t; fp_tmp_t *combs_fp_t; diff --git a/include/types.h b/include/types.h index bb7b55026..9afd3e89a 100644 --- a/include/types.h +++ b/include/types.h @@ -1165,7 +1165,6 @@ typedef struct hc_device_param char *scratch_buf; -// FILE *combs_fp; fp_tmp_t *combs_fp_t; pw_t *combs_buf; diff --git a/include/wordlist.h b/include/wordlist.h index 52ee40629..0fe511733 100644 --- a/include/wordlist.h +++ b/include/wordlist.h @@ -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_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); 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); diff --git a/src/backend.c b/src/backend.c index 9db0c93a2..4e2db3cb9 100644 --- a/src/backend.c +++ b/src/backend.c @@ -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); -// 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); fclose (fp); @@ -522,7 +521,6 @@ static bool write_kernel_binary (hashcat_ctx_t *hashcat_ctx, char *kernel_file, return false; } -// hc_fwrite (binary, sizeof (char), binary_size, fp); hc_fwrite_direct (binary, sizeof (char), binary_size, 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[32] = salt_buf->digests_offset; -// FILE *combs_fp = device_param->combs_fp; fp_tmp_t *combs_fp_t = device_param->combs_fp_t; 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))) { -// rewind (combs_fp); 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) { -// if (feof (combs_fp)) 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); 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) { -// if (feof (combs_fp)) 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); line_len = convert_from_hex (hashcat_ctx, line_buf, line_len); diff --git a/src/combinator.c b/src/combinator.c index 4111a0bbd..fb210ae24 100644 --- a/src/combinator.c +++ b/src/combinator.c @@ -60,12 +60,9 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) return -1; } -// FILE *fp1 = NULL; -// FILE *fp2 = NULL; fp_tmp_t fp1_t; fp_tmp_t fp2_t; -// if ((fp1 = fopen (dictfile1, "rb")) == NULL) if (hc_fopen (&fp1_t, dictfile1, "rb") == false) { 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; } -// if ((fp2 = fopen (dictfile2, "rb")) == NULL) if (hc_fopen (&fp2_t, dictfile2, "rb") == false) { event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno)); -// fclose (fp1); hc_fclose (&fp1_t); return -1; @@ -88,15 +83,12 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) 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); if (rc1 == -1) { event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1); -// fclose (fp1); -// fclose (fp2); hc_fclose (&fp1_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); -// fclose (fp1); -// fclose (fp2); hc_fclose (&fp1_t); hc_fclose (&fp2_t); @@ -119,11 +109,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) 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); -// fclose (fp1); -// fclose (fp2); hc_fclose (&fp1_t); hc_fclose (&fp2_t); @@ -176,12 +163,9 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) return -1; } -// FILE *fp1 = NULL; -// FILE *fp2 = NULL; fp_tmp_t fp1_t; fp_tmp_t fp2_t; -// if ((fp1 = fopen (dictfile1, "rb")) == NULL) if (hc_fopen (&fp1_t, dictfile1, "rb") == false) { 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; } -// if ((fp2 = fopen (dictfile2, "rb")) == NULL) if (hc_fopen (&fp2_t, dictfile2, "rb") == false) { event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno)); -// fclose (fp1); hc_fclose (&fp1_t); return -1; @@ -204,15 +186,12 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) 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); if (rc1 == -1) { event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1); -// fclose (fp1); -// fclose (fp2); hc_fclose (&fp1_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); -// fclose (fp1); -// fclose (fp2); hc_fclose (&fp1_t); hc_fclose (&fp2_t); @@ -235,11 +212,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) 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); -// fclose (fp1); -// fclose (fp2); hc_fclose (&fp1_t); hc_fclose (&fp2_t); @@ -320,12 +294,9 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) return -1; } -// FILE *fp1 = NULL; -// FILE *fp2 = NULL; fp_tmp_t fp1_t; fp_tmp_t fp2_t; -// if ((fp1 = fopen (dictfile1, "rb")) == NULL) if (hc_fopen (&fp1_t, dictfile1, "rb") == false) { 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; } -// if ((fp2 = fopen (dictfile2, "rb")) == NULL) if (hc_fopen (&fp2_t, dictfile2, "rb") == false) { event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno)); -// fclose (fp1); hc_fclose (&fp1_t); return -1; @@ -348,15 +317,12 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) 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); if (rc1 == -1) { event_log_error (hashcat_ctx, "Integer overflow detected in keyspace of wordlist: %s", dictfile1); -// fclose (fp1); -// fclose (fp2); hc_fclose (&fp1_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); -// fclose (fp1); -// fclose (fp2); hc_fclose (&fp1_t); hc_fclose (&fp2_t); @@ -379,11 +343,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) 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); -// fclose (fp1); -// fclose (fp2); hc_fclose (&fp1_t); hc_fclose (&fp2_t); @@ -426,10 +387,8 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx) return -1; } -// FILE *fp = NULL; fp_tmp_t fp_t; -// if ((fp = fopen (dictfile, "rb")) == NULL) if (hc_fopen (&fp_t, dictfile, "rb") == false) { 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; -// const int rc = count_words (hashcat_ctx, fp, dictfile, &words_cnt); const int rc = count_words (hashcat_ctx, &fp_t, dictfile, &words_cnt); 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); -// fclose (fp); - return -1; } -// fclose (fp); - combinator_ctx->combs_cnt = words_cnt; combinator_ctx->combs_mode = COMBINATOR_MODE_BASE_LEFT; } diff --git a/src/cpu_crc32.c b/src/cpu_crc32.c index 86069625c..6df97040f 100644 --- a/src/cpu_crc32.c +++ b/src/cpu_crc32.c @@ -98,7 +98,6 @@ int cpu_crc32 (const char *filename, u8 keytab[64]) 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); fclose (fd); diff --git a/src/debugfile.c b/src/debugfile.c index bfe36ec67..6d5c74d1c 100644 --- a/src/debugfile.c +++ b/src/debugfile.c @@ -48,7 +48,6 @@ static void debugfile_format_plain (hashcat_ctx_t *hashcat_ctx, const u8 *plain_ } else { -// hc_fwrite (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); } -// hc_fwrite (rule_buf, rule_len, 1, debugfile_ctx->fp); hc_fwrite_direct (rule_buf, rule_len, 1, debugfile_ctx->fp); 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); } -// hc_fwrite (EOL, strlen (EOL), 1, debugfile_ctx->fp); hc_fwrite_direct (EOL, strlen (EOL), 1, debugfile_ctx->fp); } diff --git a/src/dictstat.c b/src/dictstat.c index fd37c3faa..36c5ced2c 100644 --- a/src/dictstat.c +++ b/src/dictstat.c @@ -110,8 +110,6 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx) u64 v; 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 nread2 = hc_fread_direct (&z, sizeof (u64), 1, fp); @@ -160,7 +158,6 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx) { 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); if (nread == 0) continue; @@ -213,14 +210,11 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx) v = byte_swap_64 (v); 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 (&z, sizeof (u64), 1, fp); // 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); fclose (fp); diff --git a/src/dispatch.c b/src/dispatch.c index 93ab938fe..1a8203135 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -427,10 +427,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param) { char *dictfile = straight_ctx->dict; -// FILE *fp = fopen (dictfile, "rb"); fp_tmp_t fp_t; -// if (fp == NULL) if (hc_fopen (&fp_t, dictfile, "rb") == false) { 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)); -// extra_info_straight.fp = fp; extra_info_straight.fp_t = &fp_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) { -// fclose (fp); hc_fclose (&fp_t); 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) { -// fclose (fp); hc_fclose (&fp_t); 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) { -// fclose (fp); hc_fclose (&fp_t); 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; } -// fclose (fp); hc_fclose (&fp_t); 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; } -// FILE *base_fp = fopen (base_file, "rb"); fp_tmp_t base_fp_t; -// if (base_fp == NULL) if (hc_fopen (&base_fp_t, base_file, "rb") == false) { 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; } -// FILE *combs_fp = fopen (combs_file, "rb"); fp_tmp_t combs_fp_t; -// if (combs_fp == NULL) if (hc_fopen (&combs_fp_t, combs_file, "rb") == false) { 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)); -// 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.combs_fp_t = &combs_fp_t; 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) { -// fclose (combs_fp); hc_fclose (&combs_fp_t); -// fclose (base_fp); hc_fclose (&base_fp_t); 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) { -// fclose (combs_fp); hc_fclose (&combs_fp_t); -// fclose (base_fp); hc_fclose (&base_fp_t); 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) { -// fclose (combs_fp); hc_fclose (&combs_fp_t); -// fclose (base_fp); hc_fclose (&base_fp_t); 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; } -// fclose (combs_fp); hc_fclose (&combs_fp_t); -// fclose (base_fp); hc_fclose (&base_fp_t); 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; -// FILE *combs_fp = fopen (dictfile, "rb"); fp_tmp_t combs_fp_t; -// if (combs_fp == NULL) if (hc_fopen (&combs_fp_t, dictfile, "rb") == false) { 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; } -// device_param->combs_fp = combs_fp; 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; -// FILE *combs_fp = fopen (dictfilec, "rb"); fp_tmp_t combs_fp_t; -// if (combs_fp == NULL) if (hc_fopen (&combs_fp_t, dictfilec, "rb") == false) { 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; } -// device_param->combs_fp = combs_fp; device_param->combs_fp_t = &combs_fp_t; } else if (combs_mode == COMBINATOR_MODE_BASE_RIGHT) { const char *dictfilec = combinator_ctx->dict1; -// FILE *combs_fp = fopen (dictfilec, "rb"); fp_tmp_t combs_fp_t; -// if (combs_fp == NULL) if (hc_fopen (&combs_fp_t, dictfilec, "rb") == false) { 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; } -// device_param->combs_fp = combs_fp; device_param->combs_fp_t = &combs_fp_t; } } -// FILE *fd = fopen (dictfile, "rb"); fp_tmp_t fp_t; -// if (fd == NULL) if (hc_fopen (&fp_t, dictfile, "rb") == false) { 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 (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp); if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t); -// fclose (fd); hc_fclose (&fp_t); 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]; -// 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_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); 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 (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp); if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t); -// fclose (fd); hc_fclose (&fp_t); 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 (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp); if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t); -// fclose (fd); hc_fclose (&fp_t); 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 (attack_mode == ATTACK_MODE_COMBI) fclose (device_param->combs_fp); if (attack_mode == ATTACK_MODE_COMBI) hc_fclose (device_param->combs_fp_t); -// fclose (fd); hc_fclose (&fp_t); wl_data_destroy (hashcat_ctx_tmp); diff --git a/src/filehandling.c b/src/filehandling.c index 84f5b8309..f8d25cbad 100644 --- a/src/filehandling.c +++ b/src/filehandling.c @@ -9,7 +9,6 @@ #include "shared.h" #include "filehandling.h" -//u64 count_lines (FILE *fd) u64 count_lines (fp_tmp_t *fp_t) { u64 cnt = 0; @@ -18,10 +17,8 @@ u64 count_lines (fp_tmp_t *fp_t) char prev = '\n'; -// while (!feof (fd)) 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); if (nread < 1) continue; @@ -41,15 +38,12 @@ u64 count_lines (fp_tmp_t *fp_t) return cnt; } -//size_t fgetl (FILE *fp, char *line_buf) size_t fgetl (fp_tmp_t *fp_t, char *line_buf) { size_t line_len = 0; -// while (!feof (fp)) while (!hc_feof (fp_t)) { -// const int c = fgetc (fp); const int c = hc_fgetc (fp_t); if (c == EOF) break; diff --git a/src/hashes.c b/src/hashes.c index ad1881624..666f385b8 100644 --- a/src/hashes.c +++ b/src/hashes.c @@ -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); -// hc_fwrite (binary_buf, binary_len, 1, fp); hc_fwrite_direct (binary_buf, binary_len, 1, fp); hcfree (binary_buf); @@ -675,10 +674,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) } else if (hashlist_mode == HL_MODE_FILE_PLAIN) { -// FILE *fp = NULL; fp_tmp_t fp_t; -// if ((fp = fopen (hashfile, "rb")) == NULL) if (hc_fopen (&fp_t, hashfile, "rb") == false) { 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)); -// hashes_avail = count_lines (fp); hashes_avail = count_lines (&fp_t); EVENT_DATA (EVENT_HASHLIST_COUNT_LINES_POST, hashfile, strlen (hashfile)); -// rewind (fp); hc_rewind (&fp_t); if (hashes_avail == 0) { event_log_error (hashcat_ctx, "hashfile is empty or corrupt."); -// fclose (fp); hc_fclose (&fp_t); 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 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."); -// fclose (fp); - return -1; } - -// fclose (fp); } 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) { -// FILE *fp; fp_tmp_t fp_t; -// if ((fp = fopen (hashfile, "rb")) == NULL) if (hc_fopen (&fp_t, hashfile, "rb") == false) { 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 now = 0; -// while (!feof (fp)) while (!hc_feof (&fp_t)) { line_num++; -// const size_t line_len = fgetl (fp, line_buf); const size_t line_len = fgetl (&fp_t, line_buf); if (line_len == 0) continue; @@ -1250,7 +1235,6 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx) hcfree (line_buf); -// fclose (fp); hc_fclose (&fp_t); } 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); -// FILE *fp = fopen (tmpfile_bin, "wb"); fp_tmp_t fp_t; 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); -// fputc (c, fp); hc_fputc (c, &fp_t); } -// fclose (fp); 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)); diff --git a/src/hlfmt.c b/src/hlfmt.c index ab3533799..27d9dc868 100644 --- a/src/hlfmt.c +++ b/src/hlfmt.c @@ -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) { 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); -// while (!feof (fp)) while (!hc_feof (fp_t)) { -// const size_t line_len = fgetl (fp, line_buf); const size_t line_len = fgetl (fp_t, line_buf); if (line_len == 0) continue; diff --git a/src/keyboard_layout.c b/src/keyboard_layout.c index 313d28e2d..7905d1ca2 100644 --- a/src/keyboard_layout.c +++ b/src/keyboard_layout.c @@ -22,18 +22,14 @@ bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_m { char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE); -// FILE *fp = fopen (filename, "r"); fp_tmp_t fp_t; if (hc_fopen(&fp_t, filename, "r") == false) return false; -// if (fp == NULL) return false; int maps_cnt = 0; -// while (!feof (fp)) while (!hc_feof (&fp_t)) { -// const size_t line_len = fgetl (fp, line_buf); const size_t line_len = fgetl (&fp_t, line_buf); 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) { -// fclose (fp); hc_fclose (&fp_t); free (line_buf); @@ -72,7 +67,6 @@ bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_m if (maps_cnt == 256) { -// fclose (fp); hc_fclose (&fp_t); free (line_buf); @@ -85,7 +79,6 @@ bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_m *keyboard_layout_mapping_cnt = maps_cnt; -// fclose (fp); hc_fclose (&fp_t); free (line_buf); diff --git a/src/logfile.c b/src/logfile.c index 7f84c5727..b03fc4591 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -62,7 +62,6 @@ void logfile_append (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...) va_end (ap); -// hc_fwrite (EOL, strlen (EOL), 1, fp); hc_fwrite_direct (EOL, strlen (EOL), 1, fp); fflush (fp); diff --git a/src/loopback.c b/src/loopback.c index 05ab4ff60..84836adeb 100644 --- a/src/loopback.c +++ b/src/loopback.c @@ -49,7 +49,6 @@ static void loopback_format_plain (hashcat_ctx_t *hashcat_ctx, const u8 *plain_p } else { -// hc_fwrite (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); -// hc_fwrite (EOL, strlen (EOL), 1, fp); hc_fwrite_direct (EOL, strlen (EOL), 1, fp); fflush (fp); diff --git a/src/main.c b/src/main.c index 6694d19d7..52c2145d1 100644 --- a/src/main.c +++ b/src/main.c @@ -100,10 +100,6 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel) #else 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_WARNING: hc_fwrite_direct ("\033[33m", 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 -// hc_fwrite (msg_buf, msg_len, 1, fp); hc_fwrite_direct (msg_buf, msg_len, 1, fp); // color stuff post @@ -129,10 +124,6 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel) #else 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_WARNING: 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) { -// hc_fwrite (EOL, strlen (EOL), 1, fp); hc_fwrite_direct (EOL, strlen (EOL), 1, fp); // on error, add another newline if (loglevel == LOGLEVEL_ERROR) { -// hc_fwrite (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); } -// hc_fwrite (buf, len, 1, stdout); -// hc_fwrite (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (buf, len, 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 -// hc_fwrite (buf, len, 1, stdout); -// hc_fwrite (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (buf, len, 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 -// hc_fwrite (buf, len, 1, stdout); -// hc_fwrite (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (buf, len, 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); } diff --git a/src/modules/module_02500.c b/src/modules/module_02500.c index 3d70d9e9e..191dc6af4 100644 --- a/src/modules/module_02500.c +++ b/src/modules/module_02500.c @@ -374,18 +374,14 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE int hashes_cnt = 0; -// FILE *fp = fopen (hashes->hashfile, "rb"); fp_tmp_t fp_t; -// if (fp == NULL) return -1; if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return -1; char *in = (char *) hcmalloc (sizeof (hccapx_t)); -// while (!feof (fp)) 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); if (nread == 0) break; @@ -462,7 +458,6 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE hcfree (in); -// fclose (fp); hc_fclose (&fp_t); return hashes_cnt; diff --git a/src/modules/module_02501.c b/src/modules/module_02501.c index 5b8784bb7..384615f9c 100644 --- a/src/modules/module_02501.c +++ b/src/modules/module_02501.c @@ -349,18 +349,14 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE int hashes_cnt = 0; -// FILE *fp = fopen (hashes->hashfile, "rb"); fp_tmp_t fp_t; -// if (fp == NULL) return -1; if (hc_fopen (&fp_t, hashes->hashfile, "rb") == false) return -1; char *in = (char *) hcmalloc (sizeof (hccapx_t)); -// while (!feof (fp)) 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); if (nread == 0) break; @@ -437,7 +433,6 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE hcfree (in); -// fclose (fp); hc_fclose (&fp_t); return hashes_cnt; diff --git a/src/modules/module_05200.c b/src/modules/module_05200.c index ab2276990..8536cf611 100644 --- a/src/modules/module_05200.c +++ b/src/modules/module_05200.c @@ -93,20 +93,16 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE if (line_len == 0) return (PARSER_HASH_LENGTH); -// FILE *fp = fopen ((const char *) line_buf, "rb"); 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); psafe3_t in; 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); -// fclose (fp); hc_fclose (&fp_t); if (n != 1) return (PARSER_PSAFE3_FILE_SIZE); diff --git a/src/modules/module_06211.c b/src/modules/module_06211.c index 8af0ff397..d0dfcfcc5 100644 --- a/src/modules/module_06211.c +++ b/src/modules/module_06211.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06212.c b/src/modules/module_06212.c index 4519ca378..967ef0381 100644 --- a/src/modules/module_06212.c +++ b/src/modules/module_06212.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06213.c b/src/modules/module_06213.c index 722a52535..b312ba0bb 100644 --- a/src/modules/module_06213.c +++ b/src/modules/module_06213.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06221.c b/src/modules/module_06221.c index da6f9a99c..cf5f4977a 100644 --- a/src/modules/module_06221.c +++ b/src/modules/module_06221.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06222.c b/src/modules/module_06222.c index 5649e9d3f..cf896f267 100644 --- a/src/modules/module_06222.c +++ b/src/modules/module_06222.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06223.c b/src/modules/module_06223.c index a0fc13545..cf6670838 100644 --- a/src/modules/module_06223.c +++ b/src/modules/module_06223.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06231.c b/src/modules/module_06231.c index a92f02120..da825b156 100644 --- a/src/modules/module_06231.c +++ b/src/modules/module_06231.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06232.c b/src/modules/module_06232.c index c751dda25..42437449a 100644 --- a/src/modules/module_06232.c +++ b/src/modules/module_06232.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06233.c b/src/modules/module_06233.c index e3754f393..11139ad48 100644 --- a/src/modules/module_06233.c +++ b/src/modules/module_06233.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06241.c b/src/modules/module_06241.c index 3fcd4476f..632b4f879 100644 --- a/src/modules/module_06241.c +++ b/src/modules/module_06241.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06242.c b/src/modules/module_06242.c index 40674e906..3cc19ca9b 100644 --- a/src/modules/module_06242.c +++ b/src/modules/module_06242.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_06243.c b/src/modules/module_06243.c index de44e5baf..67e876475 100644 --- a/src/modules/module_06243.c +++ b/src/modules/module_06243.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define TC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != TC_HEADER_SIZE) return (PARSER_TC_FILE_SIZE); diff --git a/src/modules/module_09000.c b/src/modules/module_09000.c index 42a98712b..5eb308396 100644 --- a/src/modules/module_09000.c +++ b/src/modules/module_09000.c @@ -156,20 +156,16 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE if (line_len == 0) return (PARSER_HASH_LENGTH); -// FILE *fp = fopen ((const char *) line_buf, "rb"); 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); psafe2_hdr buf; 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); -// fclose (fp); hc_fclose (&fp_t); if (n != 1) return (PARSER_PSAFE2_FILE_SIZE); diff --git a/src/modules/module_13711.c b/src/modules/module_13711.c index 0c02be7d9..65946b119 100644 --- a/src/modules/module_13711.c +++ b/src/modules/module_13711.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13712.c b/src/modules/module_13712.c index 6d4b073eb..983d5579c 100644 --- a/src/modules/module_13712.c +++ b/src/modules/module_13712.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13713.c b/src/modules/module_13713.c index 0f589fb05..d76fbe08e 100644 --- a/src/modules/module_13713.c +++ b/src/modules/module_13713.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13721.c b/src/modules/module_13721.c index 70bb775bc..ffa59298e 100644 --- a/src/modules/module_13721.c +++ b/src/modules/module_13721.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13722.c b/src/modules/module_13722.c index 59fa510c4..fdba804b2 100644 --- a/src/modules/module_13722.c +++ b/src/modules/module_13722.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13723.c b/src/modules/module_13723.c index 27d54e602..7ddad2989 100644 --- a/src/modules/module_13723.c +++ b/src/modules/module_13723.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13731.c b/src/modules/module_13731.c index 80af97f3f..f5631c2a0 100644 --- a/src/modules/module_13731.c +++ b/src/modules/module_13731.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13732.c b/src/modules/module_13732.c index c0080359d..39b2a1052 100644 --- a/src/modules/module_13732.c +++ b/src/modules/module_13732.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13733.c b/src/modules/module_13733.c index 602ac5ffd..d006a75ad 100644 --- a/src/modules/module_13733.c +++ b/src/modules/module_13733.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13741.c b/src/modules/module_13741.c index 86267b528..e4347177a 100644 --- a/src/modules/module_13741.c +++ b/src/modules/module_13741.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13742.c b/src/modules/module_13742.c index 7b9360246..e343b9648 100644 --- a/src/modules/module_13742.c +++ b/src/modules/module_13742.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13743.c b/src/modules/module_13743.c index d7677c67b..015670ffa 100644 --- a/src/modules/module_13743.c +++ b/src/modules/module_13743.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13751.c b/src/modules/module_13751.c index 605708734..4afaf821c 100644 --- a/src/modules/module_13751.c +++ b/src/modules/module_13751.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13752.c b/src/modules/module_13752.c index 457d4e51a..09bd0ca5c 100644 --- a/src/modules/module_13752.c +++ b/src/modules/module_13752.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13753.c b/src/modules/module_13753.c index 07b19c12e..25188381c 100644 --- a/src/modules/module_13753.c +++ b/src/modules/module_13753.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13761.c b/src/modules/module_13761.c index ca0d7262a..2c8253081 100644 --- a/src/modules/module_13761.c +++ b/src/modules/module_13761.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13762.c b/src/modules/module_13762.c index 0007b7cb2..b156d09e8 100644 --- a/src/modules/module_13762.c +++ b/src/modules/module_13762.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13763.c b/src/modules/module_13763.c index 2f33b9367..b6af41479 100644 --- a/src/modules/module_13763.c +++ b/src/modules/module_13763.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13771.c b/src/modules/module_13771.c index a4e23cc74..6da71375f 100644 --- a/src/modules/module_13771.c +++ b/src/modules/module_13771.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13772.c b/src/modules/module_13772.c index c40c85025..49569926d 100644 --- a/src/modules/module_13772.c +++ b/src/modules/module_13772.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_13773.c b/src/modules/module_13773.c index 3f500a1b4..8a4d6c5e5 100644 --- a/src/modules/module_13773.c +++ b/src/modules/module_13773.c @@ -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 -// FILE *fp = fopen (hashes->hashfile, "rb"); 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); #define VC_HEADER_SIZE 512 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); -// fclose (fp); hc_fclose (&fp_t); if (n != VC_HEADER_SIZE) return (PARSER_VC_FILE_SIZE); diff --git a/src/modules/module_14600.c b/src/modules/module_14600.c index e9e548f65..a06687b82 100644 --- a/src/modules/module_14600.c +++ b/src/modules/module_14600.c @@ -351,20 +351,16 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE if (line_len == 0) return (PARSER_HASH_LENGTH); -// FILE *fp = fopen ((const char *) line_buf, "rb"); 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); 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); if (nread != 1) { -// fclose (fp); hc_fclose (&fp_t); 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) { -// fclose (fp); hc_fclose (&fp_t); 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) { -// fclose (fp); hc_fclose (&fp_t); return (PARSER_LUKS_VERSION); @@ -417,7 +411,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE } else { -// fclose (fp); hc_fclose (&fp_t); return (PARSER_LUKS_CIPHER_TYPE); @@ -445,7 +438,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE } else { -// fclose (fp); hc_fclose (&fp_t); return (PARSER_LUKS_CIPHER_MODE); @@ -473,7 +465,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE } else { -// fclose (fp); hc_fclose (&fp_t); return (PARSER_LUKS_HASH_TYPE); @@ -495,7 +486,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE } else { -// fclose (fp); hc_fclose (&fp_t); 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) { -// fclose (fp); hc_fclose (&fp_t); 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) { -// fclose (fp); hc_fclose (&fp_t); 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 int rc_seek1 = fseeko (fp, keyMaterialOffset * 512, SEEK_SET); const int rc_seek1 = hc_fseek (&fp_t, keyMaterialOffset * 512, SEEK_SET); if (rc_seek1 == -1) { -// fclose (fp); hc_fclose (&fp_t); 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); if (nread2 != stripes) { -// fclose (fp); hc_fclose (&fp_t); 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 int rc_seek2 = fseeko (fp, payloadOffset * 512, SEEK_SET); const int rc_seek2 = hc_fseek (&fp_t, payloadOffset * 512, SEEK_SET); if (rc_seek2 == -1) { -// fclose (fp); hc_fclose (&fp_t); 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); if (nread3 != 128) { -// fclose (fp); hc_fclose (&fp_t); 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 -// fclose (fp); hc_fclose (&fp_t); return (PARSER_OK); diff --git a/src/mpsp.c b/src/mpsp.c index d999ec0f5..593d09454 100644 --- a/src/mpsp.c +++ b/src/mpsp.c @@ -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]; -// 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); if (!feof (fp)) @@ -722,7 +721,6 @@ static int sp_setup_tbl (hashcat_ctx_t *hashcat_ctx) 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); if (inlen != (SizeT) s.st_size) @@ -1480,7 +1478,6 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx) while (!feof (mask_fp)) { -// const size_t line_len = fgetl (mask_fp, line_buf); const size_t line_len = fgetl (&fp_t, line_buf); if (line_len == 0) continue; @@ -1579,7 +1576,6 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx) while (!feof (mask_fp)) { -// const size_t line_len = fgetl (mask_fp, line_buf); const size_t line_len = fgetl (&fp_t, line_buf); if (line_len == 0) continue; @@ -1659,7 +1655,6 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx) while (!feof (mask_fp)) { -// const size_t line_len = fgetl (mask_fp, line_buf); const size_t line_len = fgetl (&fp_t, line_buf); if (line_len == 0) continue; diff --git a/src/outfile.c b/src/outfile.c index b996657aa..f37ce8b22 100644 --- a/src/outfile.c +++ b/src/outfile.c @@ -529,8 +529,6 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int ou 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 (EOL, strlen (EOL), 1, outfile_ctx->fp); } diff --git a/src/outfile_check.c b/src/outfile_check.c index 057c867a9..b72b3f0cc 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -190,7 +190,6 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx) while (!feof (fp)) { -// size_t line_len = fgetl (fp, line_buf); size_t line_len = fgetl (&fp_t, line_buf); if (line_len == 0) continue; diff --git a/src/pidfile.c b/src/pidfile.c index 83c4bd972..393603fdc 100644 --- a/src/pidfile.c +++ b/src/pidfile.c @@ -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)); -// 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); fclose (fp); @@ -163,7 +162,6 @@ static int write_pidfile (hashcat_ctx_t *hashcat_ctx) return -1; } -// hc_fwrite (pd, sizeof (pidfile_data_t), 1, fp); hc_fwrite_direct (pd, sizeof (pidfile_data_t), 1, fp); fflush (fp); diff --git a/src/potfile.c b/src/potfile.c index 3c39d01ff..58f79dc63 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -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: 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: 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)) { -// size_t line_len = fgetl (potfile_ctx->fp, line_buf); size_t line_len = fgetl (&fp_t, line_buf); if (line_len == 0) continue; diff --git a/src/restore.c b/src/restore.c index 0e02c92a1..cdead5f7d 100644 --- a/src/restore.c +++ b/src/restore.c @@ -221,7 +221,6 @@ static int write_restore (hashcat_ctx_t *hashcat_ctx) return -1; } -// hc_fwrite (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++) diff --git a/src/rp.c b/src/rp.c index 87f69ced6..84ea62713 100644 --- a/src/rp.c +++ b/src/rp.c @@ -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]; -// FILE *fp = NULL; fp_tmp_t fp_t; u32 rule_line = 0; -// if ((fp = fopen (rp_file, "rb")) == NULL) if (hc_fopen (&fp_t, rp_file, "rb") == false) { 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; } -// while (!feof (fp)) while (!hc_feof (&fp_t)) { -// rule_len = (u32) fgetl (fp, rule_buf); rule_len = (u32) fgetl (&fp_t, rule_buf); rule_line++; @@ -797,7 +793,6 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32 kernel_rules_cnt++; } -// fclose (fp); hc_fclose (&fp_t); all_kernel_rules_cnt[i] = kernel_rules_cnt; diff --git a/src/shared.c b/src/shared.c index 4a3ba1863..92a0b1009 100644 --- a/src/shared.c +++ b/src/shared.c @@ -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); } -/* -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) { size_t rc = fwrite (ptr, size, nmemb, stream); 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) { diff --git a/src/slow_candidates.c b/src/slow_candidates.c index 6134cf5e2..709c6c5df 100644 --- a/src/slow_candidates.c +++ b/src/slow_candidates.c @@ -37,10 +37,8 @@ void slow_candidates_seek (hashcat_ctx_t *hashcat_ctx, void *extra_info, const u while (1) { -// FILE *fp = extra_info_straight->fp; 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); // 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; -// 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 *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) { -// get_next_word (hashcat_ctx, base_fp, &line_buf, &line_len); get_next_word (hashcat_ctx, base_fp_t, &line_buf, &line_len); // 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; -// rewind (combs_fp); 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) { -// line_len = (u32) fgetl (combs_fp, line_buf); line_len = (u32) fgetl (combs_fp_t, line_buf); // post-process rule engine @@ -183,10 +176,8 @@ void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info) while (1) { -// FILE *fp = extra_info_straight->fp; 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); 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; -// 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 *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) { -// get_next_word (hashcat_ctx, base_fp, &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); @@ -286,7 +274,6 @@ void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info) extra_info_combi->base_len = line_len; -// rewind (combs_fp); hc_rewind (combs_fp_t); } @@ -299,7 +286,6 @@ void slow_candidates_next (hashcat_ctx_t *hashcat_ctx, void *extra_info) while (1) { -// line_len = (u32) fgetl (combs_fp, line_buf); line_len = (u32) fgetl (combs_fp_t, line_buf); // post-process rule engine diff --git a/src/stdout.c b/src/stdout.c index 215278357..9778ac81c 100644 --- a/src/stdout.c +++ b/src/stdout.c @@ -18,7 +18,6 @@ static void out_flush (out_t *out) { if (out->len == 0) return; -// hc_fwrite (out->buf, 1, out->len, out->fp); hc_fwrite_direct (out->buf, 1, out->len, out->fp); out->len = 0; diff --git a/src/straight.c b/src/straight.c index a74281826..1e2f59556 100644 --- a/src/straight.c +++ b/src/straight.c @@ -70,10 +70,8 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx) logfile_sub_var_string ("rulefile", user_options->rp_files[i]); } -// FILE *fd = fopen (straight_ctx->dict, "rb"); fp_tmp_t fp_t; -// if (fd == NULL) if (hc_fopen (&fp_t, straight_ctx->dict, "rb") == false) { 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; } -// 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); -// fclose (fd); hc_fclose (&fp_t); 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) { -// FILE *fd = fopen (combinator_ctx->dict1, "rb"); fp_tmp_t fp_t; -// if (fd == NULL) if (hc_fopen (&fp_t, combinator_ctx->dict1, "rb") == false) { 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; } -// 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); -// fclose (fd); hc_fclose (&fp_t); 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) { -// FILE *fd = fopen (combinator_ctx->dict2, "rb"); fp_tmp_t fp_t; -// if (fd == NULL) if (hc_fopen (&fp_t, combinator_ctx->dict2, "rb") == false) { 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; } -// 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); -// fclose (fd); hc_fclose (&fp_t); 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 (mask_ctx->mask); -// FILE *fd = fopen (straight_ctx->dict, "rb"); fp_tmp_t fp_t; -// if (fd == NULL) if (hc_fopen (&fp_t, straight_ctx->dict, "rb") == false) { 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; } -// 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); -// fclose (fd); hc_fclose (&fp_t); if (rc == -1) diff --git a/src/terminal.c b/src/terminal.c index 469a23129..eadd5e02d 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -977,7 +977,6 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx) printf ("%d\t", util); } -// hc_fwrite (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, 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 (" \"estimated_stop\": %" PRIu64 " }", (u64) end); -// hc_fwrite (EOL, strlen (EOL), 1, stdout); hc_fwrite_direct (EOL, strlen (EOL), 1, stdout); fflush (stdout); diff --git a/src/tuningdb.c b/src/tuningdb.c index f6fc7162f..126b10de6 100644 --- a/src/tuningdb.c +++ b/src/tuningdb.c @@ -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); -// FILE *fp = fopen (tuning_db_file, "rb"); fp_tmp_t fp_t; -// if (fp == NULL) if (hc_fopen (&fp_t, tuning_db_file, "rb") == false) { 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); -// const size_t num_lines = count_lines (fp); const size_t num_lines = count_lines (&fp_t); // 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_cnt = 0; -// rewind (fp); hc_rewind (&fp_t); int line_num = 0; char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE); -// while (!feof (fp)) 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); if (line_buf == NULL) break; @@ -276,7 +270,6 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx) hcfree (buf); -// fclose (fp); hc_fclose (&fp_t); // todo: print loaded 'cnt' message diff --git a/src/usage.c b/src/usage.c index e421f7a53..614df3da8 100644 --- a/src/usage.c +++ b/src/usage.c @@ -269,7 +269,6 @@ void usage_mini_print (const char *progname) { printf (USAGE_MINI[i], progname); -// hc_fwrite (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]); -// hc_fwrite (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)); -// hc_fwrite (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); 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]); -// hc_fwrite (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); } diff --git a/src/wordlist.c b/src/wordlist.c index 80e1a37a0..fdb5f1db2 100644 --- a/src/wordlist.c +++ b/src/wordlist.c @@ -47,7 +47,6 @@ size_t convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const size_ 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) { 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->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->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; -// while (!feof (fd)) while (!hc_feof (fp_t)) { 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; } -// const int c = fgetc (fd); const int c = hc_fgetc (fp_t); if (c == EOF) break; @@ -174,7 +170,6 @@ void get_next_word_std (char *buf, u64 sz, u64 *len, u64 *off) *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) { 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; } -// if (feof (fd)) if (hc_feof (fp_t)) { 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; } -// load_segment (hashcat_ctx, fd); 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); } @@ -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) { 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; -// if (fstat (fileno (fd), &d.stat)) if (fstat (hc_fileno (fp_t), &d.stat)) { *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 cnt2 = 0; -// while (!feof (fd)) while (!hc_feof (fp_t)) { -// load_segment (hashcat_ctx, fd); load_segment (hashcat_ctx, fp_t); comp += wl_data->cnt;