diff --git a/docs/changes.txt b/docs/changes.txt index a319a12c4..388db475d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -115,6 +115,7 @@ - OpenCL Runtime: Added support to use Apple Silicon compute devices - OpenCL Runtime: Add some unstable warnings detected on macOS - OpenCL Runtime: Set default device-type to GPU with Apple Silicon compute devices +- Restore: Restore timer is decreased from 60 seconds to 1 second, but only updates if there's actually a change compared to previous data written to restore file - Rules: Add new rulesets from T0XlC: T0XlCv2, T0XlC_3_rule, T0XlC_insert_HTLM_entities_0_Z - Rules: Add support to include source wordlist in debugging format - Rules: Update hand-written rulesets to covers years up to 2029 diff --git a/include/types.h b/include/types.h index 6294ca34e..8f390be90 100644 --- a/include/types.h +++ b/include/types.h @@ -679,7 +679,7 @@ typedef enum user_options_defaults REMOVE_TIMER = 60, RESTORE_DISABLE = false, RESTORE = false, - RESTORE_TIMER = 60, + RESTORE_TIMER = 1, RP_GEN = 0, RP_GEN_FUNC_MAX = 4, RP_GEN_FUNC_MIN = 1, @@ -2183,6 +2183,10 @@ typedef struct restore_ctx restore_data_t *rd; + u32 dicts_pos_prev; + u32 masks_pos_prev; + u64 words_cur_prev; + } restore_ctx_t; typedef struct pidfile_ctx diff --git a/src/restore.c b/src/restore.c index 78e2eb418..8f0547313 100644 --- a/src/restore.c +++ b/src/restore.c @@ -240,6 +240,19 @@ int cycle_restore (hashcat_ctx_t *hashcat_ctx) if (restore_ctx->enabled == false) return 0; + const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx; + const status_ctx_t *status_ctx = hashcat_ctx->status_ctx; + const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx; + + // no updates, no need to write + if ((restore_ctx->masks_pos_prev == mask_ctx->masks_pos) + && (restore_ctx->dicts_pos_prev == straight_ctx->dicts_pos) + && (restore_ctx->words_cur_prev == status_ctx->words_cur)) return 0; + + restore_ctx->masks_pos_prev = mask_ctx->masks_pos; + restore_ctx->dicts_pos_prev = straight_ctx->dicts_pos; + restore_ctx->words_cur_prev = status_ctx->words_cur; + const char *eff_restore_file = restore_ctx->eff_restore_file; const char *new_restore_file = restore_ctx->new_restore_file; @@ -346,6 +359,10 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) restore_ctx->restore_execute = true; } + restore_ctx->masks_pos_prev = -1; + restore_ctx->dicts_pos_prev = -1; + restore_ctx->words_cur_prev = -1; + return 0; }