1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Added option --benchmark-all to benchmark all hash-modes not just the default selection

This commit is contained in:
jsteube 2017-12-05 11:08:59 +01:00
parent f817652bbb
commit 1184ae1cdd
9 changed files with 135 additions and 211 deletions

View File

@ -4,6 +4,7 @@
## Features
##
- Added option --benchmark-all to benchmark all hash-modes not just the default selection
- Removed option --gpu-temp-retain that tried to retain GPU temperature at X degrees celsius, please use driver specific tools
- Removed option --powertune-enable to enable power tuning, please use driver specific tools

View File

@ -189,7 +189,7 @@ _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"
local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --markov-hcstat --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"
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-hcstat --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"
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-hcstat --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"
COMPREPLY=()

View File

@ -6,7 +6,6 @@
#ifndef _BENCHMARK_H
#define _BENCHMARK_H
extern const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_CNT;
extern const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_BUF[];
int benchmark_next (hashcat_ctx_t *hashcat_ctx);
#endif // _BENCHMARK_H

View File

@ -520,6 +520,7 @@ typedef enum user_options_defaults
ADVICE_DISABLE = false,
ATTACK_MODE = ATTACK_MODE_STRAIGHT,
BENCHMARK = false,
BENCHMARK_ALL = false,
BITMAP_MAX = 24,
BITMAP_MIN = 16,
DEBUG_MODE = 0,
@ -591,90 +592,91 @@ typedef enum user_options_map
IDX_ADVICE_DISABLE = 0xff00,
IDX_ATTACK_MODE = 'a',
IDX_BENCHMARK = 'b',
IDX_BITMAP_MAX = 0xff01,
IDX_BITMAP_MIN = 0xff02,
IDX_CPU_AFFINITY = 0xff03,
IDX_BENCHMARK_ALL = 0xff01,
IDX_BITMAP_MAX = 0xff02,
IDX_BITMAP_MIN = 0xff03,
IDX_CPU_AFFINITY = 0xff04,
IDX_CUSTOM_CHARSET_1 = '1',
IDX_CUSTOM_CHARSET_2 = '2',
IDX_CUSTOM_CHARSET_3 = '3',
IDX_CUSTOM_CHARSET_4 = '4',
IDX_DEBUG_FILE = 0xff04,
IDX_DEBUG_MODE = 0xff05,
IDX_ENCODING_FROM = 0xff06,
IDX_ENCODING_TO = 0xff07,
IDX_EXAMPLE_HASHES = 0xff08,
IDX_FORCE = 0xff09,
IDX_GPU_TEMP_ABORT = 0xff0a,
IDX_GPU_TEMP_DISABLE = 0xff0b,
IDX_DEBUG_FILE = 0xff05,
IDX_DEBUG_MODE = 0xff06,
IDX_ENCODING_FROM = 0xff07,
IDX_ENCODING_TO = 0xff08,
IDX_EXAMPLE_HASHES = 0xff09,
IDX_FORCE = 0xff0a,
IDX_GPU_TEMP_ABORT = 0xff0b,
IDX_GPU_TEMP_DISABLE = 0xff0c,
IDX_HASH_MODE = 'm',
IDX_HCCAPX_MESSAGE_PAIR = 0xff0c,
IDX_HCCAPX_MESSAGE_PAIR = 0xff0d,
IDX_HELP = 'h',
IDX_HEX_CHARSET = 0xff0d,
IDX_HEX_SALT = 0xff0e,
IDX_HEX_WORDLIST = 0xff0f,
IDX_HEX_CHARSET = 0xff0e,
IDX_HEX_SALT = 0xff0f,
IDX_HEX_WORDLIST = 0xff10,
IDX_INCREMENT = 'i',
IDX_INCREMENT_MAX = 0xff10,
IDX_INCREMENT_MIN = 0xff11,
IDX_INDUCTION_DIR = 0xff12,
IDX_KEEP_GUESSING = 0xff13,
IDX_INCREMENT_MAX = 0xff11,
IDX_INCREMENT_MIN = 0xff12,
IDX_INDUCTION_DIR = 0xff13,
IDX_KEEP_GUESSING = 0xff14,
IDX_KERNEL_ACCEL = 'n',
IDX_KERNEL_LOOPS = 'u',
IDX_KEYSPACE = 0xff14,
IDX_LEFT = 0xff15,
IDX_KEYSPACE = 0xff15,
IDX_LEFT = 0xff16,
IDX_LIMIT = 'l',
IDX_LOGFILE_DISABLE = 0xff16,
IDX_LOOPBACK = 0xff17,
IDX_MACHINE_READABLE = 0xff18,
IDX_MARKOV_CLASSIC = 0xff19,
IDX_MARKOV_DISABLE = 0xff1a,
IDX_MARKOV_HCSTAT = 0xff1b,
IDX_LOGFILE_DISABLE = 0xff17,
IDX_LOOPBACK = 0xff18,
IDX_MACHINE_READABLE = 0xff19,
IDX_MARKOV_CLASSIC = 0xff1a,
IDX_MARKOV_DISABLE = 0xff1b,
IDX_MARKOV_HCSTAT = 0xff1c,
IDX_MARKOV_THRESHOLD = 't',
IDX_NONCE_ERROR_CORRECTIONS = 0xff1c,
IDX_NVIDIA_SPIN_DAMP = 0xff1d,
IDX_NONCE_ERROR_CORRECTIONS = 0xff1d,
IDX_NVIDIA_SPIN_DAMP = 0xff1e,
IDX_OPENCL_DEVICES = 'd',
IDX_OPENCL_DEVICE_TYPES = 'D',
IDX_OPENCL_INFO = 'I',
IDX_OPENCL_PLATFORMS = 0xff1e,
IDX_OPENCL_VECTOR_WIDTH = 0xff1f,
IDX_OPENCL_PLATFORMS = 0xff1f,
IDX_OPENCL_VECTOR_WIDTH = 0xff20,
IDX_OPTIMIZED_KERNEL_ENABLE = 'O',
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff20,
IDX_OUTFILE_CHECK_DIR = 0xff21,
IDX_OUTFILE_CHECK_TIMER = 0xff22,
IDX_OUTFILE_FORMAT = 0xff23,
IDX_OUTFILE_AUTOHEX_DISABLE = 0xff21,
IDX_OUTFILE_CHECK_DIR = 0xff22,
IDX_OUTFILE_CHECK_TIMER = 0xff23,
IDX_OUTFILE_FORMAT = 0xff24,
IDX_OUTFILE = 'o',
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff24,
IDX_POTFILE_DISABLE = 0xff25,
IDX_POTFILE_PATH = 0xff26,
IDX_QUIET = 0xff27,
IDX_REMOVE = 0xff28,
IDX_REMOVE_TIMER = 0xff29,
IDX_RESTORE = 0xff2a,
IDX_RESTORE_DISABLE = 0xff2b,
IDX_RESTORE_FILE_PATH = 0xff2c,
IDX_WORDLIST_AUTOHEX_DISABLE = 0xff25,
IDX_POTFILE_DISABLE = 0xff26,
IDX_POTFILE_PATH = 0xff27,
IDX_QUIET = 0xff28,
IDX_REMOVE = 0xff29,
IDX_REMOVE_TIMER = 0xff2a,
IDX_RESTORE = 0xff2b,
IDX_RESTORE_DISABLE = 0xff2c,
IDX_RESTORE_FILE_PATH = 0xff2d,
IDX_RP_FILE = 'r',
IDX_RP_GEN_FUNC_MAX = 0xff2d,
IDX_RP_GEN_FUNC_MIN = 0xff2e,
IDX_RP_GEN_FUNC_MAX = 0xff2e,
IDX_RP_GEN_FUNC_MIN = 0xff2f,
IDX_RP_GEN = 'g',
IDX_RP_GEN_SEED = 0xff2f,
IDX_RP_GEN_SEED = 0xff30,
IDX_RULE_BUF_L = 'j',
IDX_RULE_BUF_R = 'k',
IDX_RUNTIME = 0xff30,
IDX_SCRYPT_TMTO = 0xff31,
IDX_SELF_TEST_DISABLE = 0xff32,
IDX_RUNTIME = 0xff31,
IDX_SCRYPT_TMTO = 0xff32,
IDX_SELF_TEST_DISABLE = 0xff33,
IDX_SEGMENT_SIZE = 'c',
IDX_SEPARATOR = 'p',
IDX_SESSION = 0xff33,
IDX_SHOW = 0xff34,
IDX_SESSION = 0xff34,
IDX_SHOW = 0xff35,
IDX_SKIP = 's',
IDX_STATUS = 0xff35,
IDX_STATUS_TIMER = 0xff36,
IDX_STDOUT_FLAG = 0xff37,
IDX_SPEED_ONLY = 0xff38,
IDX_PROGRESS_ONLY = 0xff39,
IDX_TRUECRYPT_KEYFILES = 0xff3a,
IDX_USERNAME = 0xff3b,
IDX_VERACRYPT_KEYFILES = 0xff3c,
IDX_VERACRYPT_PIM = 0xff3d,
IDX_STATUS = 0xff36,
IDX_STATUS_TIMER = 0xff37,
IDX_STDOUT_FLAG = 0xff38,
IDX_SPEED_ONLY = 0xff39,
IDX_PROGRESS_ONLY = 0xff3a,
IDX_TRUECRYPT_KEYFILES = 0xff3b,
IDX_USERNAME = 0xff3c,
IDX_VERACRYPT_KEYFILES = 0xff3d,
IDX_VERACRYPT_PIM = 0xff3e,
IDX_VERSION_LOWER = 'v',
IDX_VERSION = 'V',
IDX_WORKLOAD_PROFILE = 'w'
@ -1487,6 +1489,7 @@ typedef struct user_options
bool advice_disable;
bool benchmark;
bool benchmark_all;
bool example_hashes;
bool force;
bool gpu_temp_disable;

