1
mirror of https://github.com/hashcat/hashcat synced 2024-12-27 05:13:45 +01:00

Session Management: Automatically set dedicated session names for non-cracking parameters, for example: --stdout

This commit is contained in:
jsteube 2017-03-02 19:57:34 +01:00
parent 5f7c3590ba
commit 54ad27da7d
4 changed files with 57 additions and 4 deletions

View File

@ -98,6 +98,7 @@
- Outfile Check: Fixed a memory leak for failed outfile reads - Outfile Check: Fixed a memory leak for failed outfile reads
- Restore: Add some checks on the rd->cwd variable in restore case - Restore: Add some checks on the rd->cwd variable in restore case
- Rule Engine: Fixed several memory leaks in case loading of rules failed - 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 - 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 - Sessions: Move out handling of multiple instance from restore file into separate pidfile
- Status screen: Do not try to clear prompt in --quiet mode - Status screen: Do not try to clear prompt in --quiet mode

View File

@ -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); 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_preprocess (hashcat_ctx_t *hashcat_ctx);
void user_options_postprocess (hashcat_ctx_t *hashcat_ctx); void user_options_postprocess (hashcat_ctx_t *hashcat_ctx);

View File

@ -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; 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) * event init (needed for logging so should be first)
*/ */

View File

@ -983,6 +983,54 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return 0; 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) void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
{ {
user_options_t *user_options = hashcat_ctx->user_options; 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_disable = true;
user_options->restore = false; user_options->restore = false;
user_options->restore_timer = 0; user_options->restore_timer = 0;
user_options->session = "benchmark";
user_options->show = false; user_options->show = false;
user_options->status = false; user_options->status = false;
user_options->status_timer = 0; user_options->status_timer = 0;
@ -1053,13 +1100,11 @@ void user_options_preprocess (hashcat_ctx_t *hashcat_ctx)
if (user_options->keyspace == true) if (user_options->keyspace == true)
{ {
user_options->session = "keyspace";
user_options->quiet = true; user_options->quiet = true;
} }
if (user_options->stdout_flag == true) if (user_options->stdout_flag == true)
{ {
user_options->session = "stdout";
user_options->quiet = true; user_options->quiet = true;
user_options->hash_mode = 2000; user_options->hash_mode = 2000;
user_options->outfile_format = OUTFILE_FMT_PLAIN; 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) if (user_options->opencl_info == true)
{ {
user_options->session = "opencl_info";
user_options->quiet = true; user_options->quiet = true;
user_options->opencl_platforms = NULL; user_options->opencl_platforms = NULL;
user_options->opencl_devices = NULL; user_options->opencl_devices = NULL;