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

Move logfile() specific functions into their own source file

This commit is contained in:
jsteube 2016-09-06 13:05:49 +02:00
parent 305aa38b0e
commit eb5e192df5
4 changed files with 6 additions and 86 deletions

View File

@ -203,10 +203,6 @@ char *stroptitype (const uint opti_type);
char *strstatus (const uint threads_status);
void status ();
char *logfile_generate_topid (void);
char *logfile_generate_subid (void);
void logfile_append (const char *fmt, ...);
#ifdef F_SETLKW
void lock_file (FILE *fp);
void unlock_file (FILE *fp);

View File

@ -165,7 +165,7 @@ LFLAGS_CROSS_WIN := -lpsapi
## Objects
##
NATIVE_OBJS := obj/data.NATIVE.o obj/convert.NATIVE.o obj/memory.NATIVE.o obj/logging.NATIVE.o obj/cpu_aes.NATIVE.o obj/cpu_des.NATIVE.o obj/cpu_md5.NATIVE.o obj/cpu_sha1.NATIVE.o obj/cpu_sha256.NATIVE.o obj/bitops.NATIVE.o obj/bitops.NATIVE.o obj/ext_OpenCL.NATIVE.o obj/shared.NATIVE.o obj/rp_kernel_on_cpu.NATIVE.o obj/interface.NATIVE.o
NATIVE_OBJS := obj/logfile.NATIVE.o obj/data.NATIVE.o obj/convert.NATIVE.o obj/memory.NATIVE.o obj/logging.NATIVE.o obj/cpu_aes.NATIVE.o obj/cpu_des.NATIVE.o obj/cpu_md5.NATIVE.o obj/cpu_sha1.NATIVE.o obj/cpu_sha256.NATIVE.o obj/bitops.NATIVE.o obj/bitops.NATIVE.o obj/ext_OpenCL.NATIVE.o obj/shared.NATIVE.o obj/rp_kernel_on_cpu.NATIVE.o obj/interface.NATIVE.o
ifeq ($(UNAME),Linux)
NATIVE_OBJS += obj/ext_ADL.NATIVE.o
@ -174,8 +174,8 @@ NATIVE_OBJS += obj/ext_nvml.NATIVE.o
NATIVE_OBJS += obj/ext_xnvctrl.NATIVE.o
endif
LINUX_32_OBJS := obj/data.LINUX.32.o obj/convert.LINUX.32.o obj/memory.LINUX.32.o obj/logging.LINUX.32.o obj/cpu_aes.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/bitops.LINUX.32.o obj/ext_OpenCL.LINUX.32.o obj/shared.LINUX.32.o obj/rp_kernel_on_cpu.LINUX.32.o obj/ext_ADL.LINUX.32.o obj/ext_nvml.LINUX.32.o obj/ext_nvapi.LINUX.32.o obj/ext_xnvctrl.LINUX.32.o obj/interface.LINUX.32.o
LINUX_64_OBJS := obj/data.LINUX.64.o obj/convert.LINUX.64.o obj/memory.LINUX.64.o obj/logging.LINUX.64.o obj/cpu_aes.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/bitops.LINUX.64.o obj/ext_OpenCL.LINUX.64.o obj/shared.LINUX.64.o obj/rp_kernel_on_cpu.LINUX.64.o obj/ext_ADL.LINUX.64.o obj/ext_nvml.LINUX.64.o obj/ext_nvapi.LINUX.64.o obj/ext_xnvctrl.LINUX.64.o obj/interface.LINUX.64.o
LINUX_32_OBJS := obj/logfile.LINUX.32.o obj/data.LINUX.32.o obj/convert.LINUX.32.o obj/memory.LINUX.32.o obj/logging.LINUX.32.o obj/cpu_aes.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/bitops.LINUX.32.o obj/ext_OpenCL.LINUX.32.o obj/shared.LINUX.32.o obj/rp_kernel_on_cpu.LINUX.32.o obj/ext_ADL.LINUX.32.o obj/ext_nvml.LINUX.32.o obj/ext_nvapi.LINUX.32.o obj/ext_xnvctrl.LINUX.32.o obj/interface.LINUX.32.o
LINUX_64_OBJS := obj/logfile.LINUX.64.o obj/data.LINUX.64.o obj/convert.LINUX.64.o obj/memory.LINUX.64.o obj/logging.LINUX.64.o obj/cpu_aes.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/bitops.LINUX.64.o obj/ext_OpenCL.LINUX.64.o obj/shared.LINUX.64.o obj/rp_kernel_on_cpu.LINUX.64.o obj/ext_ADL.LINUX.64.o obj/ext_nvml.LINUX.64.o obj/ext_nvapi.LINUX.64.o obj/ext_xnvctrl.LINUX.64.o obj/interface.LINUX.64.o
# Windows CRT file globbing:
@ -185,8 +185,8 @@ CRT_GLOB_INCLUDE_FOLDER := $(dir $(lastword $(MAKEFILE_LIST)))
include $(CRT_GLOB_INCLUDE_FOLDER)/win_file_globbing.mk
WIN_32_OBJS := obj/data.WIN.32.o obj/convert.WIN.32.o obj/memory.WIN.32.o obj/logging.WIN.32.o obj/cpu_aes.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/bitops.WIN.32.o obj/ext_OpenCL.WIN.32.o obj/shared.WIN.32.o obj/rp_kernel_on_cpu.WIN.32.o obj/ext_ADL.WIN.32.o obj/ext_nvml.WIN.32.o obj/ext_nvapi.WIN.32.o obj/ext_xnvctrl.WIN.32.o obj/interface.WIN.32.o $(CRT_GLOB_32)
WIN_64_OBJS := obj/data.WIN.64.o obj/convert.WIN.64.o obj/memory.WIN.64.o obj/logging.WIN.64.o obj/cpu_aes.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/bitops.WIN.64.o obj/ext_OpenCL.WIN.64.o obj/shared.WIN.64.o obj/rp_kernel_on_cpu.WIN.64.o obj/ext_ADL.WIN.64.o obj/ext_nvml.WIN.64.o obj/ext_nvapi.WIN.64.o obj/ext_xnvctrl.WIN.64.o obj/interface.WIN.64.o $(CRT_GLOB_64)
WIN_32_OBJS := obj/logfile.WIN.32.o obj/data.WIN.32.o obj/convert.WIN.32.o obj/memory.WIN.32.o obj/logging.WIN.32.o obj/cpu_aes.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/bitops.WIN.32.o obj/ext_OpenCL.WIN.32.o obj/shared.WIN.32.o obj/rp_kernel_on_cpu.WIN.32.o obj/ext_ADL.WIN.32.o obj/ext_nvml.WIN.32.o obj/ext_nvapi.WIN.32.o obj/ext_xnvctrl.WIN.32.o obj/interface.WIN.32.o $(CRT_GLOB_32)
WIN_64_OBJS := obj/logfile.WIN.64.o obj/data.WIN.64.o obj/convert.WIN.64.o obj/memory.WIN.64.o obj/logging.WIN.64.o obj/cpu_aes.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/bitops.WIN.64.o obj/ext_OpenCL.WIN.64.o obj/shared.WIN.64.o obj/rp_kernel_on_cpu.WIN.64.o obj/ext_ADL.WIN.64.o obj/ext_nvml.WIN.64.o obj/ext_nvapi.WIN.64.o obj/ext_xnvctrl.WIN.64.o obj/interface.WIN.64.o $(CRT_GLOB_64)
##
## Targets: Global

