mirror of
https://github.com/hashcat/hashcat
synced 2024-11-02 20:39:22 +01:00
fixes #2271: added --brain-server-timer for scheduled backup time
This commit is contained in:
parent
74c1bf8195
commit
c826558b49
@ -7,7 +7,8 @@
|
||||
- Fully modularized hash-mode integration via plugin interface and conversion of all existing hash-modes
|
||||
- Refactor hashcat backend interface to allow adding compute API other than OpenCL
|
||||
- Added CUDA as a new compute API to hashcat backend (enables hashcat to run on NVIDIA Jetson, IBM POWER9 w/ Nvidia V100, etc.)
|
||||
- Added new options --backend-ignore-cuda and --backend-ingore-opencl, to ignore CUDA and/or OpenCL interface from being load on startup
|
||||
- Added new options --backend-ignore-cuda and --backend-ingore-opencl to ignore CUDA and/or OpenCL interface from being load on startup
|
||||
- Added new parameter --brain-server-timer to specify the seconds for the next scheduled backup
|
||||
- Support use of all available GPU memory using CUDA backend
|
||||
- Support use of all available CPU cores for hash-mode specific hooks
|
||||
- Support on-the-fly loading of compressed wordlists in zip and gzip format
|
||||
|
@ -173,6 +173,8 @@ typedef struct brain_server_dumper_options
|
||||
{
|
||||
brain_server_dbs_t *brain_server_dbs;
|
||||
|
||||
u32 brain_server_timer;
|
||||
|
||||
} brain_server_dumper_options_t;
|
||||
|
||||
typedef struct brain_server_client_options
|
||||
@ -211,7 +213,7 @@ bool brain_client_connect (hc_device_param_t *device_param, const
|
||||
void brain_client_disconnect (hc_device_param_t *device_param);
|
||||
void brain_client_generate_hash (u64 *hash, const char *line_buf, const size_t line_len);
|
||||
|
||||
int brain_server (const char *listen_host, const int listen_port, const char *brain_password, const char *brain_session_whitelist);
|
||||
int brain_server (const char *listen_host, const int listen_port, const char *brain_password, const char *brain_session_whitelist, const u32 brain_server_timer);
|
||||
bool brain_server_read_hash_dumps (brain_server_dbs_t *brain_server_dbs, const char *path);
|
||||
bool brain_server_write_hash_dumps (brain_server_dbs_t *brain_server_dbs, const char *path);
|
||||
bool brain_server_read_hash_dump (brain_server_db_hash_t *brain_server_db_hash, const char *file);
|
||||
|
131
include/types.h
131
include/types.h
@ -667,96 +667,97 @@ typedef enum user_options_map
|
||||
IDX_BRAIN_PASSWORD = 0xff09,
|
||||
IDX_BRAIN_PORT = 0xff0a,
|
||||
IDX_BRAIN_SERVER = 0xff0b,
|
||||
IDX_BRAIN_SESSION = 0xff0c,
|
||||
IDX_BRAIN_SESSION_WHITELIST = 0xff0d,
|
||||
IDX_BRAIN_SERVER_TIMER = 0xff0c,
|
||||
IDX_BRAIN_SESSION = 0xff0d,
|
||||
IDX_BRAIN_SESSION_WHITELIST = 0xff0e,
|
||||
#endif
|
||||
IDX_CPU_AFFINITY = 0xff0e,
|
||||
IDX_CPU_AFFINITY = 0xff0f,
|
||||
IDX_CUSTOM_CHARSET_1 = '1',
|
||||
IDX_CUSTOM_CHARSET_2 = '2',
|
||||
IDX_CUSTOM_CHARSET_3 = '3',
|
||||
IDX_CUSTOM_CHARSET_4 = '4',
|
||||
IDX_DEBUG_FILE = 0xff0f,
|
||||
IDX_DEBUG_MODE = 0xff10,
|
||||
IDX_ENCODING_FROM = 0xff11,
|
||||
IDX_ENCODING_TO = 0xff12,
|
||||
IDX_EXAMPLE_HASHES = 0xff13,
|
||||
IDX_FORCE = 0xff14,
|
||||
IDX_HWMON_DISABLE = 0xff15,
|
||||
IDX_HWMON_TEMP_ABORT = 0xff16,
|
||||
IDX_DEBUG_FILE = 0xff10,
|
||||
IDX_DEBUG_MODE = 0xff11,
|
||||
IDX_ENCODING_FROM = 0xff12,
|
||||
IDX_ENCODING_TO = 0xff13,
|
||||
IDX_EXAMPLE_HASHES = 0xff14,
|
||||
IDX_FORCE = 0xff15,
|
||||
IDX_HWMON_DISABLE = 0xff16,
|
||||
IDX_HWMON_TEMP_ABORT = 0xff17,
|
||||
IDX_HASH_MODE = 'm',
|
||||
IDX_HCCAPX_MESSAGE_PAIR = 0xff17,
|
||||
IDX_HCCAPX_MESSAGE_PAIR = 0xff18,
|
||||
IDX_HELP = 'h',
|
||||
IDX_HEX_CHARSET = 0xff18,
|
||||
IDX_HEX_SALT = 0xff19,
|
||||
IDX_HEX_WORDLIST = 0xff1a,
|
||||
IDX_HOOK_THREADS = 0xff1b,
|
||||
IDX_HEX_CHARSET = 0xff19,
|
||||
IDX_HEX_SALT = 0xff1a,
|
||||
IDX_HEX_WORDLIST = 0xff1b,
|
||||
IDX_HOOK_THREADS = 0xff1c,
|
||||
IDX_INCREMENT = 'i',
|
||||
IDX_INCREMENT_MAX = 0xff1c,
|
||||
IDX_INCREMENT_MIN = 0xff1d,
|
||||
IDX_INDUCTION_DIR = 0xff1e,
|
||||
IDX_KEEP_GUESSING = 0xff1f,
|
||||
IDX_INCREMENT_MAX = 0xff1d,
|
||||
IDX_INCREMENT_MIN = 0xff1e,
|
||||
IDX_INDUCTION_DIR = 0xff1f,
|
||||
IDX_KEEP_GUESSING = 0xff20,
|
||||
IDX_KERNEL_ACCEL = 'n',
|
||||
IDX_KERNEL_LOOPS = 'u',
|
||||
IDX_KERNEL_THREADS = 'T',
|
||||
IDX_KEYBOARD_LAYOUT_MAPPING = 0xff20,
|
||||
IDX_KEYSPACE = 0xff21,
|
||||
IDX_LEFT = 0xff22,
|
||||
IDX_KEYBOARD_LAYOUT_MAPPING = 0xff21,
|
||||
IDX_KEYSPACE = 0xff22,
|
||||
IDX_LEFT = 0xff23,
|
||||
IDX_LIMIT = 'l',
|
||||
IDX_LOGFILE_DISABLE = 0xff23,
|
||||
IDX_LOOPBACK = 0xff24,
|
||||
IDX_MACHINE_READABLE = 0xff25,
|
||||
IDX_MARKOV_CLASSIC = 0xff26,
|
||||
IDX_MARKOV_DISABLE = 0xff27,
|
||||
IDX_MARKOV_HCSTAT2 = 0xff28,
|
||||
IDX_LOGFILE_DISABLE = 0xff24,
|
||||
IDX_LOOPBACK = 0xff25,
|
||||
IDX_MACHINE_READABLE = 0xff26,
|
||||
IDX_MARKOV_CLASSIC = 0xff27,
|
||||
IDX_MARKOV_DISABLE = 0xff28,
|
||||
IDX_MARKOV_HCSTAT2 = 0xff29,
|
||||
IDX_MARKOV_THRESHOLD = 't',
|
||||
IDX_NONCE_ERROR_CORRECTIONS = 0xff29,
|
||||
IDX_NONCE_ERROR_CORRECTIONS = 0xff2a,
|
||||
IDX_OPENCL_DEVICE_TYPES = 'D',
|
||||
IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
|
||||
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff2a,
|
||||
IDX_OUTFILE_CHECK_DIR = 0xff2b,
|
||||
IDX_OUTFILE_CHECK_TIMER = 0xff2c,
|
||||
IDX_OUTFILE_FORMAT = 0xff2d,
|
||||
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff2b,
|
||||
IDX_OUTFILE_CHECK_DIR = 0xff2c,
|
||||
IDX_OUTFILE_CHECK_TIMER = 0xff2d,
|
||||
IDX_OUTFILE_FORMAT = 0xff2e,
|
||||
IDX_OUTFILE = 'o',
|
||||
IDX_POTFILE_DISABLE = 0xff2e,
|
||||
IDX_POTFILE_PATH = 0xff2f,
|
||||
IDX_PROGRESS_ONLY = 0xff30,
|
||||
IDX_QUIET = 0xff31,
|
||||
IDX_REMOVE = 0xff32,
|
||||
IDX_REMOVE_TIMER = 0xff33,
|
||||
IDX_RESTORE = 0xff34,
|
||||
IDX_RESTORE_DISABLE = 0xff35,
|
||||
IDX_RESTORE_FILE_PATH = 0xff36,
|
||||
IDX_POTFILE_DISABLE = 0xff2f,
|
||||
IDX_POTFILE_PATH = 0xff30,
|
||||
IDX_PROGRESS_ONLY = 0xff31,
|
||||
IDX_QUIET = 0xff32,
|
||||
IDX_REMOVE = 0xff33,
|
||||
IDX_REMOVE_TIMER = 0xff34,
|
||||
IDX_RESTORE = 0xff35,
|
||||
IDX_RESTORE_DISABLE = 0xff36,
|
||||
IDX_RESTORE_FILE_PATH = 0xff37,
|
||||
IDX_RP_FILE = 'r',
|
||||
IDX_RP_GEN_FUNC_MAX = 0xff37,
|
||||
IDX_RP_GEN_FUNC_MIN = 0xff38,
|
||||
IDX_RP_GEN_FUNC_MAX = 0xff38,
|
||||
IDX_RP_GEN_FUNC_MIN = 0xff39,
|
||||
IDX_RP_GEN = 'g',
|
||||
IDX_RP_GEN_SEED = 0xff39,
|
||||
IDX_RP_GEN_SEED = 0xff3a,
|
||||
IDX_RULE_BUF_L = 'j',
|
||||
IDX_RULE_BUF_R = 'k',
|
||||
IDX_RUNTIME = 0xff3a,
|
||||
IDX_SCRYPT_TMTO = 0xff3b,
|
||||
IDX_RUNTIME = 0xff3b,
|
||||
IDX_SCRYPT_TMTO = 0xff3c,
|
||||
IDX_SEGMENT_SIZE = 'c',
|
||||
IDX_SELF_TEST_DISABLE = 0xff3c,
|
||||
IDX_SELF_TEST_DISABLE = 0xff3d,
|
||||
IDX_SEPARATOR = 'p',
|
||||
IDX_SESSION = 0xff3d,
|
||||
IDX_SHOW = 0xff3e,
|
||||
IDX_SESSION = 0xff3e,
|
||||
IDX_SHOW = 0xff3f,
|
||||
IDX_SKIP = 's',
|
||||
IDX_SLOW_CANDIDATES = 'S',
|
||||
IDX_SPEED_ONLY = 0xff3f,
|
||||
IDX_SPIN_DAMP = 0xff40,
|
||||
IDX_STATUS = 0xff41,
|
||||
IDX_STATUS_JSON = 0xff42,
|
||||
IDX_STATUS_TIMER = 0xff43,
|
||||
IDX_STDOUT_FLAG = 0xff44,
|
||||
IDX_STDIN_TIMEOUT_ABORT = 0xff45,
|
||||
IDX_TRUECRYPT_KEYFILES = 0xff46,
|
||||
IDX_USERNAME = 0xff47,
|
||||
IDX_VERACRYPT_KEYFILES = 0xff48,
|
||||
IDX_VERACRYPT_PIM_START = 0xff49,
|
||||
IDX_VERACRYPT_PIM_STOP = 0xff4a,
|
||||
IDX_SPEED_ONLY = 0xff40,
|
||||
IDX_SPIN_DAMP = 0xff41,
|
||||
IDX_STATUS = 0xff42,
|
||||
IDX_STATUS_JSON = 0xff43,
|
||||
IDX_STATUS_TIMER = 0xff44,
|
||||
IDX_STDOUT_FLAG = 0xff45,
|
||||
IDX_STDIN_TIMEOUT_ABORT = 0xff46,
|
||||
IDX_TRUECRYPT_KEYFILES = 0xff47,
|
||||
IDX_USERNAME = 0xff48,
|
||||
IDX_VERACRYPT_KEYFILES = 0xff49,
|
||||
IDX_VERACRYPT_PIM_START = 0xff4a,
|
||||
IDX_VERACRYPT_PIM_STOP = 0xff4b,
|
||||
IDX_VERSION_LOWER = 'v',
|
||||
IDX_VERSION = 'V',
|
||||
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff4b,
|
||||
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff4c,
|
||||
IDX_WORKLOAD_PROFILE = 'w',
|
||||
|
||||
} user_options_map_t;
|
||||
@ -1841,6 +1842,7 @@ typedef struct user_options
|
||||
bool brain_host_chgd;
|
||||
bool brain_port_chgd;
|
||||
bool brain_password_chgd;
|
||||
bool brain_server_timer_chgd;
|
||||
#endif
|
||||
bool hash_mode_chgd;
|
||||
bool hccapx_message_pair_chgd;
|
||||
@ -1939,6 +1941,7 @@ typedef struct user_options
|
||||
u32 bitmap_max;
|
||||
u32 bitmap_min;
|
||||
#ifdef WITH_BRAIN
|
||||
u32 brain_server_timer;
|
||||
u32 brain_client_features;
|
||||
u32 brain_port;
|
||||
u32 brain_session;
|
||||
|
13
src/brain.c
13
src/brain.c
@ -1950,11 +1950,15 @@ void *brain_server_handle_dumps (void *p)
|
||||
|
||||
brain_server_dbs_t *brain_server_dbs = brain_server_dumper_options->brain_server_dbs;
|
||||
|
||||
int i = 0;
|
||||
u32 brain_server_timer = brain_server_dumper_options->brain_server_timer;
|
||||
|
||||
if (brain_server_timer == 0) return NULL;
|
||||
|
||||
u32 i = 0;
|
||||
|
||||
while (keep_running == true)
|
||||
{
|
||||
if (i == BRAIN_SERVER_DUMP_EVERY)
|
||||
if (i == brain_server_timer)
|
||||
{
|
||||
brain_server_write_hash_dumps (brain_server_dbs, ".");
|
||||
brain_server_write_attack_dumps (brain_server_dbs, ".");
|
||||
@ -2923,7 +2927,7 @@ void *brain_server_handle_client (void *p)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int brain_server (const char *listen_host, const int listen_port, const char *brain_password, const char *brain_session_whitelist)
|
||||
int brain_server (const char *listen_host, const int listen_port, const char *brain_password, const char *brain_session_whitelist, const u32 brain_server_timer)
|
||||
{
|
||||
#if defined (_WIN)
|
||||
WSADATA wsaData;
|
||||
@ -3193,7 +3197,8 @@ int brain_server (const char *listen_host, const int listen_port, const char *br
|
||||
|
||||
brain_server_dumper_options_t brain_server_dumper_options;
|
||||
|
||||
brain_server_dumper_options.brain_server_dbs = brain_server_dbs;
|
||||
brain_server_dumper_options.brain_server_dbs = brain_server_dbs;
|
||||
brain_server_dumper_options.brain_server_timer = brain_server_timer;
|
||||
|
||||
hc_thread_t dump_thr;
|
||||
|
||||
|
@ -1125,7 +1125,7 @@ int main (int argc, char **argv)
|
||||
#ifdef WITH_BRAIN
|
||||
if (user_options->brain_server == true)
|
||||
{
|
||||
const int rc = brain_server (user_options->brain_host, user_options->brain_port, user_options->brain_password, user_options->brain_session_whitelist);
|
||||
const int rc = brain_server (user_options->brain_host, user_options->brain_port, user_options->brain_password, user_options->brain_session_whitelist, user_options->brain_server_timer);
|
||||
|
||||
hcfree (hashcat_ctx);
|
||||
|
||||
|
@ -125,6 +125,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
|
||||
" -S, --slow-candidates | | Enable slower (but advanced) candidate generators |",
|
||||
#ifdef WITH_BRAIN
|
||||
" --brain-server | | Enable brain server |",
|
||||
" --brain-server-timer | Num | Update the brain server dump each X seconds (min:60) | --brain-server-timer=300",
|
||||
" -z, --brain-client | | Enable brain client, activates -S |",
|
||||
" --brain-client-features | Num | Define brain client features, see below | --brain-client-features=3",
|
||||
" --brain-host | Str | Brain server host (IP or domain) | --brain-host=127.0.0.1",
|
||||
|
@ -129,6 +129,7 @@ static const struct option long_options[] =
|
||||
{"brain-client", no_argument, NULL, IDX_BRAIN_CLIENT},
|
||||
{"brain-client-features", required_argument, NULL, IDX_BRAIN_CLIENT_FEATURES},
|
||||
{"brain-server", no_argument, NULL, IDX_BRAIN_SERVER},
|
||||
{"brain-server-timer", required_argument, NULL, IDX_BRAIN_SERVER_TIMER},
|
||||
{"brain-host", required_argument, NULL, IDX_BRAIN_HOST},
|
||||
{"brain-port", required_argument, NULL, IDX_BRAIN_PORT},
|
||||
{"brain-password", required_argument, NULL, IDX_BRAIN_PASSWORD},
|
||||
@ -169,6 +170,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
|
||||
user_options->brain_host = NULL;
|
||||
user_options->brain_port = BRAIN_PORT;
|
||||
user_options->brain_server = BRAIN_SERVER;
|
||||
user_options->brain_server_timer = BRAIN_SERVER_DUMP_EVERY;
|
||||
user_options->brain_session = BRAIN_SESSION;
|
||||
user_options->brain_session_whitelist = NULL;
|
||||
#endif
|
||||
@ -481,6 +483,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
case IDX_BRAIN_CLIENT: user_options->brain_client = true; break;
|
||||
case IDX_BRAIN_CLIENT_FEATURES: user_options->brain_client_features = hc_strtoul (optarg, NULL, 10); break;
|
||||
case IDX_BRAIN_SERVER: user_options->brain_server = true; break;
|
||||
case IDX_BRAIN_SERVER_TIMER: user_options->brain_server_timer = hc_strtoul (optarg, NULL, 10);
|
||||
user_options->brain_server_timer_chgd = true; break;
|
||||
case IDX_BRAIN_PASSWORD: user_options->brain_password = optarg;
|
||||
user_options->brain_password_chgd = true; break;
|
||||
case IDX_BRAIN_HOST: user_options->brain_host = optarg;
|
||||
@ -540,6 +544,26 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (user_options->brain_server_timer_chgd)
|
||||
{
|
||||
if (user_options->brain_server == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "The --brain-server-timer flag requires --brain-server.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (user_options->brain_server_timer != 0) // special case (no intermediate dumps)
|
||||
{
|
||||
if (user_options->brain_server_timer < 60)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Brain server backup timer must be at least 60 seconds.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (user_options->slow_candidates == true)
|
||||
@ -2890,6 +2914,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
|
||||
logfile_top_uint (user_options->brain_client);
|
||||
logfile_top_uint (user_options->brain_client_features);
|
||||
logfile_top_uint (user_options->brain_server);
|
||||
logfile_top_uint (user_options->brain_server_timer);
|
||||
logfile_top_uint (user_options->brain_port);
|
||||
logfile_top_uint (user_options->brain_session);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user