View File

@ -4,168 +4,72 @@
*/
#include "common.h"
#include "types.h"
#include "interface.h"
#include "benchmark.h"
const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_CNT = 158;
const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] =
{
900,
0,
5100,
100,
1400,
10800,
1700,
5000,
10100,
14900,
6000,
6100,
6900,
11700,
11800,
14000,
14100,
400,
8900,
11900,
12000,
10900,
12100,
23,
2500,
2501,
5300,
5400,
1000,
3000,
5500,
5600,
7300,
7500,
13100,
16100,
8300,
11100,
11200,
11400,
121,
2611,
2711,
2811,
8400,
13900,
11,
2612,
7900,
21,
11000,
124,
10000,
16000,
3711,
4521,
4522,
12,
131,
132,
1731,
200,
300,
3100,
112,
12300,
8000,
141,
1441,
1600,
12600,
1421,
101,
111,
1411,
1711,
3000,
1000,
1100,
2100,
15300,
15900,
12800,
1500,
12400,
500,
3200,
7400,
1800,
122,
1722,
7500,
13100,
15300,
15900,
7100,
6300,
6700,
6400,
6500,
2400,
2410,
5700,
9200,
9300,
22,
501,
5800,
8100,
8500,
7200,
9900,
7700,
7800,
10300,
8600,
8700,
9100,
133,
13500,
11600,
13600,
12500,
13000,
13200,
13300,
6211,
6221,
6231,
6241,
13711,
13721,
13731,
13741,
13751,
13761,
8800,
12900,
12200,
9700,
9710,
9800,
9810,
9400,
9500,
9600,
10400,
10410,
10500,
10600,
10700,
9000,
5200,
6800,
6600,
8200,
11300,
12700,
15200,
13400,
15500,
15600,
125,
15400
6800,
11300,
-1,
};
int benchmark_next (hashcat_ctx_t *hashcat_ctx)
{
const user_options_t *user_options = hashcat_ctx->user_options;
static int cur = 0;
if (user_options->benchmark_all == false)
{
const int hash_mode = DEFAULT_BENCHMARK_ALGORITHMS_BUF[cur];
if (hash_mode == -1) return -1;
cur++;
return hash_mode;
}
else
{
for (int i = cur; i < 99999; i++)
{
const char *name = strhashtype (i);
if (name)
{
const int hash_mode = i;
cur = hash_mode + 1;
return hash_mode;
}
}
}
return -1;
}

