diff --git a/docs/changes.txt b/docs/changes.txt index 0d5998a54..bb2889bab 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -69,6 +69,7 @@ - Fixed output of IKE PSK (mode 5300 and 5400) hashes to have separators at right position - Fixed output password of "e" rule in pure and cpu rule engine if separator character is also the first letter - Fixed problem with the usage of the hexadecimal notations (\x00-\xff) within rules +- Fixed race condition in maskfile mode by using a dedicated flag for restore execution - Fixed some memory leaks in case hashcat is shutting down due to some file error - Fixed the 7-Zip parser to allow the entire supported range of encrypted and decrypted data lengths - Fixed the validation of the --brain-client-features command line argument (only values 1, 2 or 3 are allowed) diff --git a/include/types.h b/include/types.h index 08e3f88c0..e23e0e75b 100644 --- a/include/types.h +++ b/include/types.h @@ -1716,6 +1716,8 @@ typedef struct restore_ctx { bool enabled; + bool restore_execute; + int argc; char **argv; diff --git a/src/hashcat.c b/src/hashcat.c index 0f21a91aa..01a069ab7 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -84,21 +84,18 @@ static int inner2_loop (hashcat_ctx_t *hashcat_ctx) status_ctx->words_off = 0; status_ctx->words_cur = 0; - if (restore_ctx->rd) + if (restore_ctx->restore_execute == true) { - restore_data_t *rd = restore_ctx->rd; + restore_ctx->restore_execute = false; - if (rd->words_cur > 0) - { - status_ctx->words_off = rd->words_cur; - status_ctx->words_cur = status_ctx->words_off; + restore_data_t *rd = restore_ctx->rd; - rd->words_cur = 0; + status_ctx->words_off = rd->words_cur; + status_ctx->words_cur = status_ctx->words_off; - // --restore always overrides --skip + // --restore always overrides --skip - user_options->skip = 0; - } + user_options->skip = 0; } if (user_options->skip > 0) diff --git a/src/restore.c b/src/restore.c index 94a7a1f3d..a56c1aa08 100644 --- a/src/restore.c +++ b/src/restore.c @@ -332,6 +332,8 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) restore_ctx->enabled = true; + restore_ctx->restore_execute = false; + if (user_options->restore == true) { if (read_restore (hashcat_ctx) == -1) return -1; @@ -348,6 +350,8 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) user_options_init (hashcat_ctx); if (user_options_getopt (hashcat_ctx, rd->argc, rd->argv) == -1) return -1; + + restore_ctx->restore_execute = true; } return 0;