No more compress functions, update example.dict.gz, remove some comments

pull/2075/head
Gabriele Gristina 5 years ago
parent 398c89c75c
commit 481c752456

Binary file not shown.

@ -63,8 +63,6 @@ void hc_string_trim_trailing (char *s);
void hc_string_trim_leading (char *s);
bool hc_fopen (HCFILE *fp, const char *path, char *mode);
size_t hc_fread (void *ptr, size_t size, size_t nmemb, FILE *stream);
void hc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
int hc_fscanf (HCFILE *fp, const char *format, void *ptr);
int hc_fprintf (HCFILE *fp, const char *format, ...);
int hc_vfprintf (HCFILE *fp, const char *format, va_list ap);
@ -72,14 +70,14 @@ int hc_fseek (HCFILE *fp, off_t offset, int whence);
void hc_rewind (HCFILE *fp);
off_t hc_ftell (HCFILE *fp);
int hc_fgetc (HCFILE *fp);
int hc_fputc (int c, HCFILE *fp);
char *hc_fgets (char *buf, int len, HCFILE *fp);
int hc_fileno (HCFILE *fp);
int hc_feof (HCFILE *fp);
void hc_fflush (HCFILE *fp);
void hc_fclose (HCFILE *fp);
size_t hc_fwrite_compress (void *ptr, size_t size, size_t nmemb, HCFILE *fp);
size_t hc_fread_compress (void *ptr, size_t size, size_t nmemb, HCFILE *fp);
int hc_fputc (int c, HCFILE *fp);
char *hc_fgets (char *buf, int len, HCFILE *fp);
size_t hc_fwrite (void *ptr, size_t size, size_t nmemb, HCFILE *fp);
size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp);
bool hc_same_files (char *file1, char *file2);

@ -468,8 +468,7 @@ 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_compress (buf, sizeof (char), st.st_size, &fp);
size_t num_read = hc_fread (buf, sizeof (char), st.st_size, &fp);
// fclose (fp);
hc_fclose (&fp);
@ -541,8 +540,7 @@ 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_compress (binary, sizeof (char), binary_size, &fp);
hc_fwrite (binary, sizeof (char), binary_size, &fp);
// fflush (fp);
hc_fflush (&fp);

