diff --git a/docs/changes.txt b/docs/changes.txt index d84595640..af76de705 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -98,6 +98,7 @@ - Outfile Check: Fixed a memory leak for failed outfile reads - Restore: Add some checks on the rd->cwd variable in restore case - Rule Engine: Fixed several memory leaks in case loading of rules failed +- Session Management: Automatically set dedicated session names for non-cracking parameters, for example: --stdout - Session Management: Fixed several memory leaks in case profile- or install-folder setup failed - Sessions: Move out handling of multiple instance from restore file into separate pidfile - Status screen: Do not try to clear prompt in --quiet mode diff --git a/include/user_options.h b/include/user_options.h index 3821f609a..32cb1b308 100644 --- a/include/user_options.h +++ b/include/user_options.h @@ -16,6 +16,8 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv); int user_options_sanity (hashcat_ctx_t *hashcat_ctx); +void user_options_session_auto (hashcat_ctx_t *hashcat_ctx); + void user_options_preprocess (hashcat_ctx_t *hashcat_ctx); void user_options_postprocess (hashcat_ctx_t *hashcat_ctx); diff --git a/src/hashcat.c b/src/hashcat.c index 29c393994..f08926296 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -868,6 +868,12 @@ int hashcat_session_init (hashcat_ctx_t *hashcat_ctx, char *install_folder, char { user_options_t *user_options = hashcat_ctx->user_options; + /** + * make it a bit more comfortable to use some of the special modes in hashcat + */ + + user_options_session_auto (hashcat_ctx); + /** * event init (needed for logging so should be first) */ diff --git a/src/user_options.c b/src/user_options.c index 104f199f4..3949d9664 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -983,6 +983,54 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx) return 0; } +void user_options_session_auto (hashcat_ctx_t *hashcat_ctx) +{ + user_options_t *user_options = hashcat_ctx->user_options; + + if (user_options->session == PROGNAME) + { + if (user_options->benchmark == true) + { + user_options->session = "benchmark"; + } + + if (user_options->speed_only == true) + { + user_options->session = "speed-only"; + } + + if (user_options->progress_only == true) + { + user_options->session = "progress-only"; + } + + if (user_options->keyspace == true) + { + user_options->session = "keyspace"; + } + + if (user_options->stdout_flag == true) + { + user_options->session = "stdout"; + } + + if (user_options->opencl_info == true) + { + user_options->session = "opencl_info"; + } + + if (user_options->show == true) + { + user_options->session = "show"; + } + + if (user_options->left == true) + { + user_options->session = "left"; + } + } +} + void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) { user_options_t *user_options = hashcat_ctx->user_options; @@ -1032,7 +1080,6 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) user_options->restore_disable = true; user_options->restore = false; user_options->restore_timer = 0; - user_options->session = "benchmark"; user_options->show = false; user_options->status = false; user_options->status_timer = 0; @@ -1053,13 +1100,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) if (user_options->keyspace == true) { - user_options->session = "keyspace"; user_options->quiet = true; } if (user_options->stdout_flag == true) { - user_options->session = "stdout"; user_options->quiet = true; user_options->hash_mode = 2000; user_options->outfile_format = OUTFILE_FMT_PLAIN; @@ -1071,7 +1116,6 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx) if (user_options->opencl_info == true) { - user_options->session = "opencl_info"; user_options->quiet = true; user_options->opencl_platforms = NULL; user_options->opencl_devices = NULL;