1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

Prepare move dictstat specific functions into their own source file

This commit is contained in:
jsteube 2016-09-08 18:27:53 +02:00
parent 15a7a42252
commit f006542317
5 changed files with 20 additions and 37 deletions

View File

@ -8,6 +8,7 @@
#include <stdio.h>
void generate_dictstat_filename (char *profile_dir, char *dictstat_filename);
void generate_source_kernel_filename (const uint attack_exec, const uint attack_kern, const uint kern_type, char *shared_dir, char *source_file);
void generate_cached_kernel_filename (const uint attack_exec, const uint attack_kern, const uint kern_type, char *profile_dir, const char *device_name_chksum, char *cached_file);
void generate_source_kernel_mp_filename (const uint opti_type, const uint opts_type, char *shared_dir, char *source_file);

View File

@ -275,19 +275,7 @@ typedef struct
} pot_t;
typedef struct
{
u64 cnt;
#if defined (_POSIX)
struct stat stat;
#endif
#if defined (_WIN)
struct __stat64 stat;
#endif
} dictstat_t;
typedef struct
{

View File

@ -166,7 +166,7 @@ LFLAGS_CROSS_WIN := -lpsapi
## Objects
##
NATIVE_OBJS := obj/wordlist.NATIVE.o obj/stdout.NATIVE.o obj/filenames.NATIVE.o obj/hlfmt.NATIVE.o obj/status.NATIVE.o obj/restore.NATIVE.o obj/bitmap.NATIVE.o obj/opencl.NATIVE.o obj/affinity.NATIVE.o obj/filehandling.NATIVE.o obj/tuningdb.NATIVE.o obj/locking.NATIVE.o obj/folder.NATIVE.o obj/bitops.NATIVE.o obj/convert.NATIVE.o obj/cpu_aes.NATIVE.o obj/cpu_crc32.NATIVE.o obj/cpu_des.NATIVE.o obj/cpu_md5.NATIVE.o obj/cpu_sha1.NATIVE.o obj/cpu_sha256.NATIVE.o obj/data.NATIVE.o obj/ext_OpenCL.NATIVE.o obj/hwmon.NATIVE.o obj/interface.NATIVE.o obj/logfile.NATIVE.o obj/logging.NATIVE.o obj/memory.NATIVE.o obj/mpsp.NATIVE.o obj/rp_cpu.NATIVE.o obj/rp_kernel_on_cpu.NATIVE.o obj/shared.NATIVE.o obj/terminal.NATIVE.o obj/usage.NATIVE.o
NATIVE_OBJS := obj/dictstat.NATIVE.o obj/wordlist.NATIVE.o obj/stdout.NATIVE.o obj/filenames.NATIVE.o obj/hlfmt.NATIVE.o obj/status.NATIVE.o obj/restore.NATIVE.o obj/bitmap.NATIVE.o obj/opencl.NATIVE.o obj/affinity.NATIVE.o obj/filehandling.NATIVE.o obj/tuningdb.NATIVE.o obj/locking.NATIVE.o obj/folder.NATIVE.o obj/bitops.NATIVE.o obj/convert.NATIVE.o obj/cpu_aes.NATIVE.o obj/cpu_crc32.NATIVE.o obj/cpu_des.NATIVE.o obj/cpu_md5.NATIVE.o obj/cpu_sha1.NATIVE.o obj/cpu_sha256.NATIVE.o obj/data.NATIVE.o obj/ext_OpenCL.NATIVE.o obj/hwmon.NATIVE.o obj/interface.NATIVE.o obj/logfile.NATIVE.o obj/logging.NATIVE.o obj/memory.NATIVE.o obj/mpsp.NATIVE.o obj/rp_cpu.NATIVE.o obj/rp_kernel_on_cpu.NATIVE.o obj/shared.NATIVE.o obj/terminal.NATIVE.o obj/usage.NATIVE.o
ifeq ($(UNAME),Linux)
NATIVE_OBJS += obj/ext_ADL.NATIVE.o
@ -175,8 +175,8 @@ NATIVE_OBJS += obj/ext_nvml.NATIVE.o
NATIVE_OBJS += obj/ext_xnvctrl.NATIVE.o
endif
LINUX_32_OBJS := obj/wordlist.LINUX.32.o obj/stdout.LINUX.32.o obj/filenames.LINUX.32.o obj/hlfmt.LINUX.32.o obj/status.LINUX.32.o obj/restore.LINUX.32.o obj/bitmap.LINUX.32.o obj/opencl.LINUX.32.o obj/affinity.LINUX.32.o obj/filehandling.LINUX.32.o obj/tuningdb.LINUX.32.o obj/locking.LINUX.32.o obj/folder.LINUX.32.o obj/bitops.LINUX.32.o obj/convert.LINUX.32.o obj/cpu_aes.LINUX.32.o obj/cpu_crc32.LINUX.32.o obj/cpu_des.LINUX.32.o obj/cpu_md5.LINUX.32.o obj/cpu_sha1.LINUX.32.o obj/cpu_sha256.LINUX.32.o obj/data.LINUX.32.o obj/ext_ADL.LINUX.32.o obj/ext_nvapi.LINUX.32.o obj/ext_nvml.LINUX.32.o obj/ext_OpenCL.LINUX.32.o obj/ext_xnvctrl.LINUX.32.o obj/hwmon.LINUX.32.o obj/interface.LINUX.32.o obj/logfile.LINUX.32.o obj/logging.LINUX.32.o obj/memory.LINUX.32.o obj/mpsp.LINUX.32.o obj/rp_cpu.LINUX.32.o obj/rp_kernel_on_cpu.LINUX.32.o obj/shared.LINUX.32.o obj/terminal.LINUX.32.o obj/usage.LINUX.32.o
LINUX_64_OBJS := obj/wordlist.LINUX.64.o obj/stdout.LINUX.64.o obj/filenames.LINUX.64.o obj/hlfmt.LINUX.64.o obj/status.LINUX.64.o obj/restore.LINUX.64.o obj/bitmap.LINUX.64.o obj/opencl.LINUX.64.o obj/affinity.LINUX.64.o obj/filehandling.LINUX.64.o obj/tuningdb.LINUX.64.o obj/locking.LINUX.64.o obj/folder.LINUX.64.o obj/bitops.LINUX.64.o obj/convert.LINUX.64.o obj/cpu_aes.LINUX.64.o obj/cpu_crc32.LINUX.64.o obj/cpu_des.LINUX.64.o obj/cpu_md5.LINUX.64.o obj/cpu_sha1.LINUX.64.o obj/cpu_sha256.LINUX.64.o obj/data.LINUX.64.o obj/ext_ADL.LINUX.64.o obj/ext_nvapi.LINUX.64.o obj/ext_nvml.LINUX.64.o obj/ext_OpenCL.LINUX.64.o obj/ext_xnvctrl.LINUX.64.o obj/hwmon.LINUX.64.o obj/interface.LINUX.64.o obj/logfile.LINUX.64.o obj/logging.LINUX.64.o obj/memory.LINUX.64.o obj/mpsp.LINUX.64.o obj/rp_cpu.LINUX.64.o obj/rp_kernel_on_cpu.LINUX.64.o obj/shared.LINUX.64.o obj/terminal.LINUX.64.o obj/usage.LINUX.64.o
LINUX_32_OBJS := obj/dictstat.LINUX.32.o obj/wordlist.LINUX.32.o obj/stdout.LINUX.32.o obj/filenames.LINUX.32.o obj/hlfmt.LINUX.32.o obj/status.LINUX.32.o obj/restore.LINUX.32.o obj/bitmap.LINUX.32.o obj/opencl.LINUX.32.o obj/affinity.LINUX.32.o obj/filehandling.LINUX.32.o obj/tuningdb.LINUX.32.o obj/locking.LINUX.32.o obj/folder.LINUX.32.o obj/bitops.LINUX.32.o obj/convert.LINUX.32.o obj/cpu_aes.LINUX.32.o obj/cpu_crc32.LINUX.32.o obj/cpu_des.LINUX.32.o obj/cpu_md5.LINUX.32.o obj/cpu_sha1.LINUX.32.o obj/cpu_sha256.LINUX.32.o obj/data.LINUX.32.o obj/ext_ADL.LINUX.32.o obj/ext_nvapi.LINUX.32.o obj/ext_nvml.LINUX.32.o obj/ext_OpenCL.LINUX.32.o obj/ext_xnvctrl.LINUX.32.o obj/hwmon.LINUX.32.o obj/interface.LINUX.32.o obj/logfile.LINUX.32.o obj/logging.LINUX.32.o obj/memory.LINUX.32.o obj/mpsp.LINUX.32.o obj/rp_cpu.LINUX.32.o obj/rp_kernel_on_cpu.LINUX.32.o obj/shared.LINUX.32.o obj/terminal.LINUX.32.o obj/usage.LINUX.32.o
LINUX_64_OBJS := obj/dictstat.LINUX.64.o obj/wordlist.LINUX.64.o obj/stdout.LINUX.64.o obj/filenames.LINUX.64.o obj/hlfmt.LINUX.64.o obj/status.LINUX.64.o obj/restore.LINUX.64.o obj/bitmap.LINUX.64.o obj/opencl.LINUX.64.o obj/affinity.LINUX.64.o obj/filehandling.LINUX.64.o obj/tuningdb.LINUX.64.o obj/locking.LINUX.64.o obj/folder.LINUX.64.o obj/bitops.LINUX.64.o obj/convert.LINUX.64.o obj/cpu_aes.LINUX.64.o obj/cpu_crc32.LINUX.64.o obj/cpu_des.LINUX.64.o obj/cpu_md5.LINUX.64.o obj/cpu_sha1.LINUX.64.o obj/cpu_sha256.LINUX.64.o obj/data.LINUX.64.o obj/ext_ADL.LINUX.64.o obj/ext_nvapi.LINUX.64.o obj/ext_nvml.LINUX.64.o obj/ext_OpenCL.LINUX.64.o obj/ext_xnvctrl.LINUX.64.o obj/hwmon.LINUX.64.o obj/interface.LINUX.64.o obj/logfile.LINUX.64.o obj/logging.LINUX.64.o obj/memory.LINUX.64.o obj/mpsp.LINUX.64.o obj/rp_cpu.LINUX.64.o obj/rp_kernel_on_cpu.LINUX.64.o obj/shared.LINUX.64.o obj/terminal.LINUX.64.o obj/usage.LINUX.64.o
# Windows CRT file globbing:
@ -186,8 +186,8 @@ CRT_GLOB_INCLUDE_FOLDER := $(dir $(lastword $(MAKEFILE_LIST)))
include $(CRT_GLOB_INCLUDE_FOLDER)/win_file_globbing.mk
WIN_32_OBJS := obj/wordlist.WIN.32.o obj/stdout.WIN.32.o obj/filenames.WIN.32.o obj/hlfmt.WIN.32.o obj/status.WIN.32.o obj/restore.WIN.32.o obj/bitmap.WIN.32.o obj/opencl.WIN.32.o obj/affinity.WIN.32.o obj/filehandling.WIN.32.o obj/tuningdb.WIN.32.o obj/locking.WIN.32.o obj/folder.WIN.32.o obj/bitops.WIN.32.o obj/convert.WIN.32.o obj/cpu_aes.WIN.32.o obj/cpu_crc32.WIN.32.o obj/cpu_des.WIN.32.o obj/cpu_md5.WIN.32.o obj/cpu_sha1.WIN.32.o obj/cpu_sha256.WIN.32.o obj/data.WIN.32.o obj/ext_ADL.WIN.32.o obj/ext_nvapi.WIN.32.o obj/ext_nvml.WIN.32.o obj/ext_OpenCL.WIN.32.o obj/ext_xnvctrl.WIN.32.o obj/hwmon.WIN.32.o obj/interface.WIN.32.o obj/logfile.WIN.32.o obj/logging.WIN.32.o obj/memory.WIN.32.o obj/mpsp.WIN.32.o obj/rp_cpu.WIN.32.o obj/rp_kernel_on_cpu.WIN.32.o obj/shared.WIN.32.o obj/terminal.WIN.32.o obj/usage.WIN.32.o $(CRT_GLOB_32)
WIN_64_OBJS := obj/wordlist.WIN.64.o obj/stdout.WIN.64.o obj/filenames.WIN.64.o obj/hlfmt.WIN.64.o obj/status.WIN.64.o obj/restore.WIN.64.o obj/bitmap.WIN.64.o obj/opencl.WIN.64.o obj/affinity.WIN.64.o obj/filehandling.WIN.64.o obj/tuningdb.WIN.64.o obj/locking.WIN.64.o obj/folder.WIN.64.o obj/bitops.WIN.64.o obj/convert.WIN.64.o obj/cpu_aes.WIN.64.o obj/cpu_crc32.WIN.64.o obj/cpu_des.WIN.64.o obj/cpu_md5.WIN.64.o obj/cpu_sha1.WIN.64.o obj/cpu_sha256.WIN.64.o obj/data.WIN.64.o obj/ext_ADL.WIN.64.o obj/ext_nvapi.WIN.64.o obj/ext_nvml.WIN.64.o obj/ext_OpenCL.WIN.64.o obj/ext_xnvctrl.WIN.64.o obj/hwmon.WIN.64.o obj/interface.WIN.64.o obj/logfile.WIN.64.o obj/logging.WIN.64.o obj/memory.WIN.64.o obj/mpsp.WIN.64.o obj/rp_cpu.WIN.64.o obj/rp_kernel_on_cpu.WIN.64.o obj/shared.WIN.64.o obj/terminal.WIN.64.o obj/usage.WIN.64.o $(CRT_GLOB_64)
WIN_32_OBJS := obj/dictstat.WIN.32.o obj/wordlist.WIN.32.o obj/stdout.WIN.32.o obj/filenames.WIN.32.o obj/hlfmt.WIN.32.o obj/status.WIN.32.o obj/restore.WIN.32.o obj/bitmap.WIN.32.o obj/opencl.WIN.32.o obj/affinity.WIN.32.o obj/filehandling.WIN.32.o obj/tuningdb.WIN.32.o obj/locking.WIN.32.o obj/folder.WIN.32.o obj/bitops.WIN.32.o obj/convert.WIN.32.o obj/cpu_aes.WIN.32.o obj/cpu_crc32.WIN.32.o obj/cpu_des.WIN.32.o obj/cpu_md5.WIN.32.o obj/cpu_sha1.WIN.32.o obj/cpu_sha256.WIN.32.o obj/data.WIN.32.o obj/ext_ADL.WIN.32.o obj/ext_nvapi.WIN.32.o obj/ext_nvml.WIN.32.o obj/ext_OpenCL.WIN.32.o obj/ext_xnvctrl.WIN.32.o obj/hwmon.WIN.32.o obj/interface.WIN.32.o obj/logfile.WIN.32.o obj/logging.WIN.32.o obj/memory.WIN.32.o obj/mpsp.WIN.32.o obj/rp_cpu.WIN.32.o obj/rp_kernel_on_cpu.WIN.32.o obj/shared.WIN.32.o obj/terminal.WIN.32.o obj/usage.WIN.32.o $(CRT_GLOB_32)
WIN_64_OBJS := obj/dictstat.WIN.64.o obj/wordlist.WIN.64.o obj/stdout.WIN.64.o obj/filenames.WIN.64.o obj/hlfmt.WIN.64.o obj/status.WIN.64.o obj/restore.WIN.64.o obj/bitmap.WIN.64.o obj/opencl.WIN.64.o obj/affinity.WIN.64.o obj/filehandling.WIN.64.o obj/tuningdb.WIN.64.o obj/locking.WIN.64.o obj/folder.WIN.64.o obj/bitops.WIN.64.o obj/convert.WIN.64.o obj/cpu_aes.WIN.64.o obj/cpu_crc32.WIN.64.o obj/cpu_des.WIN.64.o obj/cpu_md5.WIN.64.o obj/cpu_sha1.WIN.64.o obj/cpu_sha256.WIN.64.o obj/data.WIN.64.o obj/ext_ADL.WIN.64.o obj/ext_nvapi.WIN.64.o obj/ext_nvml.WIN.64.o obj/ext_OpenCL.WIN.64.o obj/ext_xnvctrl.WIN.64.o obj/hwmon.WIN.64.o obj/interface.WIN.64.o obj/logfile.WIN.64.o obj/logging.WIN.64.o obj/memory.WIN.64.o obj/mpsp.WIN.64.o obj/rp_cpu.WIN.64.o obj/rp_kernel_on_cpu.WIN.64.o obj/shared.WIN.64.o obj/terminal.WIN.64.o obj/usage.WIN.64.o $(CRT_GLOB_64)
##
## Targets: Global

View File

@ -8,6 +8,11 @@
#include "types.h"
#include "filenames.h"
void generate_dictstat_filename (char *profile_dir, char *dictstat_filename)
{
snprintf (dictstat_filename, HCBUFSIZ_TINY - 1, "%s/hashcat.dictstat", profile_dir);
}
void generate_source_kernel_filename (const uint attack_exec, const uint attack_kern, const uint kern_type, char *shared_dir, char *source_file)
{
if (attack_exec == ATTACK_EXEC_INSIDE_KERNEL)

View File

@ -69,6 +69,7 @@
#include "filenames.h"
#include "stdout.h"
#include "wordlist.h"
#include "dictstat.h"
extern hc_global_data_t data;
@ -182,13 +183,13 @@ static const char OPTI_STR_USES_BITS_64[] = "Uses-64-Bit";
#define OUTFILES_DIR "outfiles"
#define LOOPBACK_FILE "hashcat.loopback"
#define DICTSTAT_FILENAME "hashcat.dictstat"
#define POTFILE_FILENAME "hashcat.pot"
#define MAX_CUT_TRIES 4
#define MAX_DICTSTAT 10000
#define NUM_DEFAULT_BENCHMARK_ALGORITHMS 146
@ -582,19 +583,7 @@ int sort_by_stringptr (const void *p1, const void *p2)
return strcmp (*s1, *s2);
}
int sort_by_dictstat (const void *s1, const void *s2)
{
dictstat_t *d1 = (dictstat_t *) s1;
dictstat_t *d2 = (dictstat_t *) s2;
#if defined (__linux__)
d2->stat.st_atim = d1->stat.st_atim;
#else
d2->stat.st_atime = d1->stat.st_atime;
#endif
return memcmp (&d1->stat, &d2->stat, sizeof (struct stat));
}
int sort_by_digest_4_2 (const void *v1, const void *v2)
@ -10610,15 +10599,15 @@ int main (int argc, char **argv)
uint dictstat_nmemb = 0;
#endif
char dictstat[256] = { 0 };
char dictstat_filename[HCBUFSIZ_TINY];
FILE *dictstat_fp = NULL;
if (keyspace == 0)
{
snprintf (dictstat, sizeof (dictstat) - 1, "%s/%s", profile_dir, DICTSTAT_FILENAME);
generate_dictstat_filename (profile_dir, dictstat_filename);
dictstat_fp = fopen (dictstat, "rb");
dictstat_fp = fopen (dictstat_filename, "rb");
if (dictstat_fp)
{
@ -10641,7 +10630,7 @@ int main (int argc, char **argv)
fclose (dictstat_fp);
unlink (dictstat);
unlink (dictstat_filename);
}
else
{
@ -10655,7 +10644,7 @@ int main (int argc, char **argv)
if (dictstat_nmemb == (MAX_DICTSTAT - 1000))
{
log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat);
log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat_filename);
return -1;
}
@ -18254,7 +18243,7 @@ int main (int argc, char **argv)
if (keyspace == 0)
{
dictstat_fp = fopen (dictstat, "wb");
dictstat_fp = fopen (dictstat_filename, "wb");
if (dictstat_fp)
{