@ -548,7 +548,7 @@ u64 brain_compute_attack_wordlist (const char *filename)
while (!hc_feof (&fp))
{
// const size_t nread = fread (buf, 1, FBUFSZ, fd);
const size_t nread = hc_fread_compress (buf, 1, FBUFSZ, &fp);
const size_t nread = hc_fread (buf, 1, FBUFSZ, &fp);
XXH64_update (state, buf, nread);
}
@ -627,7 +627,7 @@ u32 brain_auth_challenge (void)
}
// if (fread (&val, sizeof (val), 1, fd) != 1)
if (hc_fread_compress (&val, sizeof (val), 1, &fp) != 1)
if (hc_fread (&val, sizeof (val), 1, &fp) != 1)
{
brain_logging (stderr, 0, "%s: %s\n", urandom, strerror (errno));
@ -1631,7 +1631,7 @@ bool brain_server_read_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
}
// const size_t nread = fread (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), temp_cnt, fd);
const size_t nread = hc_fread_compress (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), temp_cnt, &fp);
const size_t nread = hc_fread (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), temp_cnt, &fp);
if (nread != (size_t) temp_cnt)
{
@ -1684,7 +1684,7 @@ bool brain_server_write_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
fp.is_gzip = 0;
// const size_t nwrite = fwrite (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), brain_server_db_hash->long_cnt, fd);
const size_t nwrite = hc_fwrite_compress (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), brain_server_db_hash->long_cnt, &fp);
const size_t nwrite = hc_fwrite (brain_server_db_hash->long_buf, sizeof (brain_server_hash_long_t), brain_server_db_hash->long_cnt, &fp);
if (nwrite != (size_t) brain_server_db_hash->long_cnt)
{
@ -1844,7 +1844,7 @@ bool brain_server_read_attack_dump (brain_server_db_attack_t *brain_server_db_at
}
// const size_t nread = fread (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), temp_cnt, fd);
const size_t nread = hc_fread_compress (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), temp_cnt, &fp);
const size_t nread = hc_fread (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), temp_cnt, &fp);
if (nread != (size_t) temp_cnt)
{
@ -1899,7 +1899,7 @@ bool brain_server_write_attack_dump (brain_server_db_attack_t *brain_server_db_a
// storing should not include reserved attacks only finished
// const size_t nwrite = fwrite (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), brain_server_db_attack->long_cnt, fd);
const size_t nwrite = hc_fwrite_compress (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), brain_server_db_attack->long_cnt, &fp);
const size_t nwrite = hc_fwrite (brain_server_db_attack->long_buf, sizeof (brain_server_attack_long_t), brain_server_db_attack->long_cnt, &fp);
if (nwrite != (size_t) brain_server_db_attack->long_cnt)
{

@ -101,8 +101,7 @@ 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_compress (buf, sizeof (u8), MAX_KEY_SIZE, &fp);
size_t nread = hc_fread (buf, sizeof (u8), MAX_KEY_SIZE, &fp);
// fclose (fd);
hc_fclose (&fp);

@ -51,8 +51,7 @@ 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_compress ((void *)plain_ptr, plain_len, 1, debugfile_ctx->fp);
hc_fwrite ((void *)plain_ptr, plain_len, 1, debugfile_ctx->fp);
}
}
@ -72,8 +71,7 @@ void debugfile_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *rule_buf, con
if ((debug_mode == 3) || (debug_mode == 4)) hc_fputc (':', debugfile_ctx->fp);
}
// hc_fwrite (rule_buf, rule_len, 1, debugfile_ctx->fp);
hc_fwrite_compress ((void *)rule_buf, rule_len, 1, debugfile_ctx->fp);
hc_fwrite ((void *)rule_buf, rule_len, 1, debugfile_ctx->fp);
if (debug_mode == 4)
{
@ -83,8 +81,7 @@ 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_compress (EOL, strlen (EOL), 1, debugfile_ctx->fp);
hc_fwrite (EOL, strlen (EOL), 1, debugfile_ctx->fp);
}
int debugfile_init (hashcat_ctx_t *hashcat_ctx)

@ -112,10 +112,8 @@ 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 nread1 = hc_fread_compress (&v, sizeof (u64), 1, &fp);
// const size_t nread2 = hc_fread (&z, sizeof (u64), 1, fp);
const size_t nread2 = hc_fread_compress (&z, sizeof (u64), 1, &fp);
const size_t nread1 = hc_fread (&v, sizeof (u64), 1, &fp);
const size_t nread2 = hc_fread (&z, sizeof (u64), 1, &fp);
if ((nread1 != 1) || (nread2 != 1))
{
@ -167,8 +165,7 @@ 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_compress (&d, sizeof (dictstat_t), 1, &fp);
const size_t nread = hc_fread (&d, sizeof (dictstat_t), 1, &fp);
if (nread == 0) continue;
@ -227,15 +224,12 @@ 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_compress (&v, sizeof (u64), 1, &fp);
// hc_fwrite (&z, sizeof (u64), 1, fp);
hc_fwrite_compress (&z, sizeof (u64), 1, &fp);
hc_fwrite (&v, sizeof (u64), 1, &fp);
hc_fwrite (&z, sizeof (u64), 1, &fp);
// data
// hc_fwrite (dictstat_ctx->base, sizeof (dictstat_t), dictstat_ctx->cnt, fp);
hc_fwrite_compress (dictstat_ctx->base, sizeof (dictstat_t), dictstat_ctx->cnt, &fp);
hc_fwrite (dictstat_ctx->base, sizeof (dictstat_t), dictstat_ctx->cnt, &fp);
// fclose (fp);
hc_fclose (&fp);

@ -19,7 +19,7 @@ u64 count_lines (HCFILE *fp)
while (!hc_feof (fp))
{
size_t nread = hc_fread_compress (buf, sizeof (char), HCBUFSIZ_LARGE, fp);
size_t nread = hc_fread (buf, sizeof (char), HCBUFSIZ_LARGE, fp);
if (nread < 1) continue;

@ -234,8 +234,7 @@ 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_compress (binary_buf, binary_len, 1, &fp);
hc_fwrite (binary_buf, binary_len, 1, &fp);
hcfree (binary_buf);
}

@ -506,8 +506,7 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx)
nvml_winpath = (char *) hcmalloc (100);
// hc_fread (nvml_winpath, 100, 1, nvml_lib);
hc_fread_compress (nvml_winpath, 100, 1, &nvml_lib);
hc_fread (nvml_winpath, 100, 1, &nvml_lib);
// fclose (nvml_lib);
hc_fclose (&nvml_lib);

