Added new feature (-Y) that creates N virtual instances for each device in your system at the cost of N times the device memory consumption

pull/3678/head^2
jsteube 1 year ago
parent 9b96649672
commit 6785a32e7a

@ -29,6 +29,12 @@
- Added hash-mode: md5(md5($salt).md5(md5($pass)))
- Added hash-mode: md5(md5(md5($pass).$salt1).$salt2)
##
## Features
##
- Added new feature (-Y) that creates N virtual instances for each device in your system at the cost of N times the device memory consumption
##
## Performance
##

@ -425,9 +425,9 @@ _hashcat ()
local HIDDEN_FILES_AGGRESSIVE="${HIDDEN_FILES}|hcmask|hcchr"
local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H'
local SHORT_OPTS="-m -a -V -h -b -t -T -o -p -c -d -D -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z -M"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --stdin-timeout-abort --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-inverse --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 --deprecated-check-disable --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 --hash-info --backend-ignore-cuda --backend-ignore-opencl --backend-ignore-hip --backend-ignore-metal --backend-info --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --multiply-accel-disable --self-test-disable --slow-candidates --brain-server --brain-server-timer --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password --identify"
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 --stdin-timeout-abort --markov-hcstat2 --markov-threshold --runtime --session --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 --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-server-timer --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-session-whitelist"
local SHORT_OPTS="-m -a -V -h -b -t -T -o -p -c -d -D -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z -M -Y"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --stdin-timeout-abort --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-inverse --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 --deprecated-check-disable --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 --hash-info --backend-ignore-cuda --backend-ignore-opencl --backend-ignore-hip --backend-ignore-metal --backend-info --backend-devices --backend-devices-virtual --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --multiply-accel-disable --self-test-disable --slow-candidates --brain-server --brain-server-timer --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password --identify"
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 --stdin-timeout-abort --markov-hcstat2 --markov-threshold --runtime --session --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 --backend-devices --backend-devices-virtual --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-func-sel --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-server-timer --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-session-whitelist"
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"

@ -39,6 +39,8 @@ int backend_session_update_combinator (hashcat_ctx_t *hashcat_ctx);
int backend_session_update_mp (hashcat_ctx_t *hashcat_ctx);
int backend_session_update_mp_rl (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_l, const u32 css_cnt_r);
u32 backend_device_idx_real_from_virtual (const u32 device_idx, const u32 backend_devices_virtual);
void generate_source_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *shared_dir, char *source_file);
void generate_cached_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *cache_dir, const char *device_name_chksum, char *cached_file, bool is_metal);
void generate_source_kernel_shared_filename (char *shared_dir, char *source_file);

@ -628,6 +628,7 @@ typedef enum user_options_defaults
ADVICE_DISABLE = false,
ATTACK_MODE = ATTACK_MODE_STRAIGHT,
AUTODETECT = false,
BACKEND_DEVICES_VIRTUAL = 1,
BENCHMARK_ALL = false,
BENCHMARK = false,
BITMAP_MAX = 18,
@ -728,6 +729,7 @@ typedef enum user_options_map
IDX_ADVICE_DISABLE = 0xff00,
IDX_ATTACK_MODE = 'a',
IDX_BACKEND_DEVICES = 'd',
IDX_BACKEND_DEVICES_VIRTUAL = 'Y',
IDX_BACKEND_IGNORE_CUDA = 0xff01,
IDX_BACKEND_IGNORE_HIP = 0xff02,
IDX_BACKEND_IGNORE_METAL = 0xff03,
@ -1073,6 +1075,7 @@ typedef struct hashconfig
bool forced_jit_compile;
u32 pwdump_column;
} hashconfig_t;
typedef struct pw_pre
@ -1876,6 +1879,7 @@ typedef struct backend_ctx
int backend_device_from_opencl_platform[CL_PLATFORMS_MAX][DEVICES_MAX]; // from opencl device index to backend device index (by platform)
int backend_devices_cnt;
int backend_devices_virtual;
int backend_devices_active;
int cuda_devices_cnt;
@ -2396,6 +2400,7 @@ typedef struct user_options
const char *rule_buf_r;
const char *session;
u32 attack_mode;
u32 backend_devices_virtual;
u32 backend_info;
u32 bitmap_max;
u32 bitmap_min;

@ -617,6 +617,11 @@ static bool write_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_
return true;
}
u32 backend_device_idx_real_from_virtual (const u32 device_idx, const u32 backend_devices_virtual)
{
return device_idx / backend_devices_virtual;
}
void generate_source_kernel_filename (const bool slow_candidates, const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *shared_dir, char *source_file)
{
if (opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
@ -4855,6 +4860,13 @@ int backend_ctx_init (hashcat_ctx_t *hashcat_ctx)
}
}
opencl_platform_devices_cnt *= user_options->backend_devices_virtual;
for (int i = opencl_platform_devices_cnt - 1; i >= 0; i--)
{
opencl_platform_devices[i] = opencl_platform_devices[backend_device_idx_real_from_virtual (i, user_options->backend_devices_virtual)];
}
opencl_platforms_devices[opencl_platforms_idx] = opencl_platform_devices;
opencl_platforms_devices_cnt[opencl_platforms_idx] = opencl_platform_devices_cnt;
}
@ -5025,6 +5037,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
cuda_close (hashcat_ctx);
}
cuda_devices_cnt *= user_options->backend_devices_virtual;
backend_ctx->cuda_devices_cnt = cuda_devices_cnt;
// device specific
@ -5033,6 +5047,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
{
const u32 device_id = backend_devices_idx;
const u32 cuda_devices_idx_real = backend_device_idx_real_from_virtual (cuda_devices_idx, user_options->backend_devices_virtual);
hc_device_param_t *device_param = &devices_param[backend_devices_idx];
device_param->device_id = device_id;
@ -5041,7 +5057,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
CUdevice cuda_device;
if (hc_cuDeviceGet (hashcat_ctx, &cuda_device, cuda_devices_idx) == -1)
if (hc_cuDeviceGet (hashcat_ctx, &cuda_device, cuda_devices_idx_real) == -1)
{
device_param->skipped = true;
@ -5432,6 +5448,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
hip_close (hashcat_ctx);
}
hip_devices_cnt *= user_options->backend_devices_virtual;
backend_ctx->hip_devices_cnt = hip_devices_cnt;
// device specific
@ -5440,6 +5458,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
{
const u32 device_id = backend_devices_idx;
const u32 hip_devices_idx_real = backend_device_idx_real_from_virtual (hip_devices_idx, user_options->backend_devices_virtual);
hc_device_param_t *device_param = &devices_param[backend_devices_idx];
device_param->device_id = device_id;
@ -5448,7 +5468,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
hipDevice_t hip_device;
if (hc_hipDeviceGet (hashcat_ctx, &hip_device, hip_devices_idx) == -1)
if (hc_hipDeviceGet (hashcat_ctx, &hip_device, hip_devices_idx_real) == -1)
{
device_param->skipped = true;
@ -5860,6 +5880,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
mtl_close (hashcat_ctx);
}
metal_devices_cnt *= user_options->backend_devices_virtual;
backend_ctx->metal_devices_cnt = metal_devices_cnt;
// device specific
@ -5868,6 +5890,8 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
{
const u32 device_id = backend_devices_idx;
const u32 metal_devices_idx_real = backend_device_idx_real_from_virtual (metal_devices_idx, user_options->backend_devices_virtual);
hc_device_param_t *device_param = &devices_param[backend_devices_idx];
device_param->device_id = device_id;
@ -5876,7 +5900,7 @@ int backend_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
mtl_device_id metal_device = NULL;
if (hc_mtlDeviceGet (hashcat_ctx, &metal_device, metal_devices_idx) == -1)
if (hc_mtlDeviceGet (hashcat_ctx, &metal_device, metal_devices_idx_real) == -1)
{
device_param->skipped = true;

@ -99,6 +99,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
" --backend-ignore-opencl | | Do not try to open OpenCL interface on startup |",
" -I, --backend-info | | Show system/evironment/backend API info | -I or -II",
" -d, --backend-devices | Str | Backend devices to use, separated with commas | -d 1",
" -Y, --backend-devices-virtual | Num | Spawn X virtual instances for each real device | -Y 8",
" -D, --opencl-device-types | Str | OpenCL device-types to use, separated with commas | -D 1",
" -O, --optimized-kernel-enable | | Enable optimized kernels (limits password length) |",
" -M, --multiply-accel-disable | | Disable multiply kernel-accel with processor count |",

@ -21,9 +21,9 @@
#endif
#ifdef WITH_BRAIN
static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSz";
static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSY:z";
#else
static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMS";
static const char *const short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSY:";
#endif
static char *const SEPARATOR = ":";
@ -33,6 +33,7 @@ static const struct option long_options[] =
{"advice-disable", no_argument, NULL, IDX_ADVICE_DISABLE},
{"attack-mode", required_argument, NULL, IDX_ATTACK_MODE},
{"backend-devices", required_argument, NULL, IDX_BACKEND_DEVICES},
{"backend-devices-virtual", required_argument, NULL, IDX_BACKEND_DEVICES_VIRTUAL},
{"backend-ignore-cuda", no_argument, NULL, IDX_BACKEND_IGNORE_CUDA},
{"backend-ignore-hip", no_argument, NULL, IDX_BACKEND_IGNORE_HIP},
#if defined (__APPLE__)
@ -171,6 +172,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->attack_mode = ATTACK_MODE;
user_options->autodetect = AUTODETECT;
user_options->backend_devices = NULL;
user_options->backend_devices_virtual = BACKEND_DEVICES_VIRTUAL;
user_options->backend_ignore_cuda = BACKEND_IGNORE_CUDA;
user_options->backend_ignore_hip = BACKEND_IGNORE_HIP;
#if defined (__APPLE__)
@ -353,6 +355,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_INCREMENT_MIN:
case IDX_INCREMENT_MAX:
case IDX_HOOK_THREADS:
case IDX_BACKEND_DEVICES_VIRTUAL:
#ifdef WITH_BRAIN
case IDX_BRAIN_PORT:
#endif
@ -467,6 +470,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_BACKEND_IGNORE_OPENCL: user_options->backend_ignore_opencl = true; break;
case IDX_BACKEND_INFO: user_options->backend_info++; break;
case IDX_BACKEND_DEVICES: user_options->backend_devices = optarg; break;
case IDX_BACKEND_DEVICES_VIRTUAL: user_options->backend_devices_virtual = hc_strtoul (optarg, NULL, 10); break;
case IDX_BACKEND_VECTOR_WIDTH: user_options->backend_vector_width = hc_strtoul (optarg, NULL, 10);
user_options->backend_vector_width_chgd = true; break;
case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break;
@ -559,7 +563,7 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
#ifdef WITH_BRAIN
#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.");
@ -612,17 +616,20 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
if (user_options->separator_chgd == true)
{
bool error = false;
if ((strlen (user_options->separator) != 1) && (strlen (user_options->separator) != 4))
{
error = true;
}
if (strlen (user_options->separator) == 4)
{
if ((user_options->separator[0] == '0') && (user_options->separator[1] == 'x'))
{
if (is_valid_hex_string ((u8 * ) (&(user_options->separator[2])), 2))
if (is_valid_hex_string ((u8 *) (&(user_options->separator[2])), 2))
{
u8 sep = hex_to_u8 ((u8 * ) (&(user_options->separator[2])));
u8 sep = hex_to_u8 ((u8 *) (&(user_options->separator[2])));
user_options->separator[0] = sep;
user_options->separator[1] = 0;
}
@ -631,7 +638,8 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
error = true;
}
}
else{
else
{
error = true;
}
}
@ -738,6 +746,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
if (user_options->backend_devices_virtual == 0)
{
event_log_error (hashcat_ctx, "Invalid --backend-devices-virtual value specified.");
return -1;
}
if (user_options->outfile_format == 0)
{
event_log_error (hashcat_ctx, "Invalid --outfile-format value specified.");
@ -2058,6 +2073,11 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "* --backend-devices=%s", user_options->backend_devices);
}
if (user_options->backend_devices_virtual)
{
event_log_info (hashcat_ctx, "* --backend-devices-virtual=%u", user_options->backend_devices_virtual);
}
if (user_options->opencl_device_types)
{
event_log_info (hashcat_ctx, "* --opencl-device-types=%s", user_options->opencl_device_types);
@ -2117,6 +2137,11 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "# option: --backend-devices=%s", user_options->backend_devices);
}
if (user_options->backend_devices_virtual)
{
event_log_info (hashcat_ctx, "# option: --backend-devices-virtual=%u", user_options->backend_devices_virtual);
}
if (user_options->opencl_device_types)
{
event_log_info (hashcat_ctx, "# option: --opencl-device-types=%s", user_options->opencl_device_types);
@ -3147,6 +3172,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_uint64 (user_options->limit);
logfile_top_uint64 (user_options->skip);
logfile_top_uint (user_options->attack_mode);
logfile_top_uint (user_options->backend_devices_virtual);
logfile_top_uint (user_options->benchmark);
logfile_top_uint (user_options->benchmark_all);
logfile_top_uint (user_options->bitmap_max);

Loading…
Cancel
Save