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

The hashcat brain

This commit is contained in:
Jens Steube 2018-10-28 16:47:13 +01:00
parent 24ce7bacae
commit d6fe2c7cd4
20 changed files with 4543 additions and 3 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "OpenCL-Headers"]
path = deps/git/OpenCL-Headers
url = https://github.com/KhronosGroup/OpenCL-Headers.git
[submodule "xxHash"]
path = deps/git/xxHash
url = https://github.com/Cyan4973/xxHash.git

1
deps/git/xxHash vendored Submodule

@ -0,0 +1 @@
Subproject commit 0f2dd4a1cb103e3fc8c55c855b821eb24c6d82c3

View File

@ -5,6 +5,13 @@
##
- Added new option --slow-candidates which allows hashcat to generate passwords on-host
- Added new option --brain-server to start a hashcat brain server
- Added new option --brain-client to start a hashcat brain client, automatically activates --slow-candidates
- Added new option --brain-host and --brain-port to specify ip and port of brain server, both listening and connecting
- Added new option --brain-session to override automatically calculated brain session ID
- Added new option --brain-session-whitelist to allow only explicit written session ID on brain server
- Added new option --brain-password to specify the brain server authentication password
- Added new option --brain-client-features which allows enable and disable certain features of the hashcat brain
##
## Algorithms

View File

@ -21,6 +21,7 @@ NVIDIA GPUs require "NVIDIA Driver" (367.x or later)
- Multi-Hash (Cracking multiple hashes at the same time)
- Multi-Devices (Utilizing multiple devices in same system)
- Multi-Device-Types (Utilizing mixed device types in same system)
- Supports password candidate brain functionality
- Supports distributed cracking networks (using overlay)
- Supports interactive pause / resume
- Supports sessions

View File

@ -189,8 +189,8 @@ _hashcat ()
local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H'
local SHORT_OPTS="-m -a -V -v -h -b -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-disable --gpu-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates"
local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --opencl-info --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-disable --gpu-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password"
local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --opencl-devices --opencl-platforms --opencl-device-types --opencl-vector-width --workload-profile --kernel-accel --kernel-loops --nvidia-spin-damp --gpu-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --increment-min --increment-max --scrypt-tmto --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-host --brain-password --brain-port --brain-session --brain-whitelist-session"
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
@ -363,7 +363,51 @@ _hashcat ()
--status-timer|--markov-threshold|--runtime|--session|--separator|--segment-size|--rule-left|--rule-right| \
--nvidia-spin-damp|--gpu-temp-abort|--generate-rules|--generate-rules-func-min|--generate-rules-func-max| \
--increment-min|--increment-max|--remove-timer|--bitmap-min|--bitmap-max|--skip|--limit|--generate-rules-seed| \
--outfile-check-timer|--outfile-check-dir|--induction-dir|--scrypt-tmto|--encoding-from|--encoding-to|--optimized-kernel-enable)
--outfile-check-timer|--outfile-check-dir|--induction-dir|--scrypt-tmto|--encoding-from|--encoding-to|--optimized-kernel-enable|--brain-host|--brain-port|--brain-password)
return 0
;;
--brain-session)
local cur_session=$(echo "${cur}" | grep -Eo '^0x[0-9a-fA-F]*' | sed 's/^0x//')
local session_var="0x${cur_session}"
if [ "${#cur_session}" -lt 8 ]
then
session_var="${session_var}0 ${session_var}1 ${session_var}2 ${session_var}3 ${session_var}4
${session_var}5 ${session_var}6 ${session_var}7 ${session_var}8 ${session_var}9
${session_var}a ${session_var}b ${session_var}c ${session_var}d ${session_var}e
${session_var}f"
fi
COMPREPLY=($(compgen -W "${session_var}" -- ${cur}))
return 0
;;
--brain-session-whitelist)
local session_list=$(echo "${cur}" | grep -Eo '^0x[0-9a-fA-F,x]*' | sed 's/^0x//')
local cur_session=$(echo "${session_list}" | sed 's/^.*0x//')
local session_var="0x${session_list}"
if [ "${#cur_session}" -eq 8 ]
then
cur_session=""
session_var="${session_var},0x"
fi
if [ "${#cur_session}" -lt 8 ]
then
session_var="${session_var}0 ${session_var}1 ${session_var}2 ${session_var}3 ${session_var}4
${session_var}5 ${session_var}6 ${session_var}7 ${session_var}8 ${session_var}9
${session_var}a ${session_var}b ${session_var}c ${session_var}d ${session_var}e
${session_var}f"
fi
COMPREPLY=($(compgen -W "${session_var}" -- ${cur}))
return 0
;;

242
include/brain.h Normal file
View File