@ -68,8 +68,7 @@ void logfile_append (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
va_end (ap);
// hc_fwrite (EOL, strlen (EOL), 1, fp);
hc_fwrite_compress (EOL, strlen (EOL), 1, &fp);
hc_fwrite (EOL, strlen (EOL), 1, &fp);
// fflush (fp);
hc_fflush (&fp);

@ -52,8 +52,7 @@ 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_compress ((void *)plain_ptr, plain_len, 1, loopback_ctx->fp);
hc_fwrite ((void *)plain_ptr, plain_len, 1, loopback_ctx->fp);
}
}
@ -172,8 +171,7 @@ void loopback_write_append (hashcat_ctx_t *hashcat_ctx, const u8 *plain_ptr, con
// lock_file (fp);
lock_file (fp->f.fp);
// hc_fwrite (EOL, strlen (EOL), 1, fp);
hc_fwrite_compress (EOL, strlen (EOL), 1, fp);
hc_fwrite (EOL, strlen (EOL), 1, fp);
// fflush (fp);
hc_fflush (fp);

@ -108,16 +108,15 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, HCFILE *fp, const int loglevel
switch (loglevel)
{
case LOGLEVEL_INFO: break;
case LOGLEVEL_WARNING: hc_fwrite_compress ("\033[33m", 5, 1, fp); break;
case LOGLEVEL_ERROR: hc_fwrite_compress ("\033[31m", 5, 1, fp); break;
case LOGLEVEL_ADVICE: hc_fwrite_compress ("\033[33m", 5, 1, fp); 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;
}
#endif
// finally, print
// hc_fwrite (msg_buf, msg_len, 1, fp);
hc_fwrite_compress ((void *)msg_buf, msg_len, 1, fp);
hc_fwrite ((void *)msg_buf, msg_len, 1, fp);
// color stuff post
@ -133,9 +132,9 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, HCFILE *fp, const int loglevel
switch (loglevel)
{
case LOGLEVEL_INFO: break;
case LOGLEVEL_WARNING: hc_fwrite_compress ("\033[0m", 4, 1, fp); break;
case LOGLEVEL_ERROR: hc_fwrite_compress ("\033[0m", 4, 1, fp); break;
case LOGLEVEL_ADVICE: hc_fwrite_compress ("\033[0m", 4, 1, fp); 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;
}
#endif
@ -143,15 +142,13 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, HCFILE *fp, const int loglevel
if (msg_newline == true)
{
// hc_fwrite (EOL, strlen (EOL), 1, fp);
hc_fwrite_compress (EOL, strlen (EOL), 1, fp);
hc_fwrite (EOL, strlen (EOL), 1, fp);
// on error, add another newline
if (loglevel == LOGLEVEL_ERROR)
{
// hc_fwrite (EOL, strlen (EOL), 1, fp);
hc_fwrite_compress (EOL, strlen (EOL), 1, fp);
hc_fwrite (EOL, strlen (EOL), 1, fp);
}
}
@ -371,8 +368,8 @@ 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);
fwrite (buf, len, 1, stdout);
fwrite (EOL, strlen (EOL), 1, stdout);
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
{
@ -417,8 +414,8 @@ 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);
fwrite (buf, len, 1, stdout);
fwrite (EOL, strlen (EOL), 1, stdout);
}
static void main_potfile_hash_left (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
@ -427,8 +424,8 @@ 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);
fwrite (buf, len, 1, stdout);
fwrite (EOL, strlen (EOL), 1, stdout);
}
static void main_potfile_num_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)

