mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-15 04:23:06 +00:00
remove special time handling in hashcat.
There's a way to get 64-bit time_t and 64-bit stat in MinGW, so use that.
This commit is contained in:
parent
494c2724f5
commit
1c5915cae3
@ -37,9 +37,6 @@ void setup_environment_variables (void);
|
||||
void setup_umask (void);
|
||||
void setup_seeding (const bool rp_gen_seed_chgd, const u32 rp_gen_seed);
|
||||
|
||||
int hc_stat (const char *pathname, hc_stat_t *buf);
|
||||
int hc_fstat (int fd, hc_stat_t *buf);
|
||||
|
||||
void hc_qsort_r (void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *, void *), void *arg);
|
||||
void *hc_bsearch_r (const void *key, const void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *, void *), void *arg);
|
||||
|
||||
@ -59,9 +56,7 @@ void hc_string_trim_leading (char *s);
|
||||
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);
|
||||
|
||||
hc_time_t hc_time (hc_time_t *t);
|
||||
struct tm *hc_gmtime (const hc_time_t *t, MAYBE_UNUSED struct tm *result);
|
||||
char *hc_ctime (const hc_time_t *t, char *buf, MAYBE_UNUSED const size_t buf_size);
|
||||
char *hc_ctime (const time_t *t, char *buf, MAYBE_UNUSED const size_t buf_size);
|
||||
|
||||
bool hc_same_files (char *file1, char *file2);
|
||||
|
||||
|
@ -47,7 +47,7 @@ double status_get_msec_paused (const hashcat_ctx_t *hashcat_
|
||||
double status_get_msec_real (const hashcat_ctx_t *hashcat_ctx);
|
||||
char *status_get_time_started_absolute (const hashcat_ctx_t *hashcat_ctx);
|
||||
char *status_get_time_started_relative (const hashcat_ctx_t *hashcat_ctx);
|
||||
hc_time_t status_get_sec_etc (const hashcat_ctx_t *hashcat_ctx);
|
||||
time_t status_get_sec_etc (const hashcat_ctx_t *hashcat_ctx);
|
||||
char *status_get_time_estimated_absolute (const hashcat_ctx_t *hashcat_ctx);
|
||||
char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx);
|
||||
u64 status_get_restore_point (const hashcat_ctx_t *hashcat_ctx);
|
||||
|
@ -22,7 +22,7 @@
|
||||
#endif // _WIN
|
||||
|
||||
void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag);
|
||||
void goodbye_screen (hashcat_ctx_t *hashcat_ctx, const hc_time_t proc_start, const hc_time_t proc_stop);
|
||||
void goodbye_screen (hashcat_ctx_t *hashcat_ctx, const time_t proc_start, const time_t proc_stop);
|
||||
|
||||
int setup_console (void);
|
||||
|
||||
|
@ -43,14 +43,6 @@ typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
// time
|
||||
|
||||
#if defined (_WIN)
|
||||
typedef __time64_t hc_time_t;
|
||||
#else
|
||||
typedef time_t hc_time_t;
|
||||
#endif
|
||||
|
||||
// timer
|
||||
|
||||
#if defined (_WIN)
|
||||
@ -73,14 +65,6 @@ typedef pthread_t hc_thread_t;
|
||||
typedef pthread_mutex_t hc_thread_mutex_t;
|
||||
#endif
|
||||
|
||||
// stat
|
||||
|
||||
#if defined (_WIN)
|
||||
typedef struct _stat64 hc_stat_t;
|
||||
#else
|
||||
typedef struct stat hc_stat_t;
|
||||
#endif
|
||||
|
||||
// enums
|
||||
|
||||
typedef enum loglevel
|
||||
@ -761,7 +745,7 @@ typedef struct outfile_data
|
||||
{
|
||||
char *file_name;
|
||||
off_t seek;
|
||||
hc_time_t ctime;
|
||||
time_t ctime;
|
||||
|
||||
} outfile_data_t;
|
||||
|
||||
@ -889,7 +873,7 @@ typedef struct bs_word
|
||||
typedef struct cpt
|
||||
{
|
||||
u32 cracked;
|
||||
hc_time_t timestamp;
|
||||
time_t timestamp;
|
||||
|
||||
} cpt_t;
|
||||
|
||||
@ -1241,7 +1225,7 @@ typedef struct dictstat
|
||||
{
|
||||
u64 cnt;
|
||||
|
||||
hc_stat_t stat;
|
||||
struct stat stat;
|
||||
|
||||
char encoding_from[64];
|
||||
char encoding_to[64];
|
||||
@ -1727,7 +1711,7 @@ typedef struct cpt_ctx
|
||||
|
||||
cpt_t *cpt_buf;
|
||||
int cpt_pos;
|
||||
hc_time_t cpt_start;
|
||||
time_t cpt_start;
|
||||
u64 cpt_total;
|
||||
|
||||
} cpt_ctx_t;
|
||||
@ -1870,8 +1854,8 @@ typedef struct status_ctx
|
||||
* timer
|
||||
*/
|
||||
|
||||
hc_time_t runtime_start;
|
||||
hc_time_t runtime_stop;
|
||||
time_t runtime_start;
|
||||
time_t runtime_stop;
|
||||
|
||||
hc_timer_t timer_running; // timer on current dict
|
||||
hc_timer_t timer_paused; // timer on current dict
|
||||
@ -1894,7 +1878,7 @@ typedef struct cache_hit
|
||||
{
|
||||
const char *dictfile;
|
||||
|
||||
hc_stat_t stat;
|
||||
struct stat stat;
|
||||
|
||||
u64 cached_cnt;
|
||||
u64 keyspace;
|
||||
@ -1911,7 +1895,7 @@ typedef struct cache_generate
|
||||
u64 cnt;
|
||||
u64 cnt2;
|
||||
|
||||
hc_time_t runtime;
|
||||
time_t runtime;
|
||||
|
||||
} cache_generate_t;
|
||||
|
||||
|
@ -254,6 +254,7 @@ CFLAGS_CROSS_LINUX64 += -I$(OPENCL_HEADERS_KHRONOS)/
|
||||
CFLAGS_CROSS_LINUX64 += -m64
|
||||
CFLAGS_CROSS_LINUX64 += -DWITH_HWMON
|
||||
CFLAGS_CROSS_WIN32 := $(CFLAGS)
|
||||
CFLAGS_CROSS_WIN32 += -D__MINGW_USE_VC2005_COMPAT #hack to get 64-bit time_t
|
||||
CFLAGS_CROSS_WIN32 += -I$(OPENCL_HEADERS_KHRONOS)/
|
||||
CFLAGS_CROSS_WIN32 += -I$(WIN_ICONV_32)/include/
|
||||
CFLAGS_CROSS_WIN32 += -m32
|
||||
|
@ -30,7 +30,7 @@ int cpt_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
cpt_ctx->cpt_total = 0;
|
||||
cpt_ctx->cpt_pos = 0;
|
||||
cpt_ctx->cpt_start = hc_time (NULL);
|
||||
cpt_ctx->cpt_start = time (NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -56,5 +56,5 @@ void cpt_ctx_reset (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
cpt_ctx->cpt_total = 0;
|
||||
cpt_ctx->cpt_pos = 0;
|
||||
cpt_ctx->cpt_start = hc_time (NULL);
|
||||
cpt_ctx->cpt_start = time (NULL);
|
||||
}
|
||||
|
@ -214,9 +214,9 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
hc_timer_set (&status_ctx->timer_running);
|
||||
|
||||
hc_time_t runtime_start;
|
||||
time_t runtime_start;
|
||||
|
||||
hc_time (&runtime_start);
|
||||
time (&runtime_start);
|
||||
|
||||
status_ctx->runtime_start = runtime_start;
|
||||
|
||||
@ -270,9 +270,9 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// update some timer
|
||||
|
||||
hc_time_t runtime_stop;
|
||||
time_t runtime_stop;
|
||||
|
||||
hc_time (&runtime_stop);
|
||||
time (&runtime_stop);
|
||||
|
||||
status_ctx->runtime_stop = runtime_stop;
|
||||
|
||||
@ -1103,7 +1103,7 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// start logfile entry
|
||||
|
||||
const hc_time_t proc_start = hc_time (NULL);
|
||||
const time_t proc_start = time (NULL);
|
||||
|
||||
logfile_generate_topid (hashcat_ctx);
|
||||
|
||||
@ -1176,7 +1176,7 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// final logfile entry
|
||||
|
||||
const hc_time_t proc_stop = hc_time (NULL);
|
||||
const time_t proc_stop = time (NULL);
|
||||
|
||||
logfile_top_uint (proc_start);
|
||||
logfile_top_uint (proc_stop);
|
||||
|
18
src/hashes.c
18
src/hashes.c
@ -404,7 +404,7 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
|
||||
{
|
||||
hc_thread_mutex_lock (status_ctx->mux_display);
|
||||
|
||||
cpt_ctx->cpt_buf[cpt_ctx->cpt_pos].timestamp = hc_time (NULL);
|
||||
cpt_ctx->cpt_buf[cpt_ctx->cpt_pos].timestamp = time (NULL);
|
||||
cpt_ctx->cpt_buf[cpt_ctx->cpt_pos].cracked = cpt_cracked;
|
||||
|
||||
cpt_ctx->cpt_pos++;
|
||||
@ -514,9 +514,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
if ((hashconfig->hash_mode == 2500) || (hashconfig->hash_mode == 2501))
|
||||
{
|
||||
hc_stat_t st;
|
||||
struct stat st;
|
||||
|
||||
if (hc_stat (hashes->hashfile, &st) == -1)
|
||||
if (stat (hashes->hashfile, &st) == -1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", hashes->hashfile, strerror (errno));
|
||||
|
||||
@ -541,9 +541,9 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
else if (hashconfig->hash_mode == 14600)
|
||||
{
|
||||
hc_stat_t st;
|
||||
struct stat st;
|
||||
|
||||
if (hc_stat (hashes->hashfile, &st) == -1)
|
||||
if (stat (hashes->hashfile, &st) == -1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", hashes->hashfile, strerror (errno));
|
||||
|
||||
@ -947,8 +947,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
char *line_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
||||
|
||||
hc_time_t prev = 0;
|
||||
hc_time_t now = 0;
|
||||
time_t prev = 0;
|
||||
time_t now = 0;
|
||||
|
||||
while (!feof (fp))
|
||||
{
|
||||
@ -1140,11 +1140,11 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
hashes_cnt++;
|
||||
}
|
||||
|
||||
hc_time (&now);
|
||||
time (&now);
|
||||
|
||||
if ((now - prev) == 0) continue;
|
||||
|
||||
hc_time (&prev);
|
||||
time (&prev);
|
||||
|
||||
hashlist_parse_t hashlist_parse;
|
||||
|
||||
|
10
src/induct.c
10
src/induct.c
@ -16,11 +16,11 @@ static int sort_by_mtime (const void *p1, const void *p2)
|
||||
const char* const *f1 = (const char* const *) p1;
|
||||
const char* const *f2 = (const char* const *) p2;
|
||||
|
||||
hc_stat_t s1;
|
||||
hc_stat_t s2;
|
||||
struct stat s1;
|
||||
struct stat s2;
|
||||
|
||||
const int rc1 = hc_stat (*f1, &s1);
|
||||
const int rc2 = hc_stat (*f2, &s2);
|
||||
const int rc1 = stat (*f1, &s1);
|
||||
const int rc2 = stat (*f2, &s2);
|
||||
|
||||
if (rc1 < rc2) return 1;
|
||||
if (rc1 > rc2) return -1;
|
||||
@ -69,7 +69,7 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
char *root_directory_mv;
|
||||
|
||||
hc_asprintf (&root_directory_mv, "%s/%s.induct.%d", folder_config->session_dir, user_options->session, (int) hc_time (NULL));
|
||||
hc_asprintf (&root_directory_mv, "%s/%s.induct.%d", folder_config->session_dir, user_options->session, (int) time (NULL));
|
||||
|
||||
if (rename (root_directory, root_directory_mv) != 0)
|
||||
{
|
||||
|
@ -97,9 +97,9 @@ int loopback_write_open (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (induct_ctx->enabled == false) return 0;
|
||||
|
||||
hc_time_t now;
|
||||
time_t now;
|
||||
|
||||
hc_time (&now);
|
||||
time (&now);
|
||||
|
||||
const u32 random_num = get_random_num (0, 9999);
|
||||
|
||||
|
@ -788,12 +788,12 @@ static void main_wordlist_cache_generate (MAYBE_UNUSED hashcat_ctx_t *hashcat_ct
|
||||
{
|
||||
char *runtime = (char *) malloc (HCBUFSIZ_TINY);
|
||||
|
||||
const hc_time_t runtime_sec = cache_generate->runtime;
|
||||
const time_t runtime_sec = cache_generate->runtime;
|
||||
|
||||
struct tm *tmp;
|
||||
struct tm tm;
|
||||
|
||||
tmp = hc_gmtime (&runtime_sec, &tm);
|
||||
tmp = gmtime_r (&runtime_sec, &tm);
|
||||
|
||||
format_timer_display (tmp, runtime, HCBUFSIZ_TINY);
|
||||
|
||||
@ -959,7 +959,7 @@ int main (int argc, char **argv)
|
||||
|
||||
setup_console ();
|
||||
|
||||
const hc_time_t proc_start = hc_time (NULL);
|
||||
const time_t proc_start = time (NULL);
|
||||
|
||||
// hashcat main context
|
||||
|
||||
@ -1059,7 +1059,7 @@ int main (int argc, char **argv)
|
||||
|
||||
// finished with hashcat, clean up
|
||||
|
||||
const hc_time_t proc_stop = hc_time (NULL);
|
||||
const time_t proc_stop = time (NULL);
|
||||
|
||||
goodbye_screen (hashcat_ctx, proc_start, proc_stop);
|
||||
|
||||
|
@ -30,9 +30,9 @@ int get_runtime_left (const hashcat_ctx_t *hashcat_ctx)
|
||||
msec_paused += msec_paused_tmp;
|
||||
}
|
||||
|
||||
hc_time_t runtime_cur;
|
||||
time_t runtime_cur;
|
||||
|
||||
hc_time (&runtime_cur);
|
||||
time (&runtime_cur);
|
||||
|
||||
const int runtime_left = (int) (status_ctx->runtime_start
|
||||
+ user_options->runtime
|
||||
@ -99,9 +99,9 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
// timer
|
||||
|
||||
hc_time_t last_temp_check_time;
|
||||
time_t last_temp_check_time;
|
||||
|
||||
hc_time (&last_temp_check_time);
|
||||
time (&last_temp_check_time);
|
||||
|
||||
u32 slowdown_warnings = 0;
|
||||
u32 performance_warnings = 0;
|
||||
@ -151,9 +151,9 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
hc_thread_mutex_lock (status_ctx->mux_hwmon);
|
||||
|
||||
hc_time_t temp_check_time;
|
||||
time_t temp_check_time;
|
||||
|
||||
hc_time (&temp_check_time);
|
||||
time (&temp_check_time);
|
||||
|
||||
u32 Ta = temp_check_time - last_temp_check_time; // set Ta = sleep_time; is not good enough (see --remove etc)
|
||||
|
||||
|
@ -678,9 +678,9 @@ static int sp_setup_tbl (hashcat_ctx_t *hashcat_ctx)
|
||||
hcstat = hcstat_tmp;
|
||||
}
|
||||
|
||||
hc_stat_t s;
|
||||
struct stat s;
|
||||
|
||||
if (hc_stat (hcstat, &s) == -1)
|
||||
if (stat (hcstat, &s) == -1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", hcstat, strerror (errno));
|
||||
|
||||
|
@ -245,9 +245,9 @@ static int read_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_fi
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
hc_stat_t st;
|
||||
struct stat st;
|
||||
|
||||
if (hc_stat (kernel_file, &st))
|
||||
if (stat (kernel_file, &st))
|
||||
{
|
||||
fclose (fp);
|
||||
|
||||
|
@ -51,7 +51,7 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
char **out_files = NULL;
|
||||
|
||||
hc_time_t folder_mtime = 0;
|
||||
time_t folder_mtime = 0;
|
||||
|
||||
int out_cnt = 0;
|
||||
|
||||
@ -73,9 +73,9 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (is_dir == true)
|
||||
{
|
||||
hc_stat_t outfile_check_stat;
|
||||
struct stat outfile_check_stat;
|
||||
|
||||
if (hc_stat (root_directory, &outfile_check_stat) == -1)
|
||||
if (stat (root_directory, &outfile_check_stat) == -1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: %s", root_directory, strerror (errno));
|
||||
|
||||
@ -107,9 +107,9 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
if (strcmp (out_info[j].file_name, out_info_new[i].file_name) == 0)
|
||||
{
|
||||
hc_stat_t outfile_stat;
|
||||
struct stat outfile_stat;
|
||||
|
||||
if (hc_stat (out_info_new[i].file_name, &outfile_stat) == 0)
|
||||
if (stat (out_info_new[i].file_name, &outfile_stat) == 0)
|
||||
{
|
||||
if (outfile_stat.st_ctime == out_info[j].ctime)
|
||||
{
|
||||
@ -140,9 +140,9 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
//hc_thread_mutex_lock (status_ctx->mux_display);
|
||||
|
||||
hc_stat_t outfile_stat;
|
||||
struct stat outfile_stat;
|
||||
|
||||
if (hc_fstat (fileno (fp), &outfile_stat))
|
||||
if (fstat (fileno (fp), &outfile_stat))
|
||||
{
|
||||
fclose (fp);
|
||||
|
||||
|
78
src/shared.c
78
src/shared.c
@ -151,28 +151,6 @@ void hc_asprintf (char **strp, const char *fmt, ...)
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
#if defined (_WIN)
|
||||
int hc_stat (const char *pathname, hc_stat_t *buf)
|
||||
{
|
||||
return stat64 (pathname, buf);
|
||||
}
|
||||
|
||||
int hc_fstat (int fd, hc_stat_t *buf)
|
||||
{
|
||||
return fstat64 (fd, buf);
|
||||
}
|
||||
#else
|
||||
int hc_stat (const char *pathname, hc_stat_t *buf)
|
||||
{
|
||||
return stat (pathname, buf);
|
||||
}
|
||||
|
||||
int hc_fstat (int fd, hc_stat_t *buf)
|
||||
{
|
||||
return fstat (fd, buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (_WIN)
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
@ -213,9 +191,9 @@ void *hc_bsearch_r (const void *key, const void *base, size_t nmemb, size_t size
|
||||
|
||||
bool hc_path_is_file (const char *path)
|
||||
{
|
||||
hc_stat_t s;
|
||||
struct stat s;
|
||||
|
||||
if (hc_stat (path, &s) == -1) return false;
|
||||
if (stat (path, &s) == -1) return false;
|
||||
|
||||
if (S_ISREG (s.st_mode)) return true;
|
||||
|
||||
@ -224,9 +202,9 @@ bool hc_path_is_file (const char *path)
|
||||
|
||||
bool hc_path_is_directory (const char *path)
|
||||
{
|
||||
hc_stat_t s;
|
||||
struct stat s;
|
||||
|
||||
if (hc_stat (path, &s) == -1) return false;
|
||||
if (stat (path, &s) == -1) return false;
|
||||
|
||||
if (S_ISDIR (s.st_mode)) return true;
|
||||
|
||||
@ -235,9 +213,9 @@ bool hc_path_is_directory (const char *path)
|
||||
|
||||
bool hc_path_is_empty (const char *path)
|
||||
{
|
||||
hc_stat_t s;
|
||||
struct stat s;
|
||||
|
||||
if (hc_stat (path, &s) == -1) return false;
|
||||
if (stat (path, &s) == -1) return false;
|
||||
|
||||
if (s.st_size == 0) return true;
|
||||
|
||||
@ -341,9 +319,9 @@ void setup_seeding (const bool rp_gen_seed_chgd, const u32 rp_gen_seed)
|
||||
}
|
||||
else
|
||||
{
|
||||
hc_time_t ts;
|
||||
time_t ts;
|
||||
|
||||
hc_time (&ts);
|
||||
time (&ts);
|
||||
|
||||
srand (ts);
|
||||
}
|
||||
@ -426,39 +404,11 @@ void hc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
if (rc == 0) rc = 0;
|
||||
}
|
||||
|
||||
|
||||
hc_time_t hc_time (hc_time_t *t)
|
||||
{
|
||||
#if defined (_WIN)
|
||||
return _time64 (t);
|
||||
#else
|
||||
return time (t);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct tm *hc_gmtime (const hc_time_t *t, MAYBE_UNUSED struct tm *result)
|
||||
{
|
||||
#if defined (_WIN)
|
||||
return _gmtime64 (t);
|
||||
#else
|
||||
return gmtime_r (t, result);
|
||||
#endif
|
||||
}
|
||||
|
||||
char *hc_ctime (const hc_time_t *t, char *buf, MAYBE_UNUSED const size_t buf_size)
|
||||
char *hc_ctime (const time_t *t, char *buf, MAYBE_UNUSED const size_t buf_size)
|
||||
{
|
||||
char *etc = NULL;
|
||||
|
||||
#if defined (_WIN)
|
||||
etc = _ctime64 (t);
|
||||
|
||||
if (etc != NULL)
|
||||
{
|
||||
snprintf (buf, buf_size, "%s", etc);
|
||||
}
|
||||
#else
|
||||
etc = ctime_r (t, buf); // buf should have room for at least 26 bytes
|
||||
#endif
|
||||
|
||||
return etc;
|
||||
}
|
||||
@ -467,8 +417,8 @@ bool hc_same_files (char *file1, char *file2)
|
||||
{
|
||||
if ((file1 != NULL) && (file2 != NULL))
|
||||
{
|
||||
hc_stat_t tmpstat_file1;
|
||||
hc_stat_t tmpstat_file2;
|
||||
struct stat tmpstat_file1;
|
||||
struct stat tmpstat_file2;
|
||||
|
||||
int do_check = 0;
|
||||
|
||||
@ -478,7 +428,7 @@ bool hc_same_files (char *file1, char *file2)
|
||||
|
||||
if (fp)
|
||||
{
|
||||
if (hc_fstat (fileno (fp), &tmpstat_file1))
|
||||
if (fstat (fileno (fp), &tmpstat_file1))
|
||||
{
|
||||
fclose (fp);
|
||||
|
||||
@ -494,7 +444,7 @@ bool hc_same_files (char *file1, char *file2)
|
||||
|
||||
if (fp)
|
||||
{
|
||||
if (hc_fstat (fileno (fp), &tmpstat_file2))
|
||||
if (fstat (fileno (fp), &tmpstat_file2))
|
||||
{
|
||||
fclose (fp);
|
||||
|
||||
@ -540,7 +490,7 @@ bool hc_same_files (char *file1, char *file2)
|
||||
tmpstat_file2.st_blocks = 0;
|
||||
#endif
|
||||
|
||||
if (memcmp (&tmpstat_file1, &tmpstat_file2, sizeof (hc_stat_t)) == 0)
|
||||
if (memcmp (&tmpstat_file1, &tmpstat_file2, sizeof (struct stat)) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
46
src/status.c
46
src/status.c
@ -966,7 +966,7 @@ char *status_get_time_started_absolute (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
||||
const hc_time_t time_start = status_ctx->runtime_start;
|
||||
const time_t time_start = status_ctx->runtime_start;
|
||||
|
||||
char buf[32] = { 0 };
|
||||
|
||||
@ -984,18 +984,18 @@ char *status_get_time_started_relative (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
||||
hc_time_t time_now;
|
||||
time_t time_now;
|
||||
|
||||
hc_time (&time_now);
|
||||
time (&time_now);
|
||||
|
||||
const hc_time_t time_start = status_ctx->runtime_start;
|
||||
const time_t time_start = status_ctx->runtime_start;
|
||||
|
||||
hc_time_t sec_run = time_now - time_start;
|
||||
time_t sec_run = time_now - time_start;
|
||||
|
||||
struct tm *tmp;
|
||||
struct tm tm;
|
||||
|
||||
tmp = hc_gmtime (&sec_run, &tm);
|
||||
tmp = gmtime_r (&sec_run, &tm);
|
||||
|
||||
char *display_run = (char *) malloc (HCBUFSIZ_TINY);
|
||||
|
||||
@ -1004,12 +1004,12 @@ char *status_get_time_started_relative (const hashcat_ctx_t *hashcat_ctx)
|
||||
return display_run;
|
||||
}
|
||||
|
||||
hc_time_t status_get_sec_etc (const hashcat_ctx_t *hashcat_ctx)
|
||||
time_t status_get_sec_etc (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||
|
||||
hc_time_t sec_etc = 0;
|
||||
time_t sec_etc = 0;
|
||||
|
||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
||||
{
|
||||
@ -1038,10 +1038,10 @@ hc_time_t status_get_sec_etc (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
char *status_get_time_estimated_absolute (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
hc_time_t sec_etc = status_get_sec_etc (hashcat_ctx);
|
||||
time_t sec_etc = status_get_sec_etc (hashcat_ctx);
|
||||
|
||||
hc_time_t now;
|
||||
hc_time (&now);
|
||||
time_t now;
|
||||
time (&now);
|
||||
|
||||
|
||||
char buf[32] = { 0 };
|
||||
@ -1054,7 +1054,7 @@ char *status_get_time_estimated_absolute (const hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
else
|
||||
{
|
||||
hc_time_t end = now + sec_etc;
|
||||
time_t end = now + sec_etc;
|
||||
|
||||
etc = hc_ctime (&end, buf, sizeof (buf));
|
||||
|
||||
@ -1075,12 +1075,12 @@ char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
char *display = (char *) malloc (HCBUFSIZ_TINY);
|
||||
|
||||
hc_time_t sec_etc = status_get_sec_etc (hashcat_ctx);
|
||||
time_t sec_etc = status_get_sec_etc (hashcat_ctx);
|
||||
|
||||
struct tm *tmp;
|
||||
struct tm tm;
|
||||
|
||||
tmp = hc_gmtime (&sec_etc, &tm);
|
||||
tmp = gmtime_r (&sec_etc, &tm);
|
||||
|
||||
if (tmp == NULL)
|
||||
{
|
||||
@ -1099,12 +1099,12 @@ char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (runtime_left > 0)
|
||||
{
|
||||
hc_time_t sec_left = runtime_left;
|
||||
time_t sec_left = runtime_left;
|
||||
|
||||
struct tm *tmp_left;
|
||||
struct tm tm_left;
|
||||
|
||||
tmp_left = hc_gmtime (&sec_left, &tm_left);
|
||||
tmp_left = gmtime_r (&sec_left, &tm_left);
|
||||
|
||||
char *display_left = (char *) malloc (HCBUFSIZ_TINY);
|
||||
|
||||
@ -1495,14 +1495,14 @@ int status_get_cpt_cur_min (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (status_ctx->accessible == false) return 0;
|
||||
|
||||
const hc_time_t now = hc_time (NULL);
|
||||
const time_t now = time (NULL);
|
||||
|
||||
int cpt_cur_min = 0;
|
||||
|
||||
for (int i = 0; i < CPT_CACHE; i++)
|
||||
{
|
||||
const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
|
||||
const hc_time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
||||
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
||||
|
||||
if ((timestamp + 60) > now)
|
||||
{
|
||||
@ -1520,14 +1520,14 @@ int status_get_cpt_cur_hour (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (status_ctx->accessible == false) return 0;
|
||||
|
||||
const hc_time_t now = hc_time (NULL);
|
||||
const time_t now = time (NULL);
|
||||
|
||||
int cpt_cur_hour = 0;
|
||||
|
||||
for (int i = 0; i < CPT_CACHE; i++)
|
||||
{
|
||||
const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
|
||||
const hc_time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
||||
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
||||
|
||||
if ((timestamp + 3600) > now)
|
||||
{
|
||||
@ -1545,14 +1545,14 @@ int status_get_cpt_cur_day (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (status_ctx->accessible == false) return 0;
|
||||
|
||||
const hc_time_t now = hc_time (NULL);
|
||||
const time_t now = time (NULL);
|
||||
|
||||
int cpt_cur_day = 0;
|
||||
|
||||
for (int i = 0; i < CPT_CACHE; i++)
|
||||
{
|
||||
const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
|
||||
const hc_time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
||||
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
||||
|
||||
if ((timestamp + 86400) > now)
|
||||
{
|
||||
@ -1600,7 +1600,7 @@ char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
||||
|
||||
const hc_time_t now = hc_time (NULL);
|
||||
const time_t now = time (NULL);
|
||||
|
||||
char *cpt;
|
||||
|
||||
|
@ -78,7 +78,7 @@ void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag)
|
||||
}
|
||||
}
|
||||
|
||||
void goodbye_screen (hashcat_ctx_t *hashcat_ctx, const hc_time_t proc_start, const hc_time_t proc_stop)
|
||||
void goodbye_screen (hashcat_ctx_t *hashcat_ctx, const time_t proc_start, const time_t proc_stop)
|
||||
{
|
||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
|
@ -279,7 +279,7 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
|
||||
|
||||
d.cnt = 0;
|
||||
|
||||
if (hc_fstat (fileno (fd), &d.stat))
|
||||
if (fstat (fileno (fd), &d.stat))
|
||||
{
|
||||
*result = 0;
|
||||
|
||||
@ -360,12 +360,12 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
|
||||
}
|
||||
}
|
||||
|
||||
hc_time_t rt_start;
|
||||
time_t rt_start;
|
||||
|
||||
hc_time (&rt_start);
|
||||
time (&rt_start);
|
||||
|
||||
hc_time_t now = 0;
|
||||
hc_time_t prev = 0;
|
||||
time_t now = 0;
|
||||
time_t prev = 0;
|
||||
|
||||
u64 comp = 0;
|
||||
u64 cnt = 0;
|
||||
@ -449,11 +449,11 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
|
||||
}
|
||||
}
|
||||
|
||||
hc_time (&now);
|
||||
time (&now);
|
||||
|
||||
if ((now - prev) == 0) continue;
|
||||
|
||||
hc_time (&prev);
|
||||
time (&prev);
|
||||
|
||||
double percent = ((double) comp / (double) d.stat.st_size) * 100;
|
||||
|
||||
@ -471,9 +471,9 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
|
||||
}
|
||||
}
|
||||
|
||||
hc_time_t rt_stop;
|
||||
time_t rt_stop;
|
||||
|
||||
hc_time (&rt_stop);
|
||||
time (&rt_stop);
|
||||
|
||||
cache_generate_t cache_generate;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user