@ -0,0 +1,242 @@
/**
* Author......: See docs/credits.txt
* License.....: MIT
*/
#ifndef _BRAIN_H
#define _BRAIN_H
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <errno.h>
#include <dirent.h>
#include <search.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#if defined (_WIN)
#define _WINNT_WIN32 0x0601
#include <ws2tcpip.h>
#include <winsock2.h>
#include <wincrypt.h>
#define SEND_FLAGS 0
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <signal.h>
#define SEND_FLAGS MSG_NOSIGNAL
#endif
#include "xxhash.h"
static const int BRAIN_CLIENT_CONNECT_TIMEOUT = 5;
static const int BRAIN_SERVER_DUMP_EVERY = 5 * 60;
static const int BRAIN_SERVER_SESSIONS_MAX = 64;
static const int BRAIN_SERVER_ATTACKS_MAX = 64 * 1024;
static const int BRAIN_SERVER_CLIENTS_MAX = 256;
static const int BRAIN_SERVER_REALLOC_HASH_SIZE = 1024 * 1024;
static const int BRAIN_SERVER_REALLOC_ATTACK_SIZE = 1024;
static const int BRAIN_HASH_SIZE = 2 * sizeof (u32);
static const int BRAIN_LINK_VERSION_CUR = 1;
static const int BRAIN_LINK_VERSION_MIN = 1;
static const int BRAIN_LINK_CHUNK_SIZE = 4 * 1024;
static const int BRAIN_LINK_CANDIDATES_MAX = 128 * 1024 * 256; // units * threads * accel
typedef enum brain_operation
{
BRAIN_OPERATION_COMMIT = 1,
BRAIN_OPERATION_HASH_LOOKUP = 2,
BRAIN_OPERATION_ATTACK_RESERVE = 3,
} brain_operation_t;
typedef enum brain_client_feature
{
BRAIN_CLIENT_FEATURE_HASHES = 1,
BRAIN_CLIENT_FEATURE_ATTACKS = 2,
} brain_client_feature_t;
typedef struct brain_server_attack_long
{
u64 offset;
u64 length;
} brain_server_attack_long_t;
typedef struct brain_server_attack_short
{
u64 offset;
u64 length;
int client_fd;
} brain_server_attack_short_t;
typedef struct brain_server_hash_long
{
u32 hash[2];
} brain_server_hash_long_t;
typedef struct brain_server_hash_short
{
u32 hash[2];
} brain_server_hash_short_t;
typedef struct brain_server_hash_unique
{
u32 hash[2];
i64 hash_idx;
} brain_server_hash_unique_t;
typedef struct brain_server_db_attack
{
u32 brain_attack;
brain_server_attack_short_t *short_buf;
i64 short_alloc;
i64 short_cnt;
brain_server_attack_long_t *long_buf;
i64 long_alloc;
i64 long_cnt;
int ab;
hc_thread_mutex_t mux_ar;
hc_thread_mutex_t mux_ag;
bool write_attacks;
} brain_server_db_attack_t;
typedef struct brain_server_db_hash
{
u32 brain_session;
brain_server_hash_long_t *long_buf;
i64 long_alloc;
i64 long_cnt;
int hb;
hc_thread_mutex_t mux_hr;
hc_thread_mutex_t mux_hg;
bool write_hashes;
} brain_server_db_hash_t;
typedef struct brain_server_db_short
{
brain_server_hash_short_t *short_buf;
i64 short_cnt;
} brain_server_db_short_t;
typedef struct brain_server_dbs
{
// required for cyclic dump
hc_thread_mutex_t mux_dbs;
brain_server_db_hash_t *hash_buf;
brain_server_db_attack_t *attack_buf;
int hash_cnt;
int attack_cnt;
} brain_server_dbs_t;
typedef struct brain_server_dumper_options
{
brain_server_dbs_t *brain_server_dbs;
} brain_server_dumper_options_t;
typedef struct brain_server_client_options
{
brain_server_dbs_t *brain_server_dbs;
int client_fd;
char *auth_password;
u32 *session_whitelist_buf;
int session_whitelist_cnt;
} brain_server_client_options_t;
int brain_logging (FILE *stream, const int client_fd, const char *format, ...);
u32 brain_compute_session (hashcat_ctx_t *hashcat_ctx);
u32 brain_compute_attack (hashcat_ctx_t *hashcat_ctx);
u64 brain_compute_attack_wordlist (const char *filename);
u32 brain_auth_challenge (void);
u64 brain_auth_hash (const u32 challenge, const char *pw_buf, const int pw_len);
int brain_connect (int sockfd, const struct sockaddr *addr, socklen_t addrlen, const int timeout);
bool brain_recv (int sockfd, void *buf, size_t len, int flags, hc_device_param_t *device_param, const status_ctx_t *status_ctx);
bool brain_send (int sockfd, void *buf, size_t len, int flags, hc_device_param_t *device_param, const status_ctx_t *status_ctx);
bool brain_recv_all (int sockfd, void *buf, size_t len, int flags, hc_device_param_t *device_param, const status_ctx_t *status_ctx);
bool brain_send_all (int sockfd, void *buf, size_t len, int flags, hc_device_param_t *device_param, const status_ctx_t *status_ctx);
bool brain_client_reserve (hc_device_param_t *device_param, const status_ctx_t *status_ctx, u64 words_off, u64 work, u64 *overlap);
bool brain_client_commit (hc_device_param_t *device_param, const status_ctx_t *status_ctx);
bool brain_client_lookup (hc_device_param_t *device_param, const status_ctx_t *status_ctx);
bool brain_client_connect (hc_device_param_t *device_param, const status_ctx_t *status_ctx, const char *host, const int port, const char *password, u32 brain_session, u32 brain_attack, i64 passwords_max, u64 *highest);
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);
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);
bool brain_server_write_hash_dump (brain_server_db_hash_t *brain_server_db_hash, const char *file);
bool brain_server_read_attack_dumps (brain_server_dbs_t *brain_server_dbs, const char *path);
bool brain_server_write_attack_dumps (brain_server_dbs_t *brain_server_dbs, const char *path);
bool brain_server_read_attack_dump (brain_server_db_attack_t *brain_server_db_attack, const char *file);
bool brain_server_write_attack_dump (brain_server_db_attack_t *brain_server_db_attack, const char *file);
u64 brain_server_highest_attack (const brain_server_db_attack_t *buf);
u64 brain_server_highest_attack_long (const brain_server_attack_long_t *buf, const i64 cnt, const u64 start);
u64 brain_server_highest_attack_short (const brain_server_attack_short_t *buf, const i64 cnt, const u64 start);
u64 brain_server_find_attack_long (const brain_server_attack_long_t *buf, const i64 cnt, const u64 offset, const u64 length);
u64 brain_server_find_attack_short (const brain_server_attack_short_t *buf, const i64 cnt, const u64 offset, const u64 length);
i64 brain_server_find_hash_long (const u32 *search, const brain_server_hash_long_t *buf, const i64 cnt);
i64 brain_server_find_hash_short (const u32 *search, const brain_server_hash_short_t *buf, const i64 cnt);
int brain_server_sort_db_hash (const void *v1, const void *v2);
int brain_server_sort_db_attack (const void *v1, const void *v2);
int brain_server_sort_attack_long (const void *v1, const void *v2);
int brain_server_sort_attack_short (const void *v1, const void *v2);
int brain_server_sort_hash (const void *v1, const void *v2);
int brain_server_sort_hash_long (const void *v1, const void *v2);
int brain_server_sort_hash_short (const void *v1, const void *v2);
int brain_server_sort_hash_unique (const void *v1, const void *v2);
void brain_server_handle_signal (int signo);
void *brain_server_handle_client (void *p);
void *brain_server_handle_dumps (void *p);
void brain_server_db_hash_init (brain_server_db_hash_t *brain_server_db_hash, const u32 brain_session);
bool brain_server_db_hash_realloc (brain_server_db_hash_t *brain_server_db_hash, const i64 new_long_cnt);
void brain_server_db_hash_free (brain_server_db_hash_t *brain_server_db_hash);
void brain_server_db_attack_init (brain_server_db_attack_t *brain_server_db_attack, const u32 brain_attack);
bool brain_server_db_attack_realloc (brain_server_db_attack_t *brain_server_db_attack, const i64 new_long_cnt, const i64 new_short_cnt);
void brain_server_db_attack_free (brain_server_db_attack_t *brain_server_db_attack);
#endif // _BRAIN_H

View File

@ -6,6 +6,22 @@
#ifndef _DISPATCH_H
#define _DISPATCH_H
#ifdef WITH_BRAIN
#if defined (_WIN)
#include <winsock.h>
#define SEND_FLAGS 0
#endif
#if defined (__linux__)
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#define SEND_FLAGS MSG_NOSIGNAL
#endif
#endif
HC_API_CALL void *thread_calc_stdin (void *p);
HC_API_CALL void *thread_calc (void *p);

View File

@ -85,6 +85,16 @@ int status_get_innerloop_pos_dev (const hashcat_ctx_t *hash
int status_get_innerloop_left_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_iteration_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_iteration_left_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
#ifdef WITH_BRAIN
int status_get_brain_session (const hashcat_ctx_t *hashcat_ctx);
int status_get_brain_attack (const hashcat_ctx_t *hashcat_ctx);
int status_get_brain_link_client_id_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_brain_link_status_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_brain_link_recv_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_brain_link_send_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_brain_link_recv_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
char *status_get_brain_link_send_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
#endif
char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);

View File