@ -192,7 +192,7 @@ static int check_old_hccap (const char *hashfile)
u32 signature;
const size_t nread = hc_fread_compress (&signature, sizeof (u32), 1, fp);
const size_t nread = hc_fread (&signature, sizeof (u32), 1, fp);
fclose (fp);
@ -382,7 +382,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
while (!hc_feof (&fp))
{
const size_t nread = hc_fread_compress (in, sizeof (hccapx_t), 1, &fp);
const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, &fp);
if (nread == 0) break;

@ -189,7 +189,7 @@ static int check_old_hccap (const char *hashfile)
u32 signature;
const size_t nread = hc_fread_compress (&signature, sizeof (u32), 1, fp);
const size_t nread = hc_fread (&signature, sizeof (u32), 1, fp);
fclose (fp);
@ -357,7 +357,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
while (!hc_feof (&fp))
{
const size_t nread = hc_fread_compress (in, sizeof (hccapx_t), 1, &fp);
const size_t nread = hc_fread (in, sizeof (hccapx_t), 1, &fp);
if (nread == 0) break;

@ -101,7 +101,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
memset (&in, 0, sizeof (psafe3_t));
const size_t n = hc_fread_compress (&in, sizeof (psafe3_t), 1, &fp);
const size_t n = hc_fread (&in, sizeof (psafe3_t), 1, &fp);
hc_fclose (&fp);

@ -154,7 +154,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -154,7 +154,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -152,7 +152,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -152,7 +152,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -152,7 +152,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -152,7 +152,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -154,7 +154,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -154,7 +154,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -154,7 +154,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -166,7 +166,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -166,7 +166,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -166,7 +166,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (TC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, TC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, TC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -164,7 +164,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
memset (&buf, 0, sizeof (psafe2_hdr));
const size_t n = hc_fread_compress (&buf, sizeof (psafe2_hdr), 1, &fp);
const size_t n = hc_fread (&buf, sizeof (psafe2_hdr), 1, &fp);
hc_fclose (&fp);

@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -178,7 +178,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -178,7 +178,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -178,7 +178,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -181,7 +181,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -181,7 +181,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -181,7 +181,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -180,7 +180,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -181,7 +181,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -181,7 +181,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -181,7 +181,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -184,7 +184,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -184,7 +184,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -184,7 +184,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
char *in = (char *) hcmalloc (VC_HEADER_SIZE);
const size_t n = hc_fread_compress (in, 1, VC_HEADER_SIZE, &fp);
const size_t n = hc_fread (in, 1, VC_HEADER_SIZE, &fp);
hc_fclose (&fp);

@ -357,7 +357,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
struct luks_phdr hdr;
const size_t nread = hc_fread_compress (&hdr, sizeof (hdr), 1, &fp);
const size_t nread = hc_fread (&hdr, sizeof (hdr), 1, &fp);
if (nread != 1)
{
@ -542,7 +542,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
return (PARSER_LUKS_FILE_SIZE);
}
const size_t nread2 = hc_fread_compress (luks->af_src_buf, keyBytes, stripes, &fp);
const size_t nread2 = hc_fread (luks->af_src_buf, keyBytes, stripes, &fp);
if (nread2 != stripes)
{
@ -564,7 +564,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
return (PARSER_LUKS_FILE_SIZE);
}
const size_t nread3 = hc_fread_compress (luks->ct_buf, sizeof (u32), 128, &fp);
const size_t nread3 = hc_fread (luks->ct_buf, sizeof (u32), 128, &fp);
if (nread3 != 128)
{

@ -596,8 +596,7 @@ 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_compress (mp_file, 1, sizeof (mp_file) - 1, &fp);
const size_t nread = hc_fread (mp_file, 1, sizeof (mp_file) - 1, &fp);
// if (!feof (fp))
if (!hc_feof (&fp))
@ -729,8 +728,7 @@ 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_compress (inbuf, 1, s.st_size, &fp);
SizeT inlen = (SizeT) hc_fread (inbuf, 1, s.st_size, &fp);
if (inlen != (SizeT) s.st_size)
{

@ -537,10 +537,8 @@ 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_compress (tmp_buf, tmp_len, 1, outfile_ctx->fp);
// hc_fwrite (EOL, strlen (EOL), 1, outfile_ctx->fp);
hc_fwrite_compress (EOL, strlen (EOL), 1, outfile_ctx->fp);
hc_fwrite (tmp_buf, tmp_len, 1, outfile_ctx->fp);
hc_fwrite (EOL, strlen (EOL), 1, outfile_ctx->fp);
}
return tmp_len;

@ -24,8 +24,7 @@ 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_compress (pd, sizeof (pidfile_data_t), 1, &fp);
const size_t nread = hc_fread (pd, sizeof (pidfile_data_t), 1, &fp);
// fclose (fp);
hc_fclose (&fp);
@ -170,8 +169,7 @@ static int write_pidfile (hashcat_ctx_t *hashcat_ctx)
fp.is_gzip = 0;
// hc_fwrite (pd, sizeof (pidfile_data_t), 1, fp);
hc_fwrite_compress (pd, sizeof (pidfile_data_t), 1, &fp);
hc_fwrite (pd, sizeof (pidfile_data_t), 1, &fp);
// fflush (fp);
hc_fflush (&fp);

@ -205,7 +205,6 @@ void potfile_read_close (hashcat_ctx_t *hashcat_ctx)
if (potfile_ctx->fp == NULL) return;
fclose (potfile_ctx->fp);
// hc_fclose (potfile_ctx->fp);
}
int potfile_write_open (hashcat_ctx_t *hashcat_ctx)
@ -215,10 +214,8 @@ int potfile_write_open (hashcat_ctx_t *hashcat_ctx)
if (potfile_ctx->enabled == false) return 0;
FILE *fp = fopen (potfile_ctx->filename, "ab");
/// HCFILE *fp = (HCFILE *) hcmalloc (sizeof(HCFILE));
if (fp == NULL)
// if (hc_fopen (fp, potfile_ctx->filename, "ab") == false)
{
event_log_error (hashcat_ctx, "%s: %s", potfile_ctx->filename, strerror (errno));
@ -243,7 +240,6 @@ void potfile_write_close (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->potfile_disable == true) return;
fclose (potfile_ctx->fp);
// hc_fclose (potfile_ctx->fp);
}
void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const int out_len, u8 *plain_ptr, unsigned int plain_len)
@ -300,16 +296,12 @@ void potfile_write_append (hashcat_ctx_t *hashcat_ctx, const char *out_buf, cons
tmp_buf[tmp_len] = 0;
lock_file (potfile_ctx->fp);
// lock_file (potfile_ctx->fp->f.fp);
fprintf (potfile_ctx->fp, "%s" EOL, tmp_buf);
// hc_fprintf (potfile_ctx->fp, "%s" EOL, tmp_buf);
fflush (potfile_ctx->fp);
// hc_fflush (potfile_ctx->fp);
if (unlock_file (potfile_ctx->fp))
// if (unlock_file (potfile_ctx->fp->f.fp))
{
event_log_error (hashcat_ctx, "%s: Failed to unlock file.", potfile_ctx->filename);
}
@ -542,7 +534,6 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
fp.f.fp = potfile_ctx->fp;
while (!feof (potfile_ctx->fp))
// while (!hc_feof (potfile_ctx->fp))
{
size_t line_len = fgetl (&fp, line_buf);

@ -68,7 +68,7 @@ static int read_restore (hashcat_ctx_t *hashcat_ctx)
restore_data_t *rd = restore_ctx->rd;
// if (fread (rd, sizeof (restore_data_t), 1, fp) != 1)
if (hc_fread_compress (rd, sizeof (restore_data_t), 1, &fp) != 1)
if (hc_fread (rd, sizeof (restore_data_t), 1, &fp) != 1)
{
event_log_error (hashcat_ctx, "Cannot read %s", eff_restore_file);
@ -236,8 +236,7 @@ static int write_restore (hashcat_ctx_t *hashcat_ctx)
return -1;
}
// hc_fwrite (rd, sizeof (restore_data_t), 1, fp);
hc_fwrite_compress (rd, sizeof (restore_data_t), 1, &fp);
hc_fwrite (rd, sizeof (restore_data_t), 1, &fp);
for (u32 i = 0; i < rd->argc; i++)
{

@ -356,7 +356,7 @@ bool hc_path_has_bom (const char *path)
if (hc_fopen (&fp, path, "rb") == false) return false;
// const size_t nread = fread (buf, 1, sizeof (buf), fp);
const size_t nread = hc_fread_compress (buf, 1, sizeof (buf), &fp);
const size_t nread = hc_fread (buf, 1, sizeof (buf), &fp);
// fclose (fp);
hc_fclose (&fp);
@ -643,7 +643,7 @@ bool hc_fopen (HCFILE *fp, const char *path, char *mode)
return true;
}
size_t hc_fread_compress (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
{
size_t n = 0;
@ -657,7 +657,7 @@ size_t hc_fread_compress (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
return n;
}
size_t hc_fwrite_compress (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
size_t hc_fwrite (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
{
size_t n = 0;
@ -673,18 +673,6 @@ size_t hc_fwrite_compress (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
return n;
}
size_t hc_fread (void *ptr, size_t size, size_t nmemb, FILE *stream)
{
return fread (ptr, size, nmemb, stream);
}
void hc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t rc = fwrite (ptr, size, nmemb, stream);
if (rc == 0) rc = 0;
}
int hc_fseek (HCFILE *fp, off_t offset, int whence)
{
int r = 0;

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

@ -977,7 +977,7 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
printf ("%d\t", util);
}
hc_fwrite (EOL, strlen (EOL), 1, stdout);
fwrite (EOL, strlen (EOL), 1, stdout);
fflush (stdout);
@ -1064,7 +1064,7 @@ 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);
fwrite (EOL, strlen (EOL), 1, stdout);
fflush (stdout);

@ -269,7 +269,7 @@ void usage_mini_print (const char *progname)
{
printf (USAGE_MINI[i], progname);
hc_fwrite (EOL, strlen (EOL), 1, stdout);
fwrite (EOL, strlen (EOL), 1, stdout);
}
}
@ -315,19 +315,19 @@ void usage_big_print (hashcat_ctx_t *hashcat_ctx)
{
printf ("%s", USAGE_BIG_PRE_HASHMODES[i]);
hc_fwrite (EOL, strlen (EOL), 1, stdout);
fwrite (EOL, strlen (EOL), 1, stdout);
}
//hc_fwrite_compress (EOL, strlen (EOL), 1, stdout);
//hc_fwrite (EOL, strlen (EOL), 1, stdout);
for (int i = 0; i < usage_sort_cnt; i++)
{
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);
fwrite (EOL, strlen (EOL), 1, stdout);
}
hc_fwrite (EOL, strlen (EOL), 1, stdout);
fwrite (EOL, strlen (EOL), 1, stdout);
for (int i = 0; i < usage_sort_cnt; i++)
{
@ -340,8 +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);
fwrite (EOL, strlen (EOL), 1, stdout);
}
hc_fwrite (EOL, strlen (EOL), 1, stdout);
fwrite (EOL, strlen (EOL), 1, stdout);
}

@ -55,7 +55,7 @@ int load_segment (hashcat_ctx_t *hashcat_ctx, HCFILE *fp)
wl_data->pos = 0;
wl_data->cnt = hc_fread_compress (wl_data->buf, 1, wl_data->incr - 1000, fp);
wl_data->cnt = hc_fread (wl_data->buf, 1, wl_data->incr - 1000, fp);
wl_data->buf[wl_data->cnt] = 0;

Loading…
Cancel
Save