mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 16:18:09 +00:00
Move status specific functions into their own source file
This commit is contained in:
parent
9eb47153d4
commit
51a059a606
@ -48,6 +48,12 @@
|
||||
#define __stdcall
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32) || defined (__WIN32__) || defined (__CYGWIN__)
|
||||
#define HC_API_CALL __stdcall
|
||||
#else
|
||||
#define HC_API_CALL
|
||||
#endif
|
||||
|
||||
#if defined (_WIN)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
@ -356,6 +356,8 @@ typedef hm_adl_lib_t ADL_PTR;
|
||||
int adl_init (ADL_PTR *lib);
|
||||
void adl_close (ADL_PTR *lib);
|
||||
|
||||
void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize);
|
||||
|
||||
int hm_ADL_Main_Control_Destroy (ADL_PTR *adl);
|
||||
int hm_ADL_Main_Control_Create (ADL_PTR *adl, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters);
|
||||
int hm_ADL_Adapter_NumberOfAdapters_Get (ADL_PTR *adl, int *lpNumAdapters);
|
||||
|
@ -61,16 +61,14 @@
|
||||
|
||||
extern const char *PROMPT;
|
||||
|
||||
extern hc_thread_mutex_t mux_display;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* functions
|
||||
*/
|
||||
|
||||
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries);
|
||||
|
||||
void *rulefind (const void *key, void *base, int nmemb, size_t size, int (*compar) (const void *, const void *));
|
||||
|
||||
int sort_by_u32 (const void *p1, const void *p2);
|
||||
@ -134,7 +132,7 @@ void naive_escape (char *s, size_t s_max, const u8 key_char, const u8 escape_cha
|
||||
|
||||
|
||||
|
||||
void check_checkpoint (void);
|
||||
void check_checkpoint (void);
|
||||
|
||||
#if defined (_WIN)
|
||||
|
||||
@ -150,11 +148,5 @@ void hc_signal (void c (int));
|
||||
|
||||
#endif
|
||||
|
||||
void *thread_device_watch (void *p);
|
||||
void *thread_keypress (void *p);
|
||||
void *thread_runtime (void *p);
|
||||
|
||||
void status_display (void);
|
||||
void status_display_machine_readable (void);
|
||||
|
||||
#endif // _SHARED_H
|
||||
|
42
include/status.h
Normal file
42
include/status.h
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Author......: Jens Steube <jens.steube@gmail.com>
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifndef _STATUS_H
|
||||
#define _STATUS_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define STATUS 0
|
||||
#define STATUS_TIMER 10
|
||||
|
||||
typedef enum status_rc
|
||||
{
|
||||
STATUS_STARTING = 0,
|
||||
STATUS_INIT = 1,
|
||||
STATUS_RUNNING = 2,
|
||||
STATUS_PAUSED = 3,
|
||||
STATUS_EXHAUSTED = 4,
|
||||
STATUS_CRACKED = 5,
|
||||
STATUS_ABORTED = 6,
|
||||
STATUS_QUIT = 7,
|
||||
STATUS_BYPASS = 8,
|
||||
STATUS_STOP_AT_CHECKPOINT = 9,
|
||||
STATUS_AUTOTUNE = 10
|
||||
|
||||
} status_rc_t;
|
||||
|
||||
char *strstatus (const uint devices_status);
|
||||
|
||||
void status_display_machine_readable ();
|
||||
|
||||
void status_display ();
|
||||
|
||||
void status_benchmark_automate ();
|
||||
|
||||
void status_benchmark ();
|
||||
|
||||
|
||||
#endif // _STATUS_H
|
@ -24,6 +24,10 @@
|
||||
#include <windows.h>
|
||||
#endif // _WIN
|
||||
|
||||
#if defined (_WIN)
|
||||
void SetConsoleWindowSize (const int x);
|
||||
#endif
|
||||
|
||||
int tty_break();
|
||||
int tty_getchar();
|
||||
int tty_fix();
|
||||
|
102
include/types.h
102
include/types.h
@ -23,6 +23,94 @@
|
||||
* Outfile formats
|
||||
*/
|
||||
|
||||
|
||||
typedef enum wl_mode
|
||||
{
|
||||
WL_MODE_STDIN = 1,
|
||||
WL_MODE_FILE = 2,
|
||||
WL_MODE_MASK = 3
|
||||
|
||||
} wl_mode_t;
|
||||
|
||||
typedef enum hl_mode
|
||||
{
|
||||
HL_MODE_FILE = 4,
|
||||
HL_MODE_ARG = 5
|
||||
|
||||
} hl_mode_t;
|
||||
|
||||
#define HLFMTS_CNT 11
|
||||
|
||||
typedef enum hlfmt_name
|
||||
{
|
||||
HLFMT_HASHCAT = 0,
|
||||
HLFMT_PWDUMP = 1,
|
||||
HLFMT_PASSWD = 2,
|
||||
HLFMT_SHADOW = 3,
|
||||
HLFMT_DCC = 4,
|
||||
HLFMT_DCC2 = 5,
|
||||
HLFMT_NETNTLM1 = 7,
|
||||
HLFMT_NETNTLM2 = 8,
|
||||
HLFMT_NSLDAP = 9,
|
||||
HLFMT_NSLDAPS = 10
|
||||
|
||||
} hlfmt_name_t;
|
||||
|
||||
typedef enum attack_mode
|
||||
{
|
||||
ATTACK_MODE_STRAIGHT = 0,
|
||||
ATTACK_MODE_COMBI = 1,
|
||||
ATTACK_MODE_TOGGLE = 2,
|
||||
ATTACK_MODE_BF = 3,
|
||||
ATTACK_MODE_PERM = 4,
|
||||
ATTACK_MODE_TABLE = 5,
|
||||
ATTACK_MODE_HYBRID1 = 6,
|
||||
ATTACK_MODE_HYBRID2 = 7,
|
||||
ATTACK_MODE_NONE = 100
|
||||
|
||||
} attack_mode_t;
|
||||
|
||||
typedef enum attack_kern
|
||||
{
|
||||
ATTACK_KERN_STRAIGHT = 0,
|
||||
ATTACK_KERN_COMBI = 1,
|
||||
ATTACK_KERN_BF = 3,
|
||||
ATTACK_KERN_NONE = 100
|
||||
|
||||
} attack_kern_t;
|
||||
|
||||
typedef enum attack_exec
|
||||
{
|
||||
ATTACK_EXEC_OUTSIDE_KERNEL = 10,
|
||||
ATTACK_EXEC_INSIDE_KERNEL = 11
|
||||
|
||||
} attack_exec_t;
|
||||
|
||||
typedef enum combinator_mode
|
||||
{
|
||||
COMBINATOR_MODE_BASE_LEFT = 10001,
|
||||
COMBINATOR_MODE_BASE_RIGHT = 10002
|
||||
|
||||
} combinator_mode_t;
|
||||
|
||||
typedef enum kern_run
|
||||
{
|
||||
KERN_RUN_1 = 1000,
|
||||
KERN_RUN_12 = 1500,
|
||||
KERN_RUN_2 = 2000,
|
||||
KERN_RUN_23 = 2500,
|
||||
KERN_RUN_3 = 3000
|
||||
|
||||
} kern_run_t;
|
||||
|
||||
typedef enum kern_run_mp
|
||||
{
|
||||
KERN_RUN_MP = 101,
|
||||
KERN_RUN_MP_L = 102,
|
||||
KERN_RUN_MP_R = 103
|
||||
|
||||
} kern_run_mp_t;
|
||||
|
||||
typedef enum outfile_fmt
|
||||
{
|
||||
OUTFILE_FMT_HASH = (1 << 0),
|
||||
@ -134,21 +222,7 @@ typedef enum dgst_size
|
||||
* status
|
||||
*/
|
||||
|
||||
typedef enum status_rc
|
||||
{
|
||||
STATUS_STARTING = 0,
|
||||
STATUS_INIT = 1,
|
||||
STATUS_RUNNING = 2,
|
||||
STATUS_PAUSED = 3,
|
||||
STATUS_EXHAUSTED = 4,
|
||||
STATUS_CRACKED = 5,
|
||||
STATUS_ABORTED = 6,
|
||||
STATUS_QUIT = 7,
|
||||
STATUS_BYPASS = 8,
|
||||
STATUS_STOP_AT_CHECKPOINT = 9,
|
||||
STATUS_AUTOTUNE = 10
|
||||
|
||||
} status_rc_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
10
src/Makefile
10
src/Makefile
@ -166,7 +166,7 @@ LFLAGS_CROSS_WIN := -lpsapi
|
||||
## Objects
|
||||
##
|
||||
|
||||
NATIVE_OBJS := 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/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/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/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/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/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/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/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/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/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
|
||||
|
@ -83,6 +83,11 @@ void adl_close (ADL_PTR *adl)
|
||||
}
|
||||
}
|
||||
|
||||
void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize)
|
||||
{
|
||||
return mymalloc (iSize);
|
||||
}
|
||||
|
||||
int hm_ADL_Main_Control_Destroy (ADL_PTR *adl)
|
||||
{
|
||||
if (!adl) return -1;
|
||||
|
1527
src/hashcat.c
1527
src/hashcat.c
File diff suppressed because it is too large
Load Diff
@ -21,10 +21,13 @@
|
||||
#include "rp_cpu.h"
|
||||
#include "restore.h"
|
||||
#include "opencl.h"
|
||||
#include "thread.h"
|
||||
#include "data.h"
|
||||
|
||||
#if defined (HAVE_HWMON)
|
||||
|
||||
hc_thread_mutex_t mux_hwmon;
|
||||
|
||||
extern hc_global_data_t data;
|
||||
|
||||
int get_adapters_num_adl (void *adl, int *iNumberAdapters)
|
||||
|
217
src/shared.c
217
src/shared.c
@ -25,16 +25,45 @@
|
||||
#include "locking.h"
|
||||
#include "thread.h"
|
||||
#include "rp_cpu.h"
|
||||
#include "terminal.h"
|
||||
#include "hwmon.h"
|
||||
#include "mpsp.h"
|
||||
#include "rp_cpu.h"
|
||||
#include "opencl.h"
|
||||
#include "restore.h"
|
||||
#include "data.h"
|
||||
#include "status.h"
|
||||
#include "shared.h"
|
||||
|
||||
extern hc_global_data_t data;
|
||||
extern hc_thread_mutex_t mux_display;
|
||||
|
||||
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries)
|
||||
{
|
||||
int exec_pos = (int) device_param->exec_pos - last_num_entries;
|
||||
|
||||
if (exec_pos < 0) exec_pos += EXEC_CACHE;
|
||||
|
||||
double exec_ms_sum = 0;
|
||||
|
||||
int exec_ms_cnt = 0;
|
||||
|
||||
for (int i = 0; i < last_num_entries; i++)
|
||||
{
|
||||
double exec_ms = device_param->exec_ms[(exec_pos + i) % EXEC_CACHE];
|
||||
|
||||
if (exec_ms > 0)
|
||||
{
|
||||
exec_ms_sum += exec_ms;
|
||||
|
||||
exec_ms_cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (exec_ms_cnt == 0) return 0;
|
||||
|
||||
return exec_ms_sum / exec_ms_cnt;
|
||||
}
|
||||
|
||||
|
||||
void *rulefind (const void *key, void *base, int nmemb, size_t size, int (*compar) (const void *, const void *))
|
||||
{
|
||||
@ -971,78 +1000,7 @@ void format_speed_display (double val, char *buf, size_t len)
|
||||
|
||||
|
||||
|
||||
static void SuspendThreads ()
|
||||
{
|
||||
if (data.devices_status != STATUS_RUNNING) return;
|
||||
|
||||
hc_timer_set (&data.timer_paused);
|
||||
|
||||
data.devices_status = STATUS_PAUSED;
|
||||
|
||||
log_info ("Paused");
|
||||
}
|
||||
|
||||
static void ResumeThreads ()
|
||||
{
|
||||
if (data.devices_status != STATUS_PAUSED) return;
|
||||
|
||||
double ms_paused;
|
||||
|
||||
hc_timer_get (data.timer_paused, ms_paused);
|
||||
|
||||
data.ms_paused += ms_paused;
|
||||
|
||||
data.devices_status = STATUS_RUNNING;
|
||||
|
||||
log_info ("Resumed");
|
||||
}
|
||||
|
||||
static void bypass ()
|
||||
{
|
||||
data.devices_status = STATUS_BYPASS;
|
||||
|
||||
log_info ("Next dictionary / mask in queue selected, bypassing current one");
|
||||
}
|
||||
|
||||
static void stop_at_checkpoint ()
|
||||
{
|
||||
if (data.devices_status != STATUS_STOP_AT_CHECKPOINT)
|
||||
{
|
||||
if (data.devices_status != STATUS_RUNNING) return;
|
||||
}
|
||||
|
||||
// this feature only makes sense if --restore-disable was not specified
|
||||
|
||||
if (data.restore_disable == 1)
|
||||
{
|
||||
log_info ("WARNING: This feature is disabled when --restore-disable is specified");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// check if monitoring of Restore Point updates should be enabled or disabled
|
||||
|
||||
if (data.devices_status != STATUS_STOP_AT_CHECKPOINT)
|
||||
{
|
||||
data.devices_status = STATUS_STOP_AT_CHECKPOINT;
|
||||
|
||||
// save the current restore point value
|
||||
|
||||
data.checkpoint_cur_words = get_lowest_words_done ();
|
||||
|
||||
log_info ("Checkpoint enabled: Will quit at next Restore Point update");
|
||||
}
|
||||
else
|
||||
{
|
||||
data.devices_status = STATUS_RUNNING;
|
||||
|
||||
// reset the global value for checkpoint checks
|
||||
|
||||
data.checkpoint_cur_words = 0;
|
||||
|
||||
log_info ("Checkpoint disabled: Restore Point updates will no longer be monitored");
|
||||
}
|
||||
}
|
||||
|
||||
void myabort ()
|
||||
{
|
||||
@ -1222,118 +1180,3 @@ void hc_signal (void (callback) (int))
|
||||
|
||||
#endif
|
||||
|
||||
void status_display ();
|
||||
|
||||
void *thread_keypress (void *p)
|
||||
{
|
||||
uint quiet = data.quiet;
|
||||
|
||||
tty_break();
|
||||
|
||||
while (data.shutdown_outer == 0)
|
||||
{
|
||||
int ch = tty_getchar();
|
||||
|
||||
if (ch == -1) break;
|
||||
|
||||
if (ch == 0) continue;
|
||||
|
||||
//https://github.com/hashcat/hashcat/issues/302
|
||||
//#if defined (_POSIX)
|
||||
//if (ch != '\n')
|
||||
//#endif
|
||||
|
||||
hc_thread_mutex_lock (mux_display);
|
||||
|
||||
log_info ("");
|
||||
|
||||
switch (ch)
|
||||
{
|
||||
case 's':
|
||||
case '\r':
|
||||
case '\n':
|
||||
|
||||
log_info ("");
|
||||
|
||||
status_display ();
|
||||
|
||||
log_info ("");
|
||||
|
||||
if (quiet == 0) fprintf (stdout, "%s", PROMPT);
|
||||
if (quiet == 0) fflush (stdout);
|
||||
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
|
||||
log_info ("");
|
||||
|
||||
bypass ();
|
||||
|
||||
log_info ("");
|
||||
|
||||
if (quiet == 0) fprintf (stdout, "%s", PROMPT);
|
||||
if (quiet == 0) fflush (stdout);
|
||||
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
|
||||
log_info ("");
|
||||
|
||||
SuspendThreads ();
|
||||
|
||||
log_info ("");
|
||||
|
||||
if (quiet == 0) fprintf (stdout, "%s", PROMPT);
|
||||
if (quiet == 0) fflush (stdout);
|
||||
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
|
||||
log_info ("");
|
||||
|
||||
ResumeThreads ();
|
||||
|
||||
log_info ("");
|
||||
|
||||
if (quiet == 0) fprintf (stdout, "%s", PROMPT);
|
||||
if (quiet == 0) fflush (stdout);
|
||||
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
|
||||
log_info ("");
|
||||
|
||||
stop_at_checkpoint ();
|
||||
|
||||
log_info ("");
|
||||
|
||||
if (quiet == 0) fprintf (stdout, "%s", PROMPT);
|
||||
if (quiet == 0) fflush (stdout);
|
||||
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
|
||||
log_info ("");
|
||||
|
||||
myabort ();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
//https://github.com/hashcat/hashcat/issues/302
|
||||
//#if defined (_POSIX)
|
||||
//if (ch != '\n')
|
||||
//#endif
|
||||
|
||||
hc_thread_mutex_unlock (mux_display);
|
||||
}
|
||||
|
||||
tty_fix();
|
||||
|
||||
return (p);
|
||||
}
|
||||
|
1175
src/status.c
Normal file
1175
src/status.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,32 @@
|
||||
#include "common.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#if defined (_WIN)
|
||||
void SetConsoleWindowSize (const int x)
|
||||
{
|
||||
HANDLE h = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||
|
||||
if (h == INVALID_HANDLE_VALUE) return;
|
||||
|
||||
CONSOLE_SCREEN_BUFFER_INFO bufferInfo;
|
||||
|
||||
if (!GetConsoleScreenBufferInfo (h, &bufferInfo)) return;
|
||||
|
||||
SMALL_RECT *sr = &bufferInfo.srWindow;
|
||||
|
||||
sr->Right = MAX (sr->Right, x - 1);
|
||||
|
||||
COORD co;
|
||||
|
||||
co.X = sr->Right + 1;
|
||||
co.Y = 9999;
|
||||
|
||||
if (!SetConsoleScreenBufferSize (h, co)) return;
|
||||
|
||||
if (!SetConsoleWindowInfo (h, TRUE, sr)) return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (__linux__)
|
||||
static struct termios savemodes;
|
||||
static int havemodes = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user