@ -536,6 +536,13 @@ typedef enum user_options_defaults
BENCHMARK = false,
BITMAP_MAX = 24,
BITMAP_MIN = 16,
#ifdef WITH_BRAIN
BRAIN_CLIENT = false,
BRAIN_CLIENT_FEATURES = 3,
BRAIN_PORT = 6863,
BRAIN_SERVER = false,
BRAIN_SESSION = 0,
#endif
DEBUG_MODE = 0,
EXAMPLE_HASHES = false,
FORCE = false,
@ -609,6 +616,16 @@ typedef enum user_options_map
IDX_BENCHMARK = 'b',
IDX_BITMAP_MAX = 0xff02,
IDX_BITMAP_MIN = 0xff03,
#ifdef WITH_BRAIN
IDX_BRAIN_CLIENT = 'z',
IDX_BRAIN_CLIENT_FEATURES = 0xff04,
IDX_BRAIN_HOST = 0xff05,
IDX_BRAIN_PASSWORD = 0xff06,
IDX_BRAIN_PORT = 0xff07,
IDX_BRAIN_SERVER = 0xff08,
IDX_BRAIN_SESSION = 0xff09,
IDX_BRAIN_SESSION_WHITELIST = 0xff0a,
#endif
IDX_CPU_AFFINITY = 0xff0b,
IDX_CUSTOM_CHARSET_1 = '1',
IDX_CUSTOM_CHARSET_2 = '2',
@ -712,6 +729,16 @@ typedef enum token_attr
} token_attr_t;
#ifdef WITH_BRAIN
typedef enum brain_link_status
{
BRAIN_LINK_STATUS_CONNECTED = 1 << 0,
BRAIN_LINK_STATUS_RECEIVING = 1 << 1,
BRAIN_LINK_STATUS_SENDING = 1 << 2,
} brain_link_status_t;
#endif
/**
* structs
*/
@ -950,6 +977,16 @@ typedef struct plain
} plain_t;
#define LINK_SPEED_COUNT 10000
typedef struct link_speed
{
hc_timer_t timer[LINK_SPEED_COUNT];
ssize_t bytes[LINK_SPEED_COUNT];
int pos;
} link_speed_t;
#include "ext_OpenCL.h"
typedef struct hc_device_param
@ -1085,6 +1122,21 @@ typedef struct hc_device_param
size_t size_st_salts;
size_t size_st_esalts;
#ifdef WITH_BRAIN
size_t size_brain_link_in;
size_t size_brain_link_out;
int brain_link_client_fd;
link_speed_t brain_link_recv_speed;
link_speed_t brain_link_send_speed;
bool brain_link_recv_active;
bool brain_link_send_active;
u64 brain_link_recv_bytes;
u64 brain_link_send_bytes;
u8 *brain_link_in_buf;
u32 *brain_link_out_buf;
#endif
char *scratch_buf;
FILE *combs_fp;
@ -1618,6 +1670,11 @@ typedef struct user_options
char **hc_argv;
bool attack_mode_chgd;
#ifdef WITH_BRAIN
bool brain_host_chgd;
bool brain_port_chgd;
bool brain_password_chgd;
#endif
bool hash_mode_chgd;
bool hccapx_message_pair_chgd;
bool increment_max_chgd;
@ -1639,6 +1696,10 @@ typedef struct user_options
bool advice_disable;
bool benchmark;
bool benchmark_all;
#ifdef WITH_BRAIN
bool brain_client;
bool brain_server;
#endif
bool example_hashes;
bool force;
bool gpu_temp_disable;
@ -1673,6 +1734,11 @@ typedef struct user_options
bool username;
bool version;
bool wordlist_autohex_disable;
#ifdef WITH_BRAIN
char *brain_host;
char *brain_password;
char *brain_session_whitelist;
#endif
char *cpu_affinity;
char *custom_charset_4;
char *debug_file;
@ -1700,6 +1766,12 @@ typedef struct user_options
u32 attack_mode;
u32 bitmap_max;
u32 bitmap_min;
#ifdef WITH_BRAIN
u32 brain_client_features;
u32 brain_port;
u32 brain_session;
u32 brain_attack;
#endif
u32 debug_mode;
u32 gpu_temp_abort;
u32 hash_mode;
@ -1893,6 +1965,16 @@ typedef struct device_info
int innerloop_left_dev;
int iteration_pos_dev;
int iteration_left_dev;
#ifdef WITH_BRAIN
int brain_link_client_id_dev;
int brain_link_status_dev;
char *brain_link_recv_bytes_dev;
char *brain_link_send_bytes_dev;
char *brain_link_recv_bytes_sec_dev;
char *brain_link_send_bytes_sec_dev;
double brain_link_time_recv_dev;
double brain_link_time_send_dev;
#endif
} device_info_t;
@ -1912,6 +1994,10 @@ typedef struct hashcat_status
char *guess_charset;
int guess_mask_length;
char *session;
#ifdef WITH_BRAIN
int brain_session;
int brain_attack;
#endif
const char *status_string;
int status_number;
char *time_estimated_absolute;

View File

@ -7,6 +7,7 @@ SHARED := 0
DEBUG := 0
PRODUCTION := 0
PRODUCTION_VERSION := v4.2.1
ENABLE_BRAIN := 1
##
## Detect Operating System
@ -185,6 +186,12 @@ CFLAGS += $(LZMA_SDK_INCLUDE)
LDFLAGS += -llzmasdk
endif
# brain and xxHash
ifeq ($(ENABLE_BRAIN),1)
CFLAGS += -DWITH_BRAIN
CFLAGS += -Ideps/git/xxHash
endif
##
## Native compilation target
##
@ -292,6 +299,10 @@ LFLAGS_CROSS_WIN64 += -lws2_32
OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md4 cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_sysfs ext_lzma filehandling folder hashcat hashes hlfmt hwmon induct interface locking logfile loopback memory monitor mpsp opencl outfile_check outfile pidfile potfile restore rp rp_cpu rp_kernel_on_cpu rp_kernel_on_cpu_optimized selftest slow_candidates shared status stdout straight terminal thread timer tuningdb usage user_options wordlist
ifeq ($(ENABLE_BRAIN),1)
OBJS_ALL += brain
endif
NATIVE_STATIC_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.STATIC.o)
NATIVE_SHARED_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.SHARED.o)
@ -301,6 +312,19 @@ LINUX_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.64.o)
WIN_32_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.32.o)
WIN_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.64.o)
ifeq ($(ENABLE_BRAIN),1)
OBJS_XXHASH := xxhash
NATIVE_STATIC_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).NATIVE.STATIC.o)
NATIVE_SHARED_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).NATIVE.SHARED.o)
LINUX_32_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).LINUX.32.o)
LINUX_64_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).LINUX.64.o)
WIN_32_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).WIN.32.o)
WIN_64_OBJS += $(foreach OBJ,$(OBJS_XXHASH),obj/$(OBJ).WIN.64.o)
endif
ifeq ($(SYSTEM_LZMA_SDK),0)
OBJS_LZMA := Alloc Lzma2Dec LzmaDec
@ -449,6 +473,14 @@ obj/%.NATIVE.STATIC.o: src/%.c
obj/%.NATIVE.SHARED.o: src/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic
ifeq ($(ENABLE_BRAIN),1)
obj/%.NATIVE.STATIC.o: deps/git/xxHash/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@
obj/%.NATIVE.SHARED.o: deps/git/xxHash/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic
endif
ifeq ($(SYSTEM_LZMA_SDK),0)
obj/%.NATIVE.STATIC.o: deps/lzma_sdk/%.c
$(CC) -c $(CFLAGS_NATIVE) $< -o $@
@ -489,6 +521,20 @@ obj/%.WIN.32.o: src/%.c
obj/%.WIN.64.o: src/%.c
$(CC_WIN_64) $(CFLAGS_CROSS_WIN64) -c -o $@ $<
ifeq ($(ENABLE_BRAIN),1)
obj/%.LINUX.32.o: deps/git/xxHash/%.c
$(CC_LINUX_32) $(CFLAGS_CROSS_LINUX32) -c -o $@ $<
obj/%.LINUX.64.o: deps/git/xxHash/%.c
$(CC_LINUX_64) $(CFLAGS_CROSS_LINUX64) -c -o $@ $<
obj/%.WIN.32.o: deps/git/xxHash/%.c
$(CC_WIN_32) $(CFLAGS_CROSS_WIN32) -c -o $@ $<
obj/%.WIN.64.o: deps/git/xxHash/%.c
$(CC_WIN_64) $(CFLAGS_CROSS_WIN64) -c -o $@ $<
endif
ifeq ($(SYSTEM_LZMA_SDK),0)
obj/%.LINUX.32.o: deps/lzma_sdk/%.c
$(CC_LINUX_32) $(CFLAGS_CROSS_LINUX32) -c -o $@ $<

