diff --git a/docs/changes.txt b/docs/changes.txt index 682629e80..5229a4577 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -4,7 +4,8 @@ ## Features ## -- Use $HEX[...] in case the password includes the separater character, increases potfile reading performance +- New option --progress-only: Quickly provides ideal progress step size and time to process it per device based on the user hashes and selected options, then quit +- Files: Use $HEX[...] in case the password includes the separater character, increases potfile reading performance ## ## Bugs diff --git a/extra/tab_completion/hashcat.sh b/extra/tab_completion/hashcat.sh index fb7bfafd2..0bdec8b6c 100644 --- a/extra/tab_completion/hashcat.sh +++ b/extra/tab_completion/hashcat.sh @@ -188,7 +188,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" - local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --weak-hash-threshold --markov-hcstat --markov-disable --markov-classic --markov-threshold --runtime --session --speed-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --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 --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 --gpu-temp-retain --powertune-enable --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 --stdout --keep-guessing" + local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --hex-salt --hex-wordlist --hex-charset --force --status --status-timer --machine-readable --loopback --weak-hash-threshold --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 --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 --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 --gpu-temp-retain --powertune-enable --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 --stdout --keep-guessing" 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 --weak-hash-threshold --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 --gpu-temp-retain -disable --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" COMPREPLY=() diff --git a/include/status.h b/include/status.h index 0f28bee2d..d893cf9a9 100644 --- a/include/status.h +++ b/include/status.h @@ -81,6 +81,8 @@ char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx) 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); +int status_get_progress_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); +double status_get_runtime_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); int status_progress_init (hashcat_ctx_t *hashcat_ctx); void status_progress_destroy (hashcat_ctx_t *hashcat_ctx); diff --git a/include/terminal.h b/include/terminal.h index 231fabf0a..4b66bf6be 100644 --- a/include/terminal.h +++ b/include/terminal.h @@ -41,12 +41,16 @@ int tty_break(void); int tty_getchar(void); int tty_fix(void); -void opencl_info (hashcat_ctx_t *hashcat_ctx); -void opencl_info_compact (hashcat_ctx_t *hashcat_ctx); +void opencl_info (hashcat_ctx_t *hashcat_ctx); +void opencl_info_compact (hashcat_ctx_t *hashcat_ctx); -void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx); -void status_display (hashcat_ctx_t *hashcat_ctx); -void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx); -void status_benchmark (hashcat_ctx_t *hashcat_ctx); +void status_progress_machine_readable (hashcat_ctx_t *hashcat_ctx); +void status_progress (hashcat_ctx_t *hashcat_ctx); +void status_speed_machine_readable (hashcat_ctx_t *hashcat_ctx); +void status_speed (hashcat_ctx_t *hashcat_ctx); +void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx); +void status_display (hashcat_ctx_t *hashcat_ctx); +void status_benchmark_machine_readable (hashcat_ctx_t *hashcat_ctx); +void status_benchmark (hashcat_ctx_t *hashcat_ctx); #endif // _TERMINAL_H diff --git a/include/types.h b/include/types.h index 39990881a..a4c85ef93 100644 --- a/include/types.h +++ b/include/types.h @@ -522,6 +522,7 @@ typedef enum user_options_defaults STATUS_TIMER = 10, STDOUT_FLAG = false, SPEED_ONLY = false, + PROGRESS_ONLY = false, USAGE = false, USERNAME = false, VERSION = false, @@ -607,13 +608,14 @@ typedef enum user_options_map IDX_STATUS_TIMER = 0xff30, IDX_STDOUT_FLAG = 0xff31, IDX_SPEED_ONLY = 0xff32, - IDX_TRUECRYPT_KEYFILES = 0xff33, - IDX_USERNAME = 0xff34, - IDX_VERACRYPT_KEYFILES = 0xff35, - IDX_VERACRYPT_PIM = 0xff36, + IDX_PROGRESS_ONLY = 0xff33, + IDX_TRUECRYPT_KEYFILES = 0xff34, + IDX_USERNAME = 0xff35, + IDX_VERACRYPT_KEYFILES = 0xff36, + IDX_VERACRYPT_PIM = 0xff37, IDX_VERSION_LOWER = 'v', IDX_VERSION = 'V', - IDX_WEAK_HASH_THRESHOLD = 0xff37, + IDX_WEAK_HASH_THRESHOLD = 0xff38, IDX_WORKLOAD_PROFILE = 'w' } user_options_map_t; @@ -892,6 +894,7 @@ typedef struct hc_device_param u32 outerloop_pos; u32 outerloop_left; + double outerloop_msec; u32 innerloop_pos; u32 innerloop_left; @@ -1355,6 +1358,7 @@ typedef struct user_options bool status; bool stdout_flag; bool speed_only; + bool progress_only; bool usage; bool username; bool version; @@ -1567,6 +1571,8 @@ typedef struct char *hwmon_dev; int corespeed_dev; int memoryspeed_dev; + double runtime_msec_dev; + int progress_dev; } device_info_t; diff --git a/src/debugfile.c b/src/debugfile.c index bc2687953..dafc9375e 100644 --- a/src/debugfile.c +++ b/src/debugfile.c @@ -86,16 +86,17 @@ int debugfile_init (hashcat_ctx_t *hashcat_ctx) debugfile_ctx->enabled = false; - if (user_options->benchmark == true) return 0; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->stdout_flag == true) return 0; - if (user_options->speed_only == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; - if (user_options->debug_mode == 0) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->stdout_flag == true) return 0; + if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; + if (user_options->debug_mode == 0) return 0; debugfile_ctx->enabled = true; diff --git a/src/hashcat.c b/src/hashcat.c index 8f6a9243d..91a2fbbf4 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -664,7 +664,7 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx) * Outfile remove */ - if (user_options->keyspace == false && user_options->benchmark == false && user_options->stdout_flag == false && user_options->speed_only == false) + if (user_options->keyspace == false && user_options->stdout_flag == false && user_options->speed_only == false) { hc_thread_create (inner_threads[inner_threads_cnt], thread_monitor, hashcat_ctx); @@ -1252,6 +1252,8 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st device_info->hwmon_dev = status_get_hwmon_dev (hashcat_ctx, device_id); device_info->corespeed_dev = status_get_corespeed_dev (hashcat_ctx, device_id); device_info->memoryspeed_dev = status_get_memoryspeed_dev (hashcat_ctx, device_id); + device_info->progress_dev = status_get_progress_dev (hashcat_ctx, device_id); + device_info->runtime_msec_dev = status_get_runtime_msec_dev (hashcat_ctx, device_id); } hashcat_status->hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx); diff --git a/src/induct.c b/src/induct.c index 32babb4ec..655da14f6 100644 --- a/src/induct.c +++ b/src/induct.c @@ -30,15 +30,16 @@ int induct_ctx_init (hashcat_ctx_t *hashcat_ctx) induct_ctx->enabled = false; - if (user_options->benchmark == true) return 0; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->stdout_flag == true) return 0; - if (user_options->speed_only == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->stdout_flag == true) return 0; + if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; if (user_options->attack_mode == ATTACK_MODE_BF) return 0; if (user_options->attack_mode == ATTACK_MODE_COMBI) return 0; diff --git a/src/loopback.c b/src/loopback.c index 6467fc2fe..9d11cbc9f 100644 --- a/src/loopback.c +++ b/src/loopback.c @@ -60,15 +60,16 @@ int loopback_init (hashcat_ctx_t *hashcat_ctx) loopback_ctx->enabled = false; - if (user_options->benchmark == true) return 0; - if (user_options->keyspace == true) return 0; - if (user_options->left == true) return 0; - if (user_options->opencl_info == true) return 0; - if (user_options->show == true) return 0; - if (user_options->stdout_flag == true) return 0; - if (user_options->speed_only == true) return 0; - if (user_options->usage == true) return 0; - if (user_options->version == true) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->left == true) return 0; + if (user_options->opencl_info == true) return 0; + if (user_options->show == true) return 0; + if (user_options->stdout_flag == true) return 0; + if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; + if (user_options->usage == true) return 0; + if (user_options->version == true) return 0; loopback_ctx->enabled = true; loopback_ctx->fp = NULL; diff --git a/src/main.c b/src/main.c index c91d9a298..ac5254fe0 100644 --- a/src/main.c +++ b/src/main.c @@ -168,7 +168,7 @@ static void main_outerloop_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MA status_ctx->shutdown_outer = false; - if (user_options->keyspace == false && user_options->benchmark == false && user_options->stdout_flag == false && user_options->opencl_info == false && user_options->speed_only == false) + if ((user_options->keyspace == false) && (user_options->stdout_flag == false) && (user_options->opencl_info == false) && (user_options->speed_only == false)) { if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) { @@ -211,7 +211,7 @@ static void main_cracker_starting (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) { - if ((user_options->quiet == false) && (user_options->benchmark == false) && (user_options->speed_only == false)) + if ((user_options->quiet == false) && (user_options->speed_only == false)) { event_log_info_nn (hashcat_ctx, ""); @@ -239,7 +239,7 @@ static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK)) { - if ((user_options->benchmark == false) && (user_options->speed_only == false)) + if (user_options->speed_only == false) { clear_prompt (); } @@ -247,7 +247,7 @@ static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB // print final status - if ((user_options->benchmark == true) || (user_options->speed_only == true)) + if (user_options->benchmark == true) { status_benchmark (hashcat_ctx); @@ -256,6 +256,24 @@ static void main_cracker_finished (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYB event_log_info (hashcat_ctx, ""); } } + else if (user_options->progress_only == true) + { + status_progress (hashcat_ctx); + + if (user_options->machine_readable == false) + { + event_log_info (hashcat_ctx, ""); + } + } + else if (user_options->speed_only == true) + { + status_speed (hashcat_ctx); + + if (user_options->machine_readable == false) + { + event_log_info (hashcat_ctx, ""); + } + } else { if (user_options->quiet == false) diff --git a/src/opencl.c b/src/opencl.c index a85e0e6ff..5bffb517f 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -2002,6 +2002,15 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (status_ctx->run_thread_level2 == false) break; } + if (user_options->progress_only == true) + { + const double m = (double) innerloop_cnt / innerloop_step; + + device_param->outerloop_msec = device_param->speed_msec[0] * m; + } + + if (user_options->speed_only == true) break; + //status screen makes use of this, can't reset here //device_param->innerloop_pos = 0; //device_param->innerloop_left = 0; diff --git a/src/outfile_check.c b/src/outfile_check.c index 364ba67af..03f046949 100644 --- a/src/outfile_check.c +++ b/src/outfile_check.c @@ -324,10 +324,11 @@ int outcheck_ctx_init (hashcat_ctx_t *hashcat_ctx) outcheck_ctx->enabled = false; - if (user_options->keyspace == true) return 0; - if (user_options->benchmark == true) return 0; - if (user_options->speed_only == true) return 0; - if (user_options->opencl_info == true) return 0; + if (user_options->keyspace == true) return 0; + if (user_options->benchmark == true) return 0; + if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; + if (user_options->opencl_info == true) return 0; if (user_options->outfile_check_timer == 0) return 0; diff --git a/src/potfile.c b/src/potfile.c index 6fa3b6fbd..0422a88a7 100644 --- a/src/potfile.c +++ b/src/potfile.c @@ -88,6 +88,7 @@ int potfile_init (hashcat_ctx_t *hashcat_ctx) if (user_options->opencl_info == true) return 0; if (user_options->stdout_flag == true) return 0; if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; if (user_options->usage == true) return 0; if (user_options->version == true) return 0; if (user_options->potfile_disable == true) return 0; diff --git a/src/restore.c b/src/restore.c index e40c40b86..408240513 100644 --- a/src/restore.c +++ b/src/restore.c @@ -346,6 +346,7 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) if (user_options->show == true) return 0; if (user_options->stdout_flag == true) return 0; if (user_options->speed_only == true) return 0; + if (user_options->progress_only == true) return 0; if (user_options->usage == true) return 0; if (user_options->version == true) return 0; if (user_options->restore_disable == true) return 0; diff --git a/src/status.c b/src/status.c index dc4c070bc..391bb27cb 100644 --- a/src/status.c +++ b/src/status.c @@ -1685,6 +1685,28 @@ int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int devi return num_memoryspeed; } +int status_get_progress_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]; + + if (device_param->skipped == true) return 0; + + return device_param->outerloop_left; +} + +double status_get_runtime_msec_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]; + + if (device_param->skipped == true) return 0; + + return device_param->outerloop_msec; +} + int status_progress_init (hashcat_ctx_t *hashcat_ctx) { status_ctx_t *status_ctx = hashcat_ctx->status_ctx; diff --git a/src/terminal.c b/src/terminal.c index a59949bf4..44b744f26 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -53,6 +53,11 @@ void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag) event_log_info (hashcat_ctx, "%s (%s) starting in speed-only mode...", PROGNAME, version_tag); event_log_info (hashcat_ctx, ""); } + else if (user_options->progress_only == true) + { + event_log_info (hashcat_ctx, "%s (%s) starting in progress-only mode...", PROGNAME, version_tag); + event_log_info (hashcat_ctx, ""); + } else { event_log_info (hashcat_ctx, "%s (%s) starting...", PROGNAME, version_tag); @@ -1045,7 +1050,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx) hcfree (hashcat_status); } -void status_benchmark_automate (hashcat_ctx_t *hashcat_ctx) +void status_benchmark_machine_readable (hashcat_ctx_t *hashcat_ctx) { hashconfig_t *hashconfig = hashcat_ctx->hashconfig; @@ -1080,7 +1085,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx) if (user_options->machine_readable == true) { - status_benchmark_automate (hashcat_ctx); + status_benchmark_machine_readable (hashcat_ctx); return; } @@ -1117,3 +1122,144 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx) hcfree (hashcat_status); } + +void status_speed_machine_readable (hashcat_ctx_t *hashcat_ctx) +{ + hashcat_status_t *hashcat_status = (hashcat_status_t *) hcmalloc (sizeof (hashcat_status_t)); + + const int rc_status = hashcat_get_status (hashcat_ctx, hashcat_status); + + if (rc_status == -1) + { + hcfree (hashcat_status); + + return; + } + + 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; + + event_log_info (hashcat_ctx, "%d:%" PRIu64, device_id + 1, (u64) (device_info->hashes_msec_dev_benchmark * 1000)); + } + + hcfree (hashcat_status); +} + +void status_speed (hashcat_ctx_t *hashcat_ctx) +{ + const user_options_t *user_options = hashcat_ctx->user_options; + + if (user_options->machine_readable == true) + { + status_speed_machine_readable (hashcat_ctx); + + return; + } + + hashcat_status_t *hashcat_status = (hashcat_status_t *) hcmalloc (sizeof (hashcat_status_t)); + + const int rc_status = hashcat_get_status (hashcat_ctx, hashcat_status); + + if (rc_status == -1) + { + hcfree (hashcat_status); + + return; + } + + 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; + + event_log_info (hashcat_ctx, + "Speed.Dev.#%d.....: %9sH/s (%0.2fms)", device_id + 1, + device_info->speed_sec_dev, + device_info->exec_msec_dev); + } + + if (hashcat_status->device_info_active > 1) + { + event_log_info (hashcat_ctx, + "Speed.Dev.#*.....: %9sH/s", + hashcat_status->speed_sec_all); + } + + hcfree (hashcat_status); +} + +void status_progress_machine_readable (hashcat_ctx_t *hashcat_ctx) +{ + hashcat_status_t *hashcat_status = (hashcat_status_t *) hcmalloc (sizeof (hashcat_status_t)); + + const int rc_status = hashcat_get_status (hashcat_ctx, hashcat_status); + + if (rc_status == -1) + { + hcfree (hashcat_status); + + return; + } + + 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; + + event_log_info (hashcat_ctx, "%d:%d:%0.2f", device_id + 1, device_info->progress_dev, device_info->runtime_msec_dev); + } + + hcfree (hashcat_status); +} + +void status_progress (hashcat_ctx_t *hashcat_ctx) +{ + const user_options_t *user_options = hashcat_ctx->user_options; + + if (user_options->machine_readable == true) + { + status_progress_machine_readable (hashcat_ctx); + + return; + } + + hashcat_status_t *hashcat_status = (hashcat_status_t *) hcmalloc (sizeof (hashcat_status_t)); + + const int rc_status = hashcat_get_status (hashcat_ctx, hashcat_status); + + if (rc_status == -1) + { + hcfree (hashcat_status); + + return; + } + + 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; + + event_log_info (hashcat_ctx, + "Progress.Dev.#%d..: %d", device_id + 1, + device_info->progress_dev); + } + + 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; + + event_log_info (hashcat_ctx, + "Runtime.Dev.#%d...: %0.2fms", device_id + 1, + device_info->runtime_msec_dev); + } + + hcfree (hashcat_status); +} diff --git a/src/usage.c b/src/usage.c index 91615d536..bca5a8387 100644 --- a/src/usage.c +++ b/src/usage.c @@ -70,7 +70,8 @@ static const char *USAGE_BIG[] = " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt", " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000", " -b, --benchmark | | Run benchmark |", - " --speed-only | | Just return expected speed of the attack and quit |", + " --speed-only | | Return expected speed of the attack and 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", " --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", diff --git a/src/user_options.c b/src/user_options.c index 24c61e5da..31a868746 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -94,6 +94,7 @@ static const struct option long_options[] = {"status-timer", required_argument, 0, IDX_STATUS_TIMER}, {"stdout", no_argument, 0, IDX_STDOUT_FLAG}, {"speed-only", no_argument, 0, IDX_SPEED_ONLY}, + {"progress-only", no_argument, 0, IDX_PROGRESS_ONLY}, {"truecrypt-keyfiles", required_argument, 0, IDX_TRUECRYPT_KEYFILES}, {"username", no_argument, 0, IDX_USERNAME}, {"veracrypt-keyfiles", required_argument, 0, IDX_VERACRYPT_KEYFILES}, @@ -189,6 +190,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx) user_options->status_timer = STATUS_TIMER; user_options->stdout_flag = STDOUT_FLAG; user_options->speed_only = SPEED_ONLY; + user_options->progress_only = PROGRESS_ONLY; user_options->truecrypt_keyfiles = NULL; user_options->usage = USAGE; user_options->username = USERNAME; @@ -255,6 +257,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) case IDX_BENCHMARK: user_options->benchmark = 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; case IDX_RESTORE_DISABLE: user_options->restore_disable = true; break; case IDX_RESTORE_FILE_PATH: user_options->restore_file_path = optarg; break; case IDX_STATUS: user_options->status = true; break; @@ -465,6 +468,13 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) return -1; } + if ((user_options->increment == true) && (user_options->progress_only == true)) + { + event_log_error (hashcat_ctx, "Increment is not allowed in combination with --progress-only"); + + return -1; + } + if ((user_options->increment == true) && (user_options->speed_only == true)) { event_log_error (hashcat_ctx, "Increment is not allowed in combination with --speed-only"); @@ -927,10 +937,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) // some options can influence or overwrite other options - if (user_options->opencl_info == true - || user_options->keyspace == true - || user_options->stdout_flag == true - || user_options->speed_only == true) + if (user_options->opencl_info == true + || user_options->keyspace == true + || user_options->stdout_flag == true + || user_options->speed_only == true + || user_options->progress_only == true) { user_options->gpu_temp_disable = true; user_options->left = false; @@ -967,6 +978,7 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) user_options->status = false; user_options->status_timer = 0; user_options->speed_only = true; + user_options->progress_only = false; user_options->weak_hash_threshold = 0; if (user_options->workload_profile_chgd == false) @@ -975,6 +987,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) } } + if (user_options->progress_only == true) + { + user_options->speed_only = true; + } + if (user_options->keyspace == true) { user_options->session = "keyspace"; @@ -1069,11 +1086,7 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) if (user_options->attack_mode == ATTACK_MODE_BF) { - if (user_options->benchmark == true) - { - - } - else if (user_options->opencl_info == true) + if (user_options->opencl_info == true) { } @@ -1311,6 +1324,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx) logfile_top_uint (user_options->status_timer); logfile_top_uint (user_options->stdout_flag); logfile_top_uint (user_options->speed_only); + logfile_top_uint (user_options->progress_only); logfile_top_uint (user_options->usage); logfile_top_uint (user_options->username); logfile_top_uint (user_options->veracrypt_pim);