View File

@ -12,6 +12,7 @@
#include "memory.h"
#include "convert.h"
#include "logging.h"
#include "logfile.h"
#include "ext_OpenCL.h"
#include "ext_ADL.h"
#include "ext_nvapi.h"

View File

@ -190,83 +190,6 @@ static int tty_fix()
}
#endif
/**
* logfile
*/
static FILE *logfile_open (char *logfile)
{
FILE *fp = fopen (logfile, "ab");
if (fp == NULL)
{
fp = stdout;
}
return fp;
}
static void logfile_close (FILE *fp)
{
if (fp == stdout) return;
fclose (fp);
}
void logfile_append (const char *fmt, ...)
{
if (data.logfile_disable == 1) return;
FILE *fp = logfile_open (data.logfile);
va_list ap;
va_start (ap, fmt);
vfprintf (fp, fmt, ap);
va_end (ap);
fputc ('\n', fp);
fflush (fp);
logfile_close (fp);
}
static int logfile_generate_id ()
{
const int n = rand ();
time_t t;
time (&t);
return t + n;
}
char *logfile_generate_topid ()
{
const int id = logfile_generate_id ();
char *topid = (char *) mymalloc (1 + 16 + 1);
snprintf (topid, 1 + 16, "TOP%08x", id);
return topid;
}
char *logfile_generate_subid ()
{
const int id = logfile_generate_id ();
char *subid = (char *) mymalloc (1 + 16 + 1);
snprintf (subid, 1 + 16, "SUB%08x", id);
return subid;
}
/**
* system
*/