Prepare new --hook-threads feature

This commit is contained in:
Jens Steube
2019-11-02 10:29:34 +01:00
parent 9a4bb20135
commit d71afd6d7a
7 changed files with 78 additions and 40 deletions
+6
View File
@@ -1043,6 +1043,12 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, const char *install_folder
setup_umask ();
/**
* Find number of physical CPU cores
*/
user_options->hook_threads = hc_get_processor_count ();
/**
* tuning db
*/
+21
View File
@@ -609,6 +609,27 @@ void hc_string_trim_trailing (char *s)
s[new_len] = 0;
}
int hc_get_processor_count ()
{
int cnt = 0;
#if defined (_WIN)
SYSTEM_INFO info;
GetSystemInfo (&info);
cnt = (int) info.dwNumberOfProcessors;
#else
cnt = (int) sysconf (_SC_NPROCESSORS_ONLN);
#endif
return cnt;
}
bool hc_same_files (char *file1, char *file2)
{
if ((file1 != NULL) && (file2 != NULL))
+1
View File
@@ -88,6 +88,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] =
" --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
" --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-max=24",
" --cpu-affinity | Str | Locks to CPU devices, separated with commas | --cpu-affinity=1,2,3",
" --hook-threads | Num | Sets number of threads for a hook (per compute unit) | --hook-threads=8",
" --example-hashes | | Show an example hash for each hash-mode |",
" -I, --backend-info | | Show info about detected backend API devices | -I",
" -d, --backend-devices | Str | Backend devices to use, separated with commas | -d 1",
+5
View File
@@ -58,6 +58,7 @@ static const struct option long_options[] =
{"hex-charset", no_argument, NULL, IDX_HEX_CHARSET},
{"hex-salt", no_argument, NULL, IDX_HEX_SALT},
{"hex-wordlist", no_argument, NULL, IDX_HEX_WORDLIST},
{"hook-threads", required_argument, NULL, IDX_HOOK_THREADS},
{"increment-max", required_argument, NULL, IDX_INCREMENT_MAX},
{"increment-min", required_argument, NULL, IDX_INCREMENT_MIN},
{"increment", no_argument, NULL, IDX_INCREMENT},
@@ -185,6 +186,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->hex_charset = HEX_CHARSET;
user_options->hex_salt = HEX_SALT;
user_options->hex_wordlist = HEX_WORDLIST;
user_options->hook_threads = HOOK_THREADS;
user_options->increment = INCREMENT;
user_options->increment_max = INCREMENT_MAX;
user_options->increment_min = INCREMENT_MIN;
@@ -321,6 +323,7 @@ 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:
case IDX_HOOK_THREADS:
#ifdef WITH_BRAIN
case IDX_BRAIN_PORT:
#endif
@@ -457,6 +460,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_SEPARATOR: user_options->separator = optarg[0]; break;
case IDX_BITMAP_MIN: user_options->bitmap_min = hc_strtoul (optarg, NULL, 10); break;
case IDX_BITMAP_MAX: user_options->bitmap_max = hc_strtoul (optarg, NULL, 10); break;
case IDX_HOOK_THREADS: user_options->hook_threads = hc_strtoul (optarg, NULL, 10); break;
case IDX_INCREMENT: user_options->increment = true; break;
case IDX_INCREMENT_MIN: user_options->increment_min = hc_strtoul (optarg, NULL, 10);
user_options->increment_min_chgd = true; break;
@@ -2822,6 +2826,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_uint (user_options->hex_charset);
logfile_top_uint (user_options->hex_salt);
logfile_top_uint (user_options->hex_wordlist);
logfile_top_uint (user_options->hook_threads);
logfile_top_uint (user_options->increment);
logfile_top_uint (user_options->increment_max);
logfile_top_uint (user_options->increment_min);