View File

@ -1132,9 +1132,11 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx)
}
else
{
for (u32 algorithm_pos = 0; algorithm_pos < DEFAULT_BENCHMARK_ALGORITHMS_CNT; algorithm_pos++)
int hash_mode;
while ((hash_mode = benchmark_next (hashcat_ctx)) != -1)
{
user_options->hash_mode = DEFAULT_BENCHMARK_ALGORITHMS_BUF[algorithm_pos];
user_options->hash_mode = hash_mode;
rc_final = outer_loop (hashcat_ctx);

View File

@ -16263,7 +16263,7 @@ const char *strhashtype (const u32 hash_mode)
case 99999: return HT_99999;
}
return "Unknown";
return NULL;
}
const char *strparser (const u32 parser_status)

View File

@ -76,7 +76,8 @@ static const char *const USAGE_BIG[] =
" --truecrypt-keyfiles | File | Keyfiles to use, separated with commas | --truecrypt-key=x.png",
" --veracrypt-keyfiles | File | Keyfiles to use, separated with commas | --veracrypt-key=x.txt",
" --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
" -b, --benchmark | | Run benchmark |",
" -b, --benchmark | | Run benchmark of selected hash-modes |",
" --benchmark-all | | Run benchmark of all hash-modes (requires -b) |",
" --speed-only | | Return expected speed of the attack, then quit |",
" --progress-only | | Return ideal progress step size and time to process |",
" -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",

View File

@ -21,6 +21,7 @@ static const struct option long_options[] =
{"advice-disable", no_argument, 0, IDX_ADVICE_DISABLE},
{"attack-mode", required_argument, 0, IDX_ATTACK_MODE},
{"benchmark", no_argument, 0, IDX_BENCHMARK},
{"benchmark-all", no_argument, 0, IDX_BENCHMARK_ALL},
{"bitmap-max", required_argument, 0, IDX_BITMAP_MAX},
{"bitmap-min", required_argument, 0, IDX_BITMAP_MIN},
{"cpu-affinity", required_argument, 0, IDX_CPU_AFFINITY},
@ -128,6 +129,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->advice_disable = ADVICE_DISABLE;
user_options->attack_mode = ATTACK_MODE;
user_options->benchmark = BENCHMARK;
user_options->benchmark_all = BENCHMARK_ALL;
user_options->bitmap_max = BITMAP_MAX;
user_options->bitmap_min = BITMAP_MIN;
user_options->cpu_affinity = NULL;
@ -335,6 +337,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_KEEP_GUESSING: user_options->keep_guessing = true; break;
case IDX_KEYSPACE: user_options->keyspace = true; break;
case IDX_BENCHMARK: user_options->benchmark = true; break;
case IDX_BENCHMARK_ALL: user_options->benchmark_all = true; break;
case IDX_STDOUT_FLAG: user_options->stdout_flag = true; break;
case IDX_SPEED_ONLY: user_options->speed_only = true; break;
case IDX_PROGRESS_ONLY: user_options->progress_only = true; break;
@ -1449,6 +1452,11 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
event_log_info (hashcat_ctx, "Benchmark relevant options:");
event_log_info (hashcat_ctx, "===========================");
if (user_options->benchmark_all == true)
{
event_log_info (hashcat_ctx, "* --benchmark-all");
}
if (user_options->force == true)
{
event_log_info (hashcat_ctx, "* --force");
@ -1496,6 +1504,11 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx)
}
else
{
if (user_options->benchmark_all == true)
{
event_log_info (hashcat_ctx, "# option: --benchmark-all");
}
if (user_options->force == true)
{
event_log_info (hashcat_ctx, "# option: --force");
@ -2223,6 +2236,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_uint64 (user_options->skip);
logfile_top_uint (user_options->attack_mode);
logfile_top_uint (user_options->benchmark);
logfile_top_uint (user_options->benchmark_all);
logfile_top_uint (user_options->bitmap_max);
logfile_top_uint (user_options->bitmap_min);
logfile_top_uint (user_options->debug_mode);