mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-03 12:21:07 +00:00
fix the comments :)
This commit is contained in:
parent
5679ca3344
commit
3161aec3da
@ -66,7 +66,7 @@ void hc_string_trim_leading (char *s);
|
||||
int _wopen(const char *path, int oflag, ...);
|
||||
#endif
|
||||
|
||||
bool hc_fopen (HCFILE *fp, const char *path, char *mode, int file_format);
|
||||
bool hc_fopen (HCFILE *fp, const char *path, char *mode);
|
||||
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);
|
||||
|
@ -1002,13 +1002,6 @@ typedef struct hc_fp
|
||||
const char *path;
|
||||
} HCFILE;
|
||||
|
||||
typedef enum hcfile_format
|
||||
{
|
||||
HCFILE_FORMAT_PLAIN = 0,
|
||||
HCFILE_FORMAT_GZIP = 1,
|
||||
|
||||
} hcfile_format_t;
|
||||
|
||||
#include "ext_nvrtc.h"
|
||||
#include "ext_cuda.h"
|
||||
#include "ext_OpenCL.h"
|
||||
|
@ -441,9 +441,8 @@ static bool opencl_test_instruction (hashcat_ctx_t *hashcat_ctx, cl_context cont
|
||||
static bool read_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_file, size_t *kernel_lengths, char **kernel_sources, const bool force_recompile)
|
||||
{
|
||||
HCFILE fp;
|
||||
bool is_gzip = false;
|
||||
|
||||
if (hc_fopen (&fp, kernel_file, "rb", false) != false)
|
||||
if (hc_fopen (&fp, kernel_file, "rb") != false)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
@ -454,22 +453,16 @@ static bool read_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_f
|
||||
return false;
|
||||
}
|
||||
|
||||
is_gzip = fp.is_gzip;
|
||||
|
||||
#define EXTRASZ 100
|
||||
|
||||
size_t klen = st.st_size;
|
||||
|
||||
if (is_gzip) klen *= 10; // must be >= of uncompress len
|
||||
|
||||
char *buf = (char *) hcmalloc (klen + 1 + EXTRASZ);
|
||||
|
||||
size_t num_read = hc_fread (buf, sizeof (char), klen, &fp);
|
||||
|
||||
hc_fclose (&fp);
|
||||
|
||||
if (is_gzip && klen > num_read) klen = num_read;
|
||||
|
||||
if (num_read != (size_t) klen)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", kernel_file, strerror (errno));
|
||||
@ -514,8 +507,7 @@ static bool write_kernel_binary (hashcat_ctx_t *hashcat_ctx, char *kernel_file,
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
// change HCFILE_FORMAT_GZIP to HCFILE_FORMAT_PLAIN to write kernel binary uncompressed
|
||||
if (hc_fopen (&fp, kernel_file, "wb", HCFILE_FORMAT_GZIP) == false)
|
||||
if (hc_fopen (&fp, kernel_file, "wb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", kernel_file, strerror (errno));
|
||||
|
||||
|
12
src/brain.c
12
src/brain.c
@ -541,7 +541,7 @@ u64 brain_compute_attack_wordlist (const char *filename)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
hc_fopen (&fp, filename, "rb", false);
|
||||
hc_fopen (&fp, filename, "rb");
|
||||
|
||||
while (!hc_feof (&fp))
|
||||
{
|
||||
@ -613,7 +613,7 @@ u32 brain_auth_challenge (void)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, urandom, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, urandom, "rb") == false)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: %s\n", urandom, strerror (errno));
|
||||
|
||||
@ -1599,7 +1599,7 @@ bool brain_server_read_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, file, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, file, "rb") == false)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: %s\n", file, strerror (errno));
|
||||
|
||||
@ -1655,7 +1655,7 @@ bool brain_server_write_hash_dump (brain_server_db_hash_t *brain_server_db_hash,
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, file, "wb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, file, "wb") == false)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: %s\n", file, strerror (errno));
|
||||
|
||||
@ -1798,7 +1798,7 @@ bool brain_server_read_attack_dump (brain_server_db_attack_t *brain_server_db_at
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, file, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, file, "rb") == false)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: %s\n", file, strerror (errno));
|
||||
|
||||
@ -1854,7 +1854,7 @@ bool brain_server_write_attack_dump (brain_server_db_attack_t *brain_server_db_a
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, file, "wb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, file, "wb") == false)
|
||||
{
|
||||
brain_logging (stderr, 0, "%s: %s\n", file, strerror (errno));
|
||||
|
||||
|
@ -63,14 +63,14 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
HCFILE fp1;
|
||||
HCFILE fp2;
|
||||
|
||||
if (hc_fopen (&fp1, dictfile1, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp1, dictfile1, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hc_fopen (&fp2, dictfile2, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp2, dictfile2, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
|
||||
|
||||
@ -166,14 +166,14 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
HCFILE fp1;
|
||||
HCFILE fp2;
|
||||
|
||||
if (hc_fopen (&fp1, dictfile1, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp1, dictfile1, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hc_fopen (&fp2, dictfile2, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp2, dictfile2, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
|
||||
|
||||
@ -297,14 +297,14 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
HCFILE fp1;
|
||||
HCFILE fp2;
|
||||
|
||||
if (hc_fopen (&fp1, dictfile1, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp1, dictfile1, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile1, strerror (errno));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (hc_fopen (&fp2, dictfile2, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp2, dictfile2, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile2, strerror (errno));
|
||||
|
||||
@ -389,7 +389,7 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, dictfile, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, dictfile, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
|
||||
|
||||
|
@ -94,7 +94,7 @@ int cpu_crc32 (const char *filename, u8 keytab[64])
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
hc_fopen (&fp, filename, "rb", HCFILE_FORMAT_PLAIN);
|
||||
hc_fopen (&fp, filename, "rb");
|
||||
|
||||
#define MAX_KEY_SIZE (1024 * 1024)
|
||||
|
||||
|
@ -109,7 +109,7 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (debugfile_ctx->filename)
|
||||
{
|
||||
if (hc_fopen (&fp, debugfile_ctx->filename, "ab", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, debugfile_ctx->filename, "ab") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Could not open --debug-file file for writing.");
|
||||
|
||||
|
@ -98,7 +98,7 @@ void dictstat_read (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, dictstat_ctx->filename, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, dictstat_ctx->filename, "rb") == false)
|
||||
{
|
||||
// first run, file does not exist, do not error out
|
||||
|
||||
@ -186,7 +186,7 @@ int dictstat_write (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, dictstat_ctx->filename, "wb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, dictstat_ctx->filename, "wb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictstat_ctx->filename, strerror (errno));
|
||||
|
||||
|
@ -429,7 +429,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, dictfile, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, dictfile, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
|
||||
|
||||
@ -749,7 +749,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
HCFILE base_fp;
|
||||
|
||||
if (hc_fopen (&base_fp, base_file, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&base_fp, base_file, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", base_file, strerror (errno));
|
||||
|
||||
@ -758,7 +758,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
HCFILE combs_fp;
|
||||
|
||||
if (hc_fopen (&combs_fp, combs_file, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&combs_fp, combs_file, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", combs_file, strerror (errno));
|
||||
|
||||
@ -1324,7 +1324,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
HCFILE combs_fp;
|
||||
|
||||
if (hc_fopen (&combs_fp, dictfile, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&combs_fp, dictfile, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
|
||||
|
||||
@ -1390,7 +1390,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
HCFILE combs_fp;
|
||||
|
||||
if (hc_fopen (&combs_fp, dictfilec, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&combs_fp, dictfilec, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", combinator_ctx->dict2, strerror (errno));
|
||||
|
||||
@ -1405,7 +1405,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
HCFILE combs_fp;
|
||||
|
||||
if (hc_fopen (&combs_fp, dictfilec, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&combs_fp, dictfilec, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfilec, strerror (errno));
|
||||
|
||||
@ -1418,7 +1418,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, dictfile, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, dictfile, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", dictfile, strerror (errno));
|
||||
|
||||
|
@ -186,7 +186,7 @@ int save_hash (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, new_hashfile, "wb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, new_hashfile, "wb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", new_hashfile, strerror (errno));
|
||||
|
||||
@ -676,7 +676,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashfile, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, hashfile, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", hashfile, strerror (errno));
|
||||
|
||||
@ -996,7 +996,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashfile, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, hashfile, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", hashfile, strerror (errno));
|
||||
|
||||
@ -1792,7 +1792,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
hc_fopen (&fp, tmpfile_bin, "wb", false);
|
||||
hc_fopen (&fp, tmpfile_bin, "wb");
|
||||
|
||||
const size_t st_hash_len = strlen (hashconfig->st_hash);
|
||||
|
||||
|
14
src/hwmon.c
14
src/hwmon.c
@ -112,7 +112,7 @@ static int hm_SYSFS_get_fan_speed_current (hashcat_ctx_t *hashcat_ctx, const int
|
||||
|
||||
HCFILE fp_cur;
|
||||
|
||||
if (hc_fopen (&fp_cur, path_cur, "r", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp_cur, path_cur, "r") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", path_cur, strerror (errno));
|
||||
|
||||
@ -140,7 +140,7 @@ static int hm_SYSFS_get_fan_speed_current (hashcat_ctx_t *hashcat_ctx, const int
|
||||
|
||||
HCFILE fp_max;
|
||||
|
||||
if (hc_fopen (&fp_max, path_max, "r", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp_max, path_max, "r") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", path_max, strerror (errno));
|
||||
|
||||
@ -202,7 +202,7 @@ static int hm_SYSFS_get_temperature_current (hashcat_ctx_t *hashcat_ctx, const i
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, path, "r", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, path, "r") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
|
||||
|
||||
@ -247,7 +247,7 @@ static int hm_SYSFS_get_pp_dpm_sclk (hashcat_ctx_t *hashcat_ctx, const int backe
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, path, "r", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, path, "r") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
|
||||
|
||||
@ -302,7 +302,7 @@ static int hm_SYSFS_get_pp_dpm_mclk (hashcat_ctx_t *hashcat_ctx, const int backe
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, path, "r", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, path, "r") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
|
||||
|
||||
@ -357,7 +357,7 @@ static int hm_SYSFS_get_pp_dpm_pcie (hashcat_ctx_t *hashcat_ctx, const int backe
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, path, "r", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, path, "r") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", path, strerror (errno));
|
||||
|
||||
@ -462,7 +462,7 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
HCFILE nvml_lib;
|
||||
|
||||
if (hc_fopen (&nvml_lib, "/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/NVIDIA Corporation/Global/NVSMI/NVSMIPATH", "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&nvml_lib, "/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/NVIDIA Corporation/Global/NVSMI/NVSMIPATH", "rb") == false)
|
||||
{
|
||||
//if (user_options->quiet == false)
|
||||
// event_log_error (hashcat_ctx, "NVML library load failed: %m. Proceeding without NVML HWMon enabled.");
|
||||
|
@ -24,7 +24,7 @@ bool initialize_keyboard_layout_mapping (const char *filename, keyboard_layout_m
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, filename, "r", HCFILE_FORMAT_PLAIN) == false) return false;
|
||||
if (hc_fopen (&fp, filename, "r") == false) return false;
|
||||
|
||||
int maps_cnt = 0;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
int hc_lockfile (HCFILE *fp)
|
||||
{
|
||||
if (!fp) return -1;
|
||||
if (fp == NULL) return -1;
|
||||
|
||||
struct flock lock;
|
||||
|
||||
@ -31,7 +31,7 @@ int hc_lockfile (HCFILE *fp)
|
||||
|
||||
int hc_unlockfile (HCFILE *fp)
|
||||
{
|
||||
if (!fp) return -1;
|
||||
if (fp == NULL) return -1;
|
||||
|
||||
struct flock lock;
|
||||
|
||||
@ -39,10 +39,7 @@ int hc_unlockfile (HCFILE *fp)
|
||||
|
||||
lock.l_type = F_UNLCK;
|
||||
|
||||
if (fcntl (hc_fileno (fp), F_SETLK, &lock))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (fcntl (hc_fileno (fp), F_SETLK, &lock)) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void logfile_append (hashcat_ctx_t *hashcat_ctx, const char *fmt, ...)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, logfile_ctx->logfile, "ab", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, logfile_ctx->logfile, "ab") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", logfile_ctx->logfile, strerror (errno));
|
||||
|
||||
|
@ -107,7 +107,7 @@ int loopback_write_open (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, loopback_ctx->filename, "ab", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, loopback_ctx->filename, "ab") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", loopback_ctx->filename, strerror (errno));
|
||||
|
||||
|
@ -59,7 +59,14 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
|
||||
|
||||
if (prev_len) main_log_clear_line (prev_len, fp);
|
||||
|
||||
event_ctx->prev_len = (msg_newline == true) ? 0 : msg_len;
|
||||
if (msg_newline == true)
|
||||
{
|
||||
event_ctx->prev_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
event_ctx->prev_len = msg_len;
|
||||
}
|
||||
|
||||
// color stuff pre
|
||||
|
||||
|
@ -376,7 +376,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return -1;
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return -1;
|
||||
|
||||
char *in = (char *) hcmalloc (sizeof (hccapx_t));
|
||||
|
||||
|
@ -351,7 +351,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return -1;
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return -1;
|
||||
|
||||
char *in = (char *) hcmalloc (sizeof (hccapx_t));
|
||||
|
||||
|
@ -95,7 +95,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, (const char *) line_buf, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
psafe3_t in;
|
||||
|
||||
|
@ -148,7 +148,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -148,7 +148,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -146,7 +146,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -146,7 +146,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -146,7 +146,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -146,7 +146,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -148,7 +148,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -148,7 +148,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -148,7 +148,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -160,7 +160,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -160,7 +160,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -160,7 +160,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define TC_HEADER_SIZE 512
|
||||
|
||||
|
@ -158,7 +158,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, (const char *) line_buf, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
psafe2_hdr buf;
|
||||
|
||||
|
@ -174,7 +174,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -174,7 +174,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -174,7 +174,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -172,7 +172,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -172,7 +172,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -172,7 +172,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -174,7 +174,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -174,7 +174,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -174,7 +174,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -175,7 +175,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -175,7 +175,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -175,7 +175,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -174,7 +174,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -174,7 +174,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -174,7 +174,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -175,7 +175,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -175,7 +175,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -175,7 +175,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -178,7 +178,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -178,7 +178,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -178,7 +178,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, hashes->hashfile, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
#define VC_HEADER_SIZE 512
|
||||
|
||||
|
@ -353,7 +353,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, (const char *) line_buf, "rb", HCFILE_FORMAT_PLAIN) == false) return (PARSER_HASH_FILE);
|
||||
if (hc_fopen (&fp, (const char *) line_buf, "rb") == false) return (PARSER_HASH_FILE);
|
||||
|
||||
struct luks_phdr hdr;
|
||||
|
||||
|
10
src/mpsp.c
10
src/mpsp.c
@ -584,7 +584,7 @@ static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr,
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, buf, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, buf, "rb") == false)
|
||||
{
|
||||
const int rc = mp_expand (hashcat_ctx, buf, strlen (buf), mp_sys, mp_usr, userindex, 1);
|
||||
|
||||
@ -712,7 +712,7 @@ static int sp_setup_tbl (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, hcstat, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, hcstat, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", hcstat, strerror (errno));
|
||||
|
||||
@ -1462,7 +1462,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
HCFILE mask_fp;
|
||||
|
||||
if (hc_fopen (&mask_fp, arg, "r", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&mask_fp, arg, "r") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", arg, strerror (errno));
|
||||
|
||||
@ -1555,7 +1555,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE mask_fp;
|
||||
|
||||
if (hc_fopen (&mask_fp, arg, "r", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&mask_fp, arg, "r") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", arg, strerror (errno));
|
||||
|
||||
@ -1629,7 +1629,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE mask_fp;
|
||||
|
||||
if (hc_fopen (&mask_fp, arg, "r", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&mask_fp, arg, "r") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", arg, strerror (errno));
|
||||
|
||||
|
@ -392,7 +392,7 @@ int outfile_write_open (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, outfile_ctx->filename, "ab", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, outfile_ctx->filename, "ab") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", outfile_ctx->filename, strerror (errno));
|
||||
|
||||
|
@ -157,7 +157,7 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, out_info[j].file_name, "rb", HCFILE_FORMAT_PLAIN) == false) continue;
|
||||
if (hc_fopen (&fp, out_info[j].file_name, "rb") == false) continue;
|
||||
|
||||
//hc_thread_mutex_lock (status_ctx->mux_display);
|
||||
|
||||
|
@ -18,7 +18,7 @@ static int check_running_process (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, pidfile_filename, "rb", HCFILE_FORMAT_PLAIN) == false) return 0;
|
||||
if (hc_fopen (&fp, pidfile_filename, "rb") == false) return 0;
|
||||
|
||||
pidfile_data_t *pd = (pidfile_data_t *) hcmalloc (sizeof (pidfile_data_t));
|
||||
|
||||
@ -155,7 +155,7 @@ static int write_pidfile (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, pidfile_filename, "wb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, pidfile_filename, "wb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", pidfile_filename, strerror (errno));
|
||||
|
||||
|
@ -56,7 +56,7 @@ static int read_restore (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, eff_restore_file, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, eff_restore_file, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Restore file '%s': %s", eff_restore_file, strerror (errno));
|
||||
|
||||
@ -205,7 +205,7 @@ static int write_restore (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, new_restore_file, "wb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, new_restore_file, "wb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", new_restore_file, strerror (errno));
|
||||
|
||||
|
2
src/rp.c
2
src/rp.c
@ -737,7 +737,7 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
|
||||
|
||||
u32 rule_line = 0;
|
||||
|
||||
if (hc_fopen (&fp, rp_file, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, rp_file, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", rp_file, strerror (errno));
|
||||
|
||||
|
102
src/shared.c
102
src/shared.c
@ -352,7 +352,7 @@ bool hc_path_has_bom (const char *path)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, path, "rb", HCFILE_FORMAT_PLAIN) == false) return false;
|
||||
if (hc_fopen (&fp, path, "rb") == false) return false;
|
||||
|
||||
const size_t nread = hc_fread (buf, 1, sizeof (buf), &fp);
|
||||
|
||||
@ -615,7 +615,7 @@ int _wopen(const char *path, int oflag, ...)
|
||||
}
|
||||
#endif
|
||||
|
||||
bool hc_fopen (HCFILE *fp, const char *path, char *mode, int file_format)
|
||||
bool hc_fopen (HCFILE *fp, const char *path, char *mode)
|
||||
{
|
||||
if (!path || !mode) return false;
|
||||
|
||||
@ -654,37 +654,42 @@ bool hc_fopen (HCFILE *fp, const char *path, char *mode, int file_format)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file_format == HCFILE_FORMAT_PLAIN)
|
||||
{
|
||||
fp->pfp = NULL;
|
||||
fp->is_gzip = false;
|
||||
|
||||
unsigned char check[3] = { 0 };
|
||||
|
||||
int fd_tmp = open (path, O_RDONLY);
|
||||
|
||||
if (fd_tmp != -1)
|
||||
{
|
||||
lseek (fd_tmp, 0, SEEK_SET);
|
||||
|
||||
size_t s = read (fd_tmp, check, sizeof(check));
|
||||
read (fd_tmp, check, sizeof(check));
|
||||
|
||||
if (s == 3 && (check[0] == 0x1f && check[1] == 0x8b && check[2] == 0x08)) file_format = HCFILE_FORMAT_GZIP;
|
||||
if (check[0] == 0x1f && check[1] == 0x8b && check[2] == 0x08) fp->is_gzip = true;
|
||||
|
||||
close (fd_tmp);
|
||||
}
|
||||
|
||||
fp->fd = (fmode == -1) ? open (path, oflag) : open (path, oflag, fmode);
|
||||
if (fmode == -1)
|
||||
{
|
||||
fp->fd = open (path, oflag);
|
||||
}
|
||||
else
|
||||
{
|
||||
fp->fd = open (path, oflag, fmode);
|
||||
}
|
||||
|
||||
if (fp->fd == -1) return false;
|
||||
|
||||
if (file_format == HCFILE_FORMAT_PLAIN)
|
||||
{
|
||||
if (!(fp->pfp = fdopen (fp->fd, mode))) return false;
|
||||
|
||||
fp->is_gzip = false;
|
||||
}
|
||||
else // HCFILE_FORMAT_GZIP
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
if (!(fp->gfp = gzdopen (fp->fd, mode))) return false;
|
||||
|
||||
fp->is_gzip = true;
|
||||
fp->pfp = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(fp->pfp = fdopen (fp->fd, mode))) return false;
|
||||
}
|
||||
|
||||
fp->path = path;
|
||||
@ -700,9 +705,13 @@ size_t hc_fread (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
|
||||
if (fp == NULL) return n;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
n = gzfread (ptr, size, nmemb, fp->gfp);
|
||||
}
|
||||
else
|
||||
{
|
||||
n = fread (ptr, size, nmemb, fp->pfp);
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
@ -714,9 +723,13 @@ size_t hc_fwrite (void *ptr, size_t size, size_t nmemb, HCFILE *fp)
|
||||
if (fp == NULL) return n;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
n = gzfwrite (ptr, size, nmemb, fp->gfp);
|
||||
}
|
||||
else
|
||||
{
|
||||
n = fwrite (ptr, size, nmemb, fp->pfp);
|
||||
}
|
||||
|
||||
if (n != nmemb) return -1;
|
||||
|
||||
@ -730,9 +743,13 @@ int hc_fseek (HCFILE *fp, off_t offset, int whence)
|
||||
if (fp == NULL) return r;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
r = gzseek (fp->gfp, (z_off_t) offset, whence);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = fseeko (fp->pfp, offset, whence);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -742,10 +759,14 @@ void hc_rewind (HCFILE *fp)
|
||||
if (fp == NULL) return;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
gzrewind (fp->gfp);
|
||||
}
|
||||
else
|
||||
{
|
||||
rewind (fp->pfp);
|
||||
}
|
||||
}
|
||||
|
||||
off_t hc_ftell (HCFILE *fp)
|
||||
{
|
||||
@ -754,9 +775,13 @@ off_t hc_ftell (HCFILE *fp)
|
||||
if (fp == NULL) return -1;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
n = (off_t) gztell (fp->gfp);
|
||||
}
|
||||
else
|
||||
{
|
||||
n = ftello (fp->pfp);
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
@ -768,9 +793,13 @@ int hc_fputc (int c, HCFILE *fp)
|
||||
if (fp == NULL) return r;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
r = gzputc (fp->gfp, c);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = fputc (c, fp->pfp);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -782,9 +811,13 @@ int hc_fgetc (HCFILE *fp)
|
||||
if (fp == NULL) return r;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
r = gzgetc (fp->gfp);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = fgetc (fp->pfp);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -793,12 +826,16 @@ char *hc_fgets (char *buf, int len, HCFILE *fp)
|
||||
{
|
||||
char *r = NULL;
|
||||
|
||||
if (fp == NULL) return NULL;
|
||||
if (fp == NULL) return r;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
r = gzgets (fp->gfp, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = fgets (buf, len, fp->pfp);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -810,9 +847,13 @@ int hc_vfprintf (HCFILE *fp, const char *format, va_list ap)
|
||||
if (fp == NULL) return r;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
r = gzvprintf (fp->gfp, format, ap);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = vfprintf (fp->pfp, format, ap);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -828,9 +869,13 @@ int hc_fprintf (HCFILE *fp, const char *format, ...)
|
||||
va_start (ap, format);
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
r = gzvprintf (fp->gfp, format, ap);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = vfprintf (fp->pfp, format, ap);
|
||||
}
|
||||
|
||||
va_end (ap);
|
||||
|
||||
@ -843,11 +888,11 @@ int hc_fscanf (HCFILE *fp, const char *format, void *ptr)
|
||||
|
||||
char *buf = (char *) hcmalloc (HCBUFSIZ_TINY);
|
||||
|
||||
if (!buf) return -1;
|
||||
if (buf == NULL) return -1;
|
||||
|
||||
char *b = hc_fgets (buf, HCBUFSIZ_TINY - 1, fp);
|
||||
|
||||
if (!b)
|
||||
if (b == NULL)
|
||||
{
|
||||
hcfree (buf);
|
||||
|
||||
@ -875,9 +920,13 @@ int hc_feof (HCFILE *fp)
|
||||
if (fp == NULL) return r;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
r = gzeof (fp->gfp);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = feof (fp->pfp);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -887,23 +936,32 @@ void hc_fflush (HCFILE *fp)
|
||||
if (fp == NULL) return;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
gzflush (fp->gfp, Z_SYNC_FLUSH);
|
||||
}
|
||||
else
|
||||
{
|
||||
fflush (fp->pfp);
|
||||
}
|
||||
}
|
||||
|
||||
void hc_fclose (HCFILE *fp)
|
||||
{
|
||||
if (fp == NULL) return;
|
||||
|
||||
if (fp->is_gzip)
|
||||
{
|
||||
gzclose (fp->gfp);
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose (fp->pfp);
|
||||
}
|
||||
|
||||
close (fp->fd);
|
||||
|
||||
fp->fd = -1;
|
||||
fp->pfp = NULL;
|
||||
fp->is_gzip = false;
|
||||
|
||||
fp->path = NULL;
|
||||
@ -921,7 +979,7 @@ bool hc_same_files (char *file1, char *file2)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, file1, "r", HCFILE_FORMAT_PLAIN) == true)
|
||||
if (hc_fopen (&fp, file1, "r") == true)
|
||||
{
|
||||
if (fstat (hc_fileno (&fp), &tmpstat_file1))
|
||||
{
|
||||
@ -935,7 +993,7 @@ bool hc_same_files (char *file1, char *file2)
|
||||
do_check++;
|
||||
}
|
||||
|
||||
if (hc_fopen (&fp, file2, "r", HCFILE_FORMAT_PLAIN) == true)
|
||||
if (hc_fopen (&fp, file2, "r") == true)
|
||||
{
|
||||
if (fstat (hc_fileno (&fp), &tmpstat_file2))
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, filename, "ab", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, filename, "ab") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno));
|
||||
|
||||
|
@ -72,7 +72,7 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, straight_ctx->dict, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, straight_ctx->dict, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", straight_ctx->dict, strerror (errno));
|
||||
|
||||
@ -107,7 +107,7 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, combinator_ctx->dict1, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, combinator_ctx->dict1, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", combinator_ctx->dict1, strerror (errno));
|
||||
|
||||
@ -129,7 +129,7 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, combinator_ctx->dict2, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, combinator_ctx->dict2, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", combinator_ctx->dict2, strerror (errno));
|
||||
|
||||
@ -175,7 +175,7 @@ int straight_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, straight_ctx->dict, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, straight_ctx->dict, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", straight_ctx->dict, strerror (errno));
|
||||
|
||||
|
@ -70,7 +70,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
HCFILE fp;
|
||||
|
||||
if (hc_fopen (&fp, tuning_db_file, "rb", HCFILE_FORMAT_PLAIN) == false)
|
||||
if (hc_fopen (&fp, tuning_db_file, "rb") == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", tuning_db_file, strerror (errno));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user