3209
src/brain.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,10 @@
#include "user_options.h"
#include "dispatch.h"
#ifdef WITH_BRAIN
#include "brain.h"
#endif
static u64 get_highest_words_done (const hashcat_ctx_t *hashcat_ctx)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
@ -370,6 +374,39 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (user_options->slow_candidates == true)
{
#ifdef WITH_BRAIN
const u32 brain_session = user_options->brain_session;
const u32 brain_attack = user_options->brain_attack;
u64 highest = 0;
brain_client_disconnect (device_param);
if (user_options->brain_client == true)
{
const i64 passwords_max = device_param->hardware_power * device_param->kernel_accel;
if (brain_client_connect (device_param, status_ctx, user_options->brain_host, user_options->brain_port, user_options->brain_password, brain_session, brain_attack, passwords_max, &highest) == false)
{
brain_client_disconnect (device_param);
}
hc_thread_mutex_lock (status_ctx->mux_dispatcher);
if (status_ctx->words_off == 0)
{
status_ctx->words_off = highest;
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
status_ctx->words_progress_rejected[salt_pos] = status_ctx->words_off;
}
}
hc_thread_mutex_unlock (status_ctx->mux_dispatcher);
}
#endif
// attack modes from here
if (attack_mode == ATTACK_MODE_STRAIGHT)
@ -446,6 +483,39 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
u64 words_off = device_param->words_off;
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
if (device_param->brain_link_client_fd == -1)
{
const i64 passwords_max = device_param->hardware_power * device_param->kernel_accel;
if (brain_client_connect (device_param, status_ctx, user_options->brain_host, user_options->brain_port, user_options->brain_password, user_options->brain_session, user_options->brain_attack, passwords_max, &highest) == false)
{
brain_client_disconnect (device_param);
}
}
if (user_options->brain_client_features & BRAIN_CLIENT_FEATURE_ATTACKS)
{
u64 overlap = 0;
if (brain_client_reserve (device_param, status_ctx, words_off, work, &overlap) == false)
{
brain_client_disconnect (device_param);
}
words_extra = overlap;
words_extra_total += overlap;
words_off += overlap;
work -= overlap;
}
}
#endif
words_fin = words_off + work;
words_extra = 0;
@ -467,6 +537,20 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
continue;
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
u32 hash[2];
brain_client_generate_hash ((u64 *) hash, (const char *) extra_info_straight.out_buf, extra_info_straight.out_len);
u32 *ptr = (u32 *) device_param->brain_link_out_buf;
ptr[(device_param->pws_pre_cnt * 2) + 0] = hash[0];
ptr[(device_param->pws_pre_cnt * 2) + 1] = hash[1];
}
#endif
pw_pre_add (device_param, extra_info_straight.out_buf, extra_info_straight.out_len, extra_info_straight.base_buf, extra_info_straight.base_len, extra_info_straight.rule_pos_prev);
if (status_ctx->run_thread_level1 == false) break;
@ -479,6 +563,49 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (status_ctx->run_thread_level1 == false) break;
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
if (user_options->brain_client_features & BRAIN_CLIENT_FEATURE_HASHES)
{
if (brain_client_lookup (device_param, status_ctx) == false)
{
brain_client_disconnect (device_param);
}
}
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
{
if (device_param->brain_link_in_buf[pws_pre_idx] == 1)
{
pre_rejects++;
}
else
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + pws_pre_idx;
pw_base_add (device_param, pw_pre);
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
}
}
else
{
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + pws_pre_idx;
pw_base_add (device_param, pw_pre);
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
}
#else
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
@ -489,6 +616,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
#endif
words_extra_total += pre_rejects;
@ -543,6 +671,23 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
return -1;
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
if ((status_ctx->devices_status != STATUS_ABORTED)
&& (status_ctx->devices_status != STATUS_ABORTED_RUNTIME)
&& (status_ctx->devices_status != STATUS_QUIT)
&& (status_ctx->devices_status != STATUS_BYPASS)
&& (status_ctx->devices_status != STATUS_ERROR))
{
if (brain_client_commit (device_param, status_ctx) == false)
{
brain_client_disconnect (device_param);
}
}
}
#endif
device_param->pws_cnt = 0;
device_param->pws_base_cnt = 0;
@ -673,6 +818,39 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
u64 words_off = device_param->words_off;
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
if (device_param->brain_link_client_fd == -1)
{
const i64 passwords_max = device_param->hardware_power * device_param->kernel_accel;
if (brain_client_connect (device_param, status_ctx, user_options->brain_host, user_options->brain_port, user_options->brain_password, user_options->brain_session, user_options->brain_attack, passwords_max, &highest) == false)
{
brain_client_disconnect (device_param);
}
}
if (user_options->brain_client_features & BRAIN_CLIENT_FEATURE_ATTACKS)
{
u64 overlap = 0;
if (brain_client_reserve (device_param, status_ctx, words_off, work, &overlap) == false)
{
brain_client_disconnect (device_param);
}
words_extra = overlap;
words_extra_total += overlap;
words_off += overlap;
work -= overlap;
}
}
#endif
words_fin = words_off + work;
slow_candidates_seek (hashcat_ctx_tmp, &extra_info_combi, words_cur, words_off);
@ -692,6 +870,20 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
continue;
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
u32 hash[2];
brain_client_generate_hash ((u64 *) hash, (const char *) extra_info_combi.out_buf, extra_info_combi.out_len);
u32 *ptr = (u32 *) device_param->brain_link_out_buf;
ptr[(device_param->pws_pre_cnt * 2) + 0] = hash[0];
ptr[(device_param->pws_pre_cnt * 2) + 1] = hash[1];
}
#endif
pw_pre_add (device_param, extra_info_combi.out_buf, extra_info_combi.out_len, NULL, 0, 0);
if (status_ctx->run_thread_level1 == false) break;
@ -704,6 +896,49 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (status_ctx->run_thread_level1 == false) break;
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
if (user_options->brain_client_features & BRAIN_CLIENT_FEATURE_HASHES)
{
if (brain_client_lookup (device_param, status_ctx) == false)
{
brain_client_disconnect (device_param);
}
}
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
{
if (device_param->brain_link_in_buf[pws_pre_idx] == 1)
{
pre_rejects++;
}
else
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + pws_pre_idx;
pw_base_add (device_param, pw_pre);
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
}
}
else
{
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + pws_pre_idx;
pw_base_add (device_param, pw_pre);
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
}
#else
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
@ -714,6 +949,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
#endif
words_extra_total += pre_rejects;
@ -772,6 +1008,23 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
return -1;
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
if ((status_ctx->devices_status != STATUS_ABORTED)
&& (status_ctx->devices_status != STATUS_ABORTED_RUNTIME)
&& (status_ctx->devices_status != STATUS_QUIT)
&& (status_ctx->devices_status != STATUS_BYPASS)
&& (status_ctx->devices_status != STATUS_ERROR))
{
if (brain_client_commit (device_param, status_ctx) == false)
{
brain_client_disconnect (device_param);
}
}
}
#endif
device_param->pws_cnt = 0;
device_param->pws_base_cnt = 0;
@ -846,6 +1099,39 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
u64 words_off = device_param->words_off;
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
if (device_param->brain_link_client_fd == -1)
{
const i64 passwords_max = device_param->hardware_power * device_param->kernel_accel;
if (brain_client_connect (device_param, status_ctx, user_options->brain_host, user_options->brain_port, user_options->brain_password, user_options->brain_session, user_options->brain_attack, passwords_max, &highest) == false)
{
brain_client_disconnect (device_param);
}
}
if (user_options->brain_client_features & BRAIN_CLIENT_FEATURE_ATTACKS)
{
u64 overlap = 0;
if (brain_client_reserve (device_param, status_ctx, words_off, work, &overlap) == false)
{
brain_client_disconnect (device_param);
}
words_extra = overlap;
words_extra_total += overlap;
words_off += overlap;
work -= overlap;
}
}
#endif
words_fin = words_off + work;
words_cur = words_off;
@ -856,6 +1142,20 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
slow_candidates_next (hashcat_ctx, &extra_info_mask);
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
u32 hash[2];
brain_client_generate_hash ((u64 *) hash, (const char *) extra_info_mask.out_buf, extra_info_mask.out_len);
u32 *ptr = (u32 *) device_param->brain_link_out_buf;
ptr[(device_param->pws_pre_cnt * 2) + 0] = hash[0];
ptr[(device_param->pws_pre_cnt * 2) + 1] = hash[1];
}
#endif
pw_pre_add (device_param, extra_info_mask.out_buf, extra_info_mask.out_len, NULL, 0, 0);
if (status_ctx->run_thread_level1 == false) break;
@ -868,6 +1168,45 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (status_ctx->run_thread_level1 == false) break;
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
if (user_options->brain_client_features & BRAIN_CLIENT_FEATURE_HASHES)
{
if (brain_client_lookup (device_param, status_ctx) == false)
{
brain_client_disconnect (device_param);
}
}
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
{
if (device_param->brain_link_in_buf[pws_pre_idx] == 1)
{
pre_rejects++;
}
else
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + pws_pre_idx;
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
}
}
else
{
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
{
pw_pre_t *pw_pre = device_param->pws_pre_buf + pws_pre_idx;
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
}
#else
u64 pws_pre_cnt = device_param->pws_pre_cnt;
for (u64 pws_pre_idx = 0; pws_pre_idx < pws_pre_cnt; pws_pre_idx++)
@ -876,6 +1215,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
pw_add (device_param, (const u8 *) pw_pre->pw_buf, (const int) pw_pre->pw_len);
}
#endif
words_extra_total += pre_rejects;
@ -918,6 +1258,23 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
return -1;
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
if ((status_ctx->devices_status != STATUS_ABORTED)
&& (status_ctx->devices_status != STATUS_ABORTED_RUNTIME)
&& (status_ctx->devices_status != STATUS_QUIT)
&& (status_ctx->devices_status != STATUS_BYPASS)
&& (status_ctx->devices_status != STATUS_ERROR))
{
if (brain_client_commit (device_param, status_ctx) == false)
{
brain_client_disconnect (device_param);
}
}
}
#endif
device_param->pws_cnt = 0;
}
@ -935,6 +1292,13 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (words_fin == 0) break;
}
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
brain_client_disconnect (device_param);
}
#endif
}
else
{

View File

@ -51,6 +51,10 @@
#include "user_options.h"
#include "wordlist.h"
#ifdef WITH_BRAIN
#include "brain.h"
#endif
// inner2_loop iterates through wordlists, then calls kernel execution
static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
@ -159,6 +163,10 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx)
status_ctx->words_progress_restored[i] = progress_restored;
}
#ifdef WITH_BRAIN
user_options->brain_attack = brain_compute_attack (hashcat_ctx);
#endif
/**
* limit kernel loops by the amplification count we have from:
* - straight_ctx, combinator_ctx or mask_ctx for fast hashes
@ -1372,6 +1380,10 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
hashcat_status->salts_done = status_get_salts_done (hashcat_ctx);
hashcat_status->salts_percent = status_get_salts_percent (hashcat_ctx);
hashcat_status->session = status_get_session (hashcat_ctx);
#ifdef WITH_BRAIN
hashcat_status->brain_session = status_get_brain_session (hashcat_ctx);
hashcat_status->brain_attack = status_get_brain_attack (hashcat_ctx);
#endif
hashcat_status->status_string = status_get_status_string (hashcat_ctx);
hashcat_status->status_number = status_get_status_number (hashcat_ctx);
hashcat_status->time_estimated_absolute = status_get_time_estimated_absolute (hashcat_ctx);
@ -1415,6 +1427,14 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
device_info->innerloop_left_dev = status_get_innerloop_left_dev (hashcat_ctx, device_id);
device_info->iteration_pos_dev = status_get_iteration_pos_dev (hashcat_ctx, device_id);
device_info->iteration_left_dev = status_get_iteration_left_dev (hashcat_ctx, device_id);
#ifdef WITH_BRAIN
device_info->brain_link_client_id_dev = status_get_brain_link_client_id_dev (hashcat_ctx, device_id);
device_info->brain_link_status_dev = status_get_brain_link_status_dev (hashcat_ctx, device_id);
device_info->brain_link_recv_bytes_dev = status_get_brain_link_recv_bytes_dev (hashcat_ctx, device_id);
device_info->brain_link_send_bytes_dev = status_get_brain_link_send_bytes_dev (hashcat_ctx, device_id);
device_info->brain_link_recv_bytes_sec_dev = status_get_brain_link_recv_bytes_sec_dev (hashcat_ctx, device_id);
device_info->brain_link_send_bytes_sec_dev = status_get_brain_link_send_bytes_sec_dev (hashcat_ctx, device_id);
#endif
}
hashcat_status->hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx);

View File

@ -27,6 +27,10 @@
#include "timer.h"
#include "locking.h"
#ifdef WITH_BRAIN
#include "brain.h"
#endif
int sort_by_string (const void *p1, const void *p2)
{
const char *s1 = (const char *) p1;
@ -1664,6 +1668,14 @@ int hashes_init_stage4 (hashcat_ctx_t *hashcat_ctx)
hashes->tmp_buf = tmp_buf;
// brain session
#ifdef WITH_BRAIN
const u32 brain_session = brain_compute_session (hashcat_ctx);
user_options->brain_session = brain_session;
#endif
return 0;
}

View File

@ -21,6 +21,10 @@
#include "shared.h"
#include "event.h"
#ifdef WITH_BRAIN
#include "brain.h"
#endif
#if defined (__MINGW64__) || defined (__MINGW32__)
int _dowildcard = -1;
#endif
@ -1042,6 +1046,15 @@ int main (int argc, char **argv)
user_options_t *user_options = hashcat_ctx->user_options;
#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);
return rc;
}
#endif
if (user_options->version == true)
{
printf ("%s\n", VERSION_TAG);

View File

@ -6456,6 +6456,10 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
size_t size_pws_base = 4;
size_t size_tmps = 4;
size_t size_hooks = 4;
#ifdef WITH_BRAIN
size_t size_brain_link_in = 4;
size_t size_brain_link_out = 4;
#endif
// instead of a thread limit we can also use a memory limit.
// this value should represent a reasonable amount of memory a host system has per GPU.
@ -6494,6 +6498,13 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
size_hooks = (size_t) kernel_power_max * hashconfig->hook_size;
#ifdef WITH_BRAIN
// size_brains
size_brain_link_in = (size_t) kernel_power_max * 1;
size_brain_link_out = (size_t) kernel_power_max * 8;
#endif
if (user_options->slow_candidates == true)
{
// size_pws_pre
@ -6558,6 +6569,10 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
= size_pws_comp
+ size_pws_idx
+ size_hooks
#ifdef WITH_BRAIN
+ size_brain_link_in
+ size_brain_link_out
#endif
+ size_pws_pre
+ size_pws_base;
@ -6591,6 +6606,10 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->size_pws_base = size_pws_base;
device_param->size_tmps = size_tmps;
device_param->size_hooks = size_hooks;
#ifdef WITH_BRAIN
device_param->size_brain_link_in = size_brain_link_in;
device_param->size_brain_link_out = size_brain_link_out;
#endif
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_pws, NULL, &device_param->d_pws_buf); if (CL_rc == -1) return -1;
CL_rc = hc_clCreateBuffer (hashcat_ctx, device_param->context, CL_MEM_READ_WRITE, size_pws_amp, NULL, &device_param->d_pws_amp_buf); if (CL_rc == -1) return -1;
@ -6630,6 +6649,16 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
device_param->scratch_buf = scratch_buf;
#ifdef WITH_BRAIN
u8 *brain_link_in_buf = (u8 *) hcmalloc (size_brain_link_in);
device_param->brain_link_in_buf = brain_link_in_buf;
u32 *brain_link_out_buf = (u32 *) hcmalloc (size_brain_link_out);
device_param->brain_link_out_buf = brain_link_out_buf;
#endif
pw_pre_t *pws_pre_buf = (pw_pre_t *) hcmalloc (size_pws_pre);
device_param->pws_pre_buf = pws_pre_buf;
@ -6749,6 +6778,10 @@ void opencl_session_destroy (hashcat_ctx_t *hashcat_ctx)
hcfree (device_param->combs_buf);
hcfree (device_param->hooks_buf);
hcfree (device_param->scratch_buf);
#ifdef WITH_BRAIN
hcfree (device_param->brain_link_in_buf);
hcfree (device_param->brain_link_out_buf);
#endif
if (device_param->d_pws_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_pws_buf);
if (device_param->d_pws_amp_buf) hc_clReleaseMemObject (hashcat_ctx, device_param->d_pws_amp_buf);

View File

@ -230,6 +230,22 @@ char *status_get_session (const hashcat_ctx_t *hashcat_ctx)
return strdup (user_options->session);
}
#ifdef WITH_BRAIN
int status_get_brain_session (const hashcat_ctx_t *hashcat_ctx)
{
const user_options_t *user_options = hashcat_ctx->user_options;
return user_options->brain_session;
}
int status_get_brain_attack (const hashcat_ctx_t *hashcat_ctx)
{
const user_options_t *user_options = hashcat_ctx->user_options;
return user_options->brain_attack;
}
#endif
const char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx)
{
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
@ -1768,6 +1784,136 @@ int status_get_iteration_left_dev (const hashcat_ctx_t *hashcat_ctx, const int d
return iteration_left;
}
#ifdef WITH_BRAIN
int status_get_brain_link_client_id_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
int brain_client_id = -1;
if (device_param->skipped == false)
{
brain_client_id = device_param->brain_link_client_fd;
}
return brain_client_id;
}
int status_get_brain_link_status_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
int brain_link_status_dev = 0;
if (device_param->skipped == false)
{
if (device_param->brain_link_client_fd != -1) brain_link_status_dev = BRAIN_LINK_STATUS_CONNECTED;
if (device_param->brain_link_recv_active == true) brain_link_status_dev = BRAIN_LINK_STATUS_RECEIVING;
if (device_param->brain_link_send_active == true) brain_link_status_dev = BRAIN_LINK_STATUS_SENDING;
}
return brain_link_status_dev;
}
char *status_get_brain_link_recv_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
u64 brain_link_recv_bytes = 0;
if (device_param->skipped == false)
{
brain_link_recv_bytes = device_param->brain_link_recv_bytes;
}
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
format_speed_display_1k (brain_link_recv_bytes, display, HCBUFSIZ_TINY);
return display;
}
char *status_get_brain_link_send_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
u64 brain_link_send_bytes = 0;
if (device_param->skipped == false)
{
brain_link_send_bytes = device_param->brain_link_send_bytes;
}
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
format_speed_display_1k (brain_link_send_bytes, display, HCBUFSIZ_TINY);
return display;
}
char *status_get_brain_link_recv_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
u64 brain_link_recv_bytes = 0;
if (device_param->skipped == false)
{
for (int idx = 0; idx < LINK_SPEED_COUNT; idx++)
{
double ms = hc_timer_get (device_param->brain_link_recv_speed.timer[idx]);
if (ms >= 1000) continue;
brain_link_recv_bytes += device_param->brain_link_recv_speed.bytes[idx];
}
}
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
snprintf (display, HCBUFSIZ_TINY - 1, "%.2f M", (double) (brain_link_recv_bytes * 8) / 1024 / 1024);
return display;
}
char *status_get_brain_link_send_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];
u64 brain_link_send_bytes = 0;
if (device_param->skipped == false)
{
for (int idx = 0; idx < LINK_SPEED_COUNT; idx++)
{
double ms = hc_timer_get (device_param->brain_link_send_speed.timer[idx]);
if (ms >= 1000) continue;
brain_link_send_bytes += device_param->brain_link_send_speed.bytes[idx];
}
}
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
snprintf (display, HCBUFSIZ_TINY - 1, "%.2f M", (double) (brain_link_send_bytes * 8) / 1024 / 1024);
return display;
}
#endif
char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
@ -2060,9 +2206,21 @@ void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashca
hcfree (device_info->speed_sec_dev);
hcfree (device_info->guess_candidates_dev);
hcfree (device_info->hwmon_dev);
#ifdef WITH_BRAIN
hcfree (device_info->brain_link_recv_bytes_dev);
hcfree (device_info->brain_link_send_bytes_dev);
hcfree (device_info->brain_link_recv_bytes_sec_dev);
hcfree (device_info->brain_link_send_bytes_sec_dev);
#endif
device_info->speed_sec_dev = NULL;
device_info->guess_candidates_dev = NULL;
device_info->hwmon_dev = NULL;
#ifdef WITH_BRAIN
device_info->brain_link_recv_bytes_dev = NULL;
device_info->brain_link_send_bytes_dev = NULL;
device_info->brain_link_recv_bytes_sec_dev = NULL;
device_info->brain_link_send_bytes_sec_dev = NULL;
#endif
}
}

View File

@ -898,9 +898,26 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
* show something
*/
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
event_log_info (hashcat_ctx,
"Session..........: %s (Brain Session/Attack:0x%08x/0x%08x)",
hashcat_status->session,
hashcat_status->brain_session,
hashcat_status->brain_attack);
}
else
{
event_log_info (hashcat_ctx,
"Session..........: %s",
hashcat_status->session);
}
#else
event_log_info (hashcat_ctx,
"Session..........: %s",
hashcat_status->session);
#endif
event_log_info (hashcat_ctx,
"Status...........: %s",
@ -1279,6 +1296,63 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
break;
}
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
for (int device_id = 0; device_id < hashcat_status->device_info_cnt; device_id++)
{
const device_info_t *device_info = hashcat_status->device_info_buf + device_id;
if (device_info->skipped_dev == true) continue;
if (device_info->brain_link_status_dev == BRAIN_LINK_STATUS_CONNECTED)
{
event_log_info (hashcat_ctx,
"Brain.Link.#%d....: RX: %sB (%sbps), TX: %sB (%sbps), idle", device_id + 1,
device_info->brain_link_recv_bytes_dev,
device_info->brain_link_recv_bytes_sec_dev,
device_info->brain_link_send_bytes_dev,
device_info->brain_link_send_bytes_sec_dev);
}
else if (device_info->brain_link_status_dev == BRAIN_LINK_STATUS_RECEIVING)
{
event_log_info (hashcat_ctx,
"Brain.Link.#%d....: RX: %sB (%sbps), TX: %sB (%sbps), receiving", device_id + 1,
device_info->brain_link_recv_bytes_dev,
device_info->brain_link_recv_bytes_sec_dev,
device_info->brain_link_send_bytes_dev,
device_info->brain_link_send_bytes_sec_dev);
}
else if (device_info->brain_link_status_dev == BRAIN_LINK_STATUS_SENDING)
{
event_log_info (hashcat_ctx,
"Brain.Link.#%d....: RX: %sB (%sbps), TX: %sB (%sbps), sending", device_id + 1,
device_info->brain_link_recv_bytes_dev,
device_info->brain_link_recv_bytes_sec_dev,
device_info->brain_link_send_bytes_dev,
device_info->brain_link_send_bytes_sec_dev);
}
else
{
if ((device_info->brain_link_time_recv_dev > 0) && (device_info->brain_link_time_send_dev > 0))
{
event_log_info (hashcat_ctx,
"Brain.Link.#%d....: RX: %sB (%sbps), TX: %sB (%sbps)", device_id + 1,
device_info->brain_link_recv_bytes_dev,
device_info->brain_link_recv_bytes_sec_dev,
device_info->brain_link_send_bytes_dev,
device_info->brain_link_send_bytes_sec_dev);
}
else
{
event_log_info (hashcat_ctx,
"Brain.Link.#%d....: N/A", device_id + 1);
}
}
}
}
#endif
switch (hashcat_status->progress_mode)
{
case PROGRESS_MODE_KEYSPACE_KNOWN:

View File

@ -116,6 +116,16 @@ static const char *const USAGE_BIG[] =
" --increment-min | Num | Start mask incrementing at X | --increment-min=4",
" --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
" -S, --slow-candidates | | Enable slower (but advanced) candidate generators |",
#ifdef WITH_BRAIN
" --brain-server | | Enable brain server |",
" -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",
" --brain-port | Port | Brain server port | --brain-port=13743",
" --brain-password | Str | Brain server authentication password | --brain-password=bZfhCvGUSjRq",
" --brain-session | Hex | Overrides automatically calculated brain session | --brain-session=0x2ae611db",
" --brain-session-whitelist | Hex | Allow given sessions only, separated with commas | --brain-session-whitelist=0x2ae611db",
#endif
"",
"- [ Hash modes ] -",
"",
@ -383,6 +393,16 @@ static const char *const USAGE_BIG[] =
" 18100 | TOTP (HMAC-SHA1) | One-Time Passwords",
" 99999 | Plaintext | Plaintext",
"",
#ifdef WITH_BRAIN
"- [ Brain Client Features ] -",
"",
" # | Features",
" ===+========",
" 1 | Send hashed passwords",
" 2 | Send attack positions",
" 3 | Send hashed passwords and attack positions",
"",
#endif
"- [ Outfile Formats ] -",
"",
" # | Format",

View File

@ -14,7 +14,15 @@
#include "outfile.h"
#include "user_options.h"
#ifdef WITH_BRAIN
#include "brain.h"
#endif
#ifdef WITH_BRAIN
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:iIbw:OSz";
#else
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:iIbw:OS";
#endif
static const struct option long_options[] =
{
@ -110,6 +118,16 @@ static const struct option long_options[] =
{"version", no_argument, NULL, IDX_VERSION},
{"wordlist-autohex-disable", no_argument, NULL, IDX_WORDLIST_AUTOHEX_DISABLE},
{"workload-profile", required_argument, NULL, IDX_WORKLOAD_PROFILE},
#ifdef WITH_BRAIN
{"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-host", required_argument, NULL, IDX_BRAIN_HOST},
{"brain-port", required_argument, NULL, IDX_BRAIN_PORT},
{"brain-password", required_argument, NULL, IDX_BRAIN_PASSWORD},
{"brain-session", required_argument, NULL, IDX_BRAIN_SESSION},
{"brain-session-whitelist", required_argument, NULL, IDX_BRAIN_SESSION_WHITELIST},
#endif
{NULL, 0, NULL, 0 }
};
@ -133,6 +151,15 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->benchmark = BENCHMARK;
user_options->bitmap_max = BITMAP_MAX;
user_options->bitmap_min = BITMAP_MIN;
#ifdef WITH_BRAIN
user_options->brain_client = BRAIN_CLIENT;
user_options->brain_client_features = BRAIN_CLIENT_FEATURES;
user_options->brain_host = NULL;
user_options->brain_port = BRAIN_PORT;
user_options->brain_server = BRAIN_SERVER;
user_options->brain_session = BRAIN_SESSION;
user_options->brain_session_whitelist = NULL;
#endif
user_options->cpu_affinity = NULL;
user_options->custom_charset_1 = NULL;
user_options->custom_charset_2 = NULL;
@ -284,6 +311,9 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_BITMAP_MAX:
case IDX_INCREMENT_MIN:
case IDX_INCREMENT_MAX:
#ifdef WITH_BRAIN
case IDX_BRAIN_PORT:
#endif
if (hc_string_is_digit (optarg) == false)
{
@ -421,6 +451,19 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_CUSTOM_CHARSET_3: user_options->custom_charset_3 = optarg; break;
case IDX_CUSTOM_CHARSET_4: user_options->custom_charset_4 = optarg; break;
case IDX_SLOW_CANDIDATES: user_options->slow_candidates = true; break;
#ifdef WITH_BRAIN
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_PASSWORD: user_options->brain_password = optarg;
user_options->brain_password_chgd = true; break;
case IDX_BRAIN_HOST: user_options->brain_host = optarg;
user_options->brain_host_chgd = true; break;
case IDX_BRAIN_PORT: user_options->brain_port = hc_strtoul (optarg, NULL, 10);
user_options->brain_port_chgd = true; break;
case IDX_BRAIN_SESSION: user_options->brain_session = hc_strtoul (optarg, NULL, 16); break;
case IDX_BRAIN_SESSION_WHITELIST: user_options->brain_session_whitelist = optarg; break;
#endif
}
}
@ -450,6 +493,29 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
#ifdef WITH_BRAIN
if ((user_options->brain_client == true) && (user_options->brain_server == true))
{
event_log_error (hashcat_ctx, "Can not have --brain-client and --brain-server at the same time");
return -1;
}
if ((user_options->brain_client_features < 1) && (user_options->brain_client_features > 3))
{
event_log_error (hashcat_ctx, "Invalid --brain-client-feature argument");
return -1;
}
if ((user_options->brain_client == true) && (user_options->brain_password_chgd == false))
{
event_log_error (hashcat_ctx, "Brain clients need to set --brain-password");
return -1;
}
#endif
if (user_options->slow_candidates == true)
{
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
@ -461,6 +527,19 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
}
#ifdef WITH_BRAIN
else if (user_options->brain_client == true)
{
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
&& (user_options->attack_mode != ATTACK_MODE_COMBI)
&& (user_options->attack_mode != ATTACK_MODE_BF))
{
event_log_error (hashcat_ctx, "Invalid attack mode (-a) value specified in brain-client mode.");
return -1;
}
}
#endif
else
{
if ((user_options->attack_mode != ATTACK_MODE_STRAIGHT)
@ -979,6 +1058,22 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
}
}
#ifdef WITH_BRAIN
if ((user_options->brain_client == true) && (user_options->remove == true))
{
event_log_error (hashcat_ctx, "Using --remove is not allowed if --brain-client is used.");
return -1;
}
if ((user_options->brain_client == true) && (user_options->potfile_disable == true))
{
event_log_error (hashcat_ctx, "Using --potfile-disable is not allowed if --brain-client is used.");
return -1;
}
#endif
// custom charset checks
if ((user_options->custom_charset_1 != NULL)
@ -1037,6 +1132,12 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
show_error = false;
}
#ifdef WITH_BRAIN
else if (user_options->brain_server == true)
{
show_error = false;
}
#endif
else if (user_options->benchmark == true)
{
if (user_options->hc_argc == 0)
@ -1153,6 +1254,15 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
{
// stdin mode
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
event_log_error (hashcat_ctx, "Use of --brain-client is not possible in stdin mode.");
return -1;
}
#endif
if (user_options->slow_candidates == true)
{
event_log_error (hashcat_ctx, "Use of --slow-candidates is not possible in stdin mode.");
@ -1260,6 +1370,13 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
// some options can influence or overwrite other options
#ifdef WITH_BRAIN
if (user_options->brain_client == true)
{
user_options->slow_candidates = true;
}
#endif
if (user_options->example_hashes == true
|| user_options->opencl_info == true
|| user_options->keyspace == true
@ -1281,6 +1398,9 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
user_options->status_timer = 0;
user_options->bitmap_min = 1;
user_options->bitmap_max = 1;
#ifdef WITH_BRAIN
user_options->brain_client = false;
#endif
}
if (user_options->benchmark == true)
@ -1302,6 +1422,9 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
user_options->status_timer = 0;
user_options->bitmap_min = 1;
user_options->bitmap_max = 1;
#ifdef WITH_BRAIN
user_options->brain_client = false;
#endif
if (user_options->workload_profile_chgd == false)
{
@ -1745,6 +1868,51 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx)
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
user_options_t *user_options = hashcat_ctx->user_options;
// brain
#ifdef WITH_BRAIN
#if defined (_WIN)
if ((user_options->brain_client == true) || (user_options->brain_server == true))
{
WSADATA wsaData;
WORD wVersionRequested = MAKEWORD (2,2);
const int iResult = WSAStartup (wVersionRequested, &wsaData);
if (iResult != NO_ERROR)
{
fprintf (stderr, "WSAStartup: %s\n", strerror (errno));
return -1;
}
}
#endif
if (user_options->brain_host)
{
struct addrinfo hints;
memset (&hints, 0, sizeof (hints));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
struct addrinfo *address_info = NULL;
const int rc_getaddrinfo = getaddrinfo (user_options->brain_host, NULL, &hints, &address_info);
if (rc_getaddrinfo != 0)
{
fprintf (stderr, "%s: %s\n", user_options->brain_host, gai_strerror (rc_getaddrinfo));
return -1;
}
freeaddrinfo (address_info);
}
#endif
// common folders
#if defined (_WIN)
@ -2322,6 +2490,9 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
logfile_top_char (user_options->separator);
#ifdef WITH_BRAIN
logfile_top_string (user_options->brain_session_whitelist);
#endif
logfile_top_string (user_options->cpu_affinity);
logfile_top_string (user_options->custom_charset_1);
logfile_top_string (user_options->custom_charset_2);
@ -2345,6 +2516,9 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_string (user_options->session);
logfile_top_string (user_options->truecrypt_keyfiles);
logfile_top_string (user_options->veracrypt_keyfiles);
#ifdef WITH_BRAIN
logfile_top_string (user_options->brain_host);
#endif
logfile_top_uint64 (user_options->limit);
logfile_top_uint64 (user_options->skip);
logfile_top_uint (user_options->attack_mode);
@ -2411,4 +2585,11 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_uint (user_options->veracrypt_pim);
logfile_top_uint (user_options->version);
logfile_top_uint (user_options->workload_profile);
#ifdef WITH_BRAIN
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_port);
logfile_top_uint (user_options->brain_session);
#endif
}