mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-22 14:48:12 +00:00
Added new option --kernel-threads to manually override the automatically calculated number of threads
This commit is contained in:
parent
3eab677bdf
commit
2a366741a5
@ -6,6 +6,7 @@
|
||||
|
||||
- Added support to use --stdout in brain-client mode
|
||||
- Added new option --stdin-timeout-abort, to set how long hashcat should wait for stdin input before aborting
|
||||
- Added new option --kernel-threads to manually override the automatically calculated number of threads
|
||||
|
||||
##
|
||||
## Algorithms
|
||||
|
@ -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 --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 --stdin-timeout-abort"
|
||||
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 --kernel-threads --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 --kernel-threads --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 --stdin-timeout-abort"
|
||||
|
||||
COMPREPLY=()
|
||||
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
|
@ -560,6 +560,7 @@ typedef enum user_options_defaults
|
||||
KEEP_GUESSING = false,
|
||||
KERNEL_ACCEL = 0,
|
||||
KERNEL_LOOPS = 0,
|
||||
KERNEL_THREADS = 0,
|
||||
KEYSPACE = false,
|
||||
LEFT = false,
|
||||
LIMIT = 0,
|
||||
@ -654,6 +655,7 @@ typedef enum user_options_map
|
||||
IDX_KEEP_GUESSING = 0xff1b,
|
||||
IDX_KERNEL_ACCEL = 'n',
|
||||
IDX_KERNEL_LOOPS = 'u',
|
||||
IDX_KERNEL_THREADS = 'T',
|
||||
IDX_KEYSPACE = 0xff1c,
|
||||
IDX_LEFT = 0xff1d,
|
||||
IDX_LIMIT = 'l',
|
||||
@ -1086,8 +1088,6 @@ typedef struct hc_device_param
|
||||
u64 kernel_local_mem_size_aux3;
|
||||
u64 kernel_local_mem_size_aux4;
|
||||
|
||||
u32 kernel_threads;
|
||||
|
||||
u32 kernel_accel;
|
||||
u32 kernel_accel_prev;
|
||||
u32 kernel_accel_min;
|
||||
@ -1098,6 +1098,7 @@ typedef struct hc_device_param
|
||||
u32 kernel_loops_max;
|
||||
u32 kernel_loops_min_sav; // the _sav are required because each -i iteration
|
||||
u32 kernel_loops_max_sav; // needs to recalculate the kernel_loops_min/max based on the current amplifier count
|
||||
u32 kernel_threads;
|
||||
|
||||
u64 kernel_power;
|
||||
u64 hardware_power;
|
||||
@ -1684,6 +1685,7 @@ typedef struct user_options
|
||||
bool increment_min_chgd;
|
||||
bool kernel_accel_chgd;
|
||||
bool kernel_loops_chgd;
|
||||
bool kernel_threads_chgd;
|
||||
bool nonce_error_corrections_chgd;
|
||||
bool nvidia_spin_damp_chgd;
|
||||
bool opencl_vector_width_chgd;
|
||||
@ -1784,6 +1786,7 @@ typedef struct user_options
|
||||
u32 increment_min;
|
||||
u32 kernel_accel;
|
||||
u32 kernel_loops;
|
||||
u32 kernel_threads;
|
||||
u32 markov_threshold;
|
||||
u32 nonce_error_corrections;
|
||||
u32 nvidia_spin_damp;
|
||||
|
@ -28296,9 +28296,10 @@ void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
u32 kernel_threads = 0;
|
||||
u32 kernel_threads = user_options->kernel_threads;
|
||||
|
||||
// this should have a kernel hint attribute in the kernel files
|
||||
// __attribute__((reqd_work_group_size(X, 1, 1)))
|
||||
|
@ -95,6 +95,7 @@ static const char *const USAGE_BIG[] =
|
||||
" -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
|
||||
" -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
|
||||
" -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
|
||||
" -T, --kernel-thread | Num | Manual workload tuning, set thread count to X | -T 64",
|
||||
" --nvidia-spin-damp | Num | Workaround NVIDIAs CPU burning loop bug, in percent | --nvidia-spin-damp=50",
|
||||
" --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
|
||||
" --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees Celsius | --gpu-temp-abort=100",
|
||||
|
@ -19,9 +19,9 @@
|
||||
#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";
|
||||
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T: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";
|
||||
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OS";
|
||||
#endif
|
||||
|
||||
static const struct option long_options[] =
|
||||
@ -62,6 +62,7 @@ static const struct option long_options[] =
|
||||
{"keep-guessing", no_argument, NULL, IDX_KEEP_GUESSING},
|
||||
{"kernel-accel", required_argument, NULL, IDX_KERNEL_ACCEL},
|
||||
{"kernel-loops", required_argument, NULL, IDX_KERNEL_LOOPS},
|
||||
{"kernel-threads", required_argument, NULL, IDX_KERNEL_THREADS},
|
||||
{"keyspace", no_argument, NULL, IDX_KEYSPACE},
|
||||
{"left", no_argument, NULL, IDX_LEFT},
|
||||
{"limit", required_argument, NULL, IDX_LIMIT},
|
||||
@ -186,6 +187,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
|
||||
user_options->keep_guessing = KEEP_GUESSING;
|
||||
user_options->kernel_accel = KERNEL_ACCEL;
|
||||
user_options->kernel_loops = KERNEL_LOOPS;
|
||||
user_options->kernel_threads = KERNEL_THREADS;
|
||||
user_options->keyspace = KEYSPACE;
|
||||
user_options->left = LEFT;
|
||||
user_options->limit = LIMIT;
|
||||
@ -302,6 +304,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
case IDX_WORKLOAD_PROFILE:
|
||||
case IDX_KERNEL_ACCEL:
|
||||
case IDX_KERNEL_LOOPS:
|
||||
case IDX_KERNEL_THREADS:
|
||||
case IDX_NVIDIA_SPIN_DAMP:
|
||||
case IDX_GPU_TEMP_ABORT:
|
||||
case IDX_HCCAPX_MESSAGE_PAIR:
|
||||
@ -427,6 +430,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||
user_options->kernel_accel_chgd = true; break;
|
||||
case IDX_KERNEL_LOOPS: user_options->kernel_loops = hc_strtoul (optarg, NULL, 10);
|
||||
user_options->kernel_loops_chgd = true; break;
|
||||
case IDX_KERNEL_THREADS: user_options->kernel_threads = hc_strtoul (optarg, NULL, 10);
|
||||
user_options->kernel_threads_chgd = true; break;
|
||||
case IDX_NVIDIA_SPIN_DAMP: user_options->nvidia_spin_damp = hc_strtoul (optarg, NULL, 10);
|
||||
user_options->nvidia_spin_damp_chgd = true; break;
|
||||
case IDX_GPU_TEMP_DISABLE: user_options->gpu_temp_disable = true; break;
|
||||
@ -804,6 +809,33 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
if (user_options->kernel_threads_chgd == true)
|
||||
{
|
||||
if (user_options->force == false)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "The manual use of the -T option (or --kernel-threads) is outdated.");
|
||||
|
||||
event_log_warning (hashcat_ctx, "You can use --force to override this, but do not report related errors.");
|
||||
event_log_warning (hashcat_ctx, NULL);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (user_options->kernel_threads < 1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Invalid kernel-threads specified.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (user_options->kernel_threads > 1024)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "Invalid kernel-threads specified.");
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((user_options->workload_profile < 1) || (user_options->workload_profile > 4))
|
||||
{
|
||||
event_log_error (hashcat_ctx, "workload-profile %u is not available.", user_options->workload_profile);
|
||||
@ -1706,11 +1738,18 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
|
||||
event_log_info (hashcat_ctx, "* --opencl-vector-width=%u", user_options->opencl_vector_width);
|
||||
}
|
||||
|
||||
if ((user_options->kernel_accel_chgd == true) || (user_options->kernel_loops_chgd == true))
|
||||
if (user_options->kernel_accel_chgd == true)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "* --kernel-accel=%u", user_options->kernel_accel);
|
||||
}
|
||||
else if (user_options->kernel_loops_chgd == true)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "* --kernel-loops=%u", user_options->kernel_loops);
|
||||
}
|
||||
else if (user_options->kernel_threads_chgd == true)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "* --kernel-threads=%u", user_options->kernel_threads);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user_options->workload_profile_chgd == true)
|
||||
@ -1758,11 +1797,18 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
|
||||
event_log_info (hashcat_ctx, "# option: --opencl-vector-width=%u", user_options->opencl_vector_width);
|
||||
}
|
||||
|
||||
if ((user_options->kernel_accel_chgd == true) || (user_options->kernel_loops_chgd == true))
|
||||
if (user_options->kernel_accel_chgd == true)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "# option: --kernel-accel=%u", user_options->kernel_accel);
|
||||
}
|
||||
else if (user_options->kernel_loops_chgd == true)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "# option: --kernel-loops=%u", user_options->kernel_loops);
|
||||
}
|
||||
else if (user_options->kernel_threads_chgd == true)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "# option: --kernel-threads=%u", user_options->kernel_threads);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user_options->workload_profile_chgd == true)
|
||||
@ -2563,6 +2609,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
|
||||
logfile_top_uint (user_options->keep_guessing);
|
||||
logfile_top_uint (user_options->kernel_accel);
|
||||
logfile_top_uint (user_options->kernel_loops);
|
||||
logfile_top_uint (user_options->kernel_threads);
|
||||
logfile_top_uint (user_options->keyspace);
|
||||
logfile_top_uint (user_options->left);
|
||||
logfile_top_uint (user_options->logfile_disable);
|
||||
|
Loading…
Reference in New Issue
Block a user