mirror of
https://github.com/hashcat/hashcat.git
synced 2025-02-17 01:52:06 +00:00
Update restore.c function parameters
This commit is contained in:
parent
000534cdbc
commit
14334e4129
@ -23,22 +23,22 @@
|
|||||||
#define RESTORE_VERSION_MIN 320
|
#define RESTORE_VERSION_MIN 320
|
||||||
#define RESTORE_VERSION_CUR 320
|
#define RESTORE_VERSION_CUR 320
|
||||||
|
|
||||||
u64 get_lowest_words_done (const restore_ctx_t *restore_ctx, const opencl_ctx_t *opencl_ctx);
|
u64 get_lowest_words_done (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
void init_restore (restore_ctx_t *restore_ctx);
|
void init_restore (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
void read_restore (restore_ctx_t *restore_ctx);
|
void read_restore (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
void write_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx);
|
void write_restore (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
void cycle_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx);
|
void cycle_restore (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
void unlink_restore (restore_ctx_t *restore_ctx, status_ctx_t *status_ctx);
|
void unlink_restore (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
void stop_at_checkpoint (restore_ctx_t *restore_ctx, status_ctx_t *status_ctx);
|
void stop_at_checkpoint (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
int restore_ctx_init (restore_ctx_t *restore_ctx, user_options_t *user_options, const folder_config_t *folder_config, int argc, char **argv);
|
int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv);
|
||||||
|
|
||||||
void restore_ctx_destroy (restore_ctx_t *restore_ctx);
|
void restore_ctx_destroy (hashcat_ctx_t *hashcat_ctx);
|
||||||
|
|
||||||
#endif // _RESTORE_H
|
#endif // _RESTORE_H
|
||||||
|
@ -1242,7 +1242,6 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
|
|||||||
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
|
logfile_ctx_t *logfile_ctx = hashcat_ctx->logfile_ctx;
|
||||||
loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx;
|
loopback_ctx_t *loopback_ctx = hashcat_ctx->loopback_ctx;
|
||||||
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
|
outcheck_ctx_t *outcheck_ctx = hashcat_ctx->outcheck_ctx;
|
||||||
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
|
||||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
|
tuning_db_t *tuning_db = hashcat_ctx->tuning_db;
|
||||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
@ -1266,7 +1265,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
|
|||||||
* restore
|
* restore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const int rc_restore_init = restore_ctx_init (restore_ctx, user_options, folder_config, argc, argv);
|
const int rc_restore_init = restore_ctx_init (hashcat_ctx, argc, argv);
|
||||||
|
|
||||||
if (rc_restore_init == -1) return -1;
|
if (rc_restore_init == -1) return -1;
|
||||||
|
|
||||||
@ -1483,7 +1482,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
|
|||||||
|
|
||||||
// if exhausted or cracked, unlink the restore file
|
// if exhausted or cracked, unlink the restore file
|
||||||
|
|
||||||
unlink_restore (restore_ctx, status_ctx);
|
unlink_restore (hashcat_ctx);
|
||||||
|
|
||||||
// final update dictionary cache
|
// final update dictionary cache
|
||||||
|
|
||||||
@ -1517,7 +1516,7 @@ int hashcat (hashcat_ctx_t *hashcat_ctx, char *install_folder, char *shared_fold
|
|||||||
|
|
||||||
opencl_ctx_destroy (hashcat_ctx);
|
opencl_ctx_destroy (hashcat_ctx);
|
||||||
|
|
||||||
restore_ctx_destroy (restore_ctx);
|
restore_ctx_destroy (hashcat_ctx);
|
||||||
|
|
||||||
time (&status_ctx->proc_stop);
|
time (&status_ctx->proc_stop);
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (restore_left == 0)
|
if (restore_left == 0)
|
||||||
{
|
{
|
||||||
cycle_restore (restore_ctx, opencl_ctx);
|
cycle_restore (hashcat_ctx);
|
||||||
|
|
||||||
restore_left = user_options->restore_timer;
|
restore_left = user_options->restore_timer;
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ static void monitor (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (restore_check == true)
|
if (restore_check == true)
|
||||||
{
|
{
|
||||||
cycle_restore (restore_ctx, opencl_ctx);
|
cycle_restore (hashcat_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
myfree (fan_speed_chgd);
|
myfree (fan_speed_chgd);
|
||||||
|
@ -19,8 +19,11 @@ static void fsync (int fd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u64 get_lowest_words_done (const restore_ctx_t *restore_ctx, const opencl_ctx_t *opencl_ctx)
|
u64 get_lowest_words_done (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
|
|
||||||
if (restore_ctx->enabled == false) return 0;
|
if (restore_ctx->enabled == false) return 0;
|
||||||
|
|
||||||
restore_data_t *rd = restore_ctx->rd;
|
restore_data_t *rd = restore_ctx->rd;
|
||||||
@ -49,8 +52,10 @@ u64 get_lowest_words_done (const restore_ctx_t *restore_ctx, const opencl_ctx_t
|
|||||||
return words_cur;
|
return words_cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_running_process (restore_ctx_t *restore_ctx)
|
static void check_running_process (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
|
||||||
char *eff_restore_file = restore_ctx->eff_restore_file;
|
char *eff_restore_file = restore_ctx->eff_restore_file;
|
||||||
|
|
||||||
FILE *fp = fopen (eff_restore_file, "rb");
|
FILE *fp = fopen (eff_restore_file, "rb");
|
||||||
@ -145,13 +150,15 @@ static void check_running_process (restore_ctx_t *restore_ctx)
|
|||||||
myfree (rd);
|
myfree (rd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_restore (restore_ctx_t *restore_ctx)
|
void init_restore (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
|
||||||
restore_data_t *rd = (restore_data_t *) mymalloc (sizeof (restore_data_t));
|
restore_data_t *rd = (restore_data_t *) mymalloc (sizeof (restore_data_t));
|
||||||
|
|
||||||
restore_ctx->rd = rd;
|
restore_ctx->rd = rd;
|
||||||
|
|
||||||
check_running_process (restore_ctx);
|
check_running_process (hashcat_ctx);
|
||||||
|
|
||||||
rd->version = RESTORE_VERSION_CUR;
|
rd->version = RESTORE_VERSION_CUR;
|
||||||
|
|
||||||
@ -172,8 +179,10 @@ void init_restore (restore_ctx_t *restore_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_restore (restore_ctx_t *restore_ctx)
|
void read_restore (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
|
||||||
if (restore_ctx->enabled == false) return;
|
if (restore_ctx->enabled == false) return;
|
||||||
|
|
||||||
char *eff_restore_file = restore_ctx->eff_restore_file;
|
char *eff_restore_file = restore_ctx->eff_restore_file;
|
||||||
@ -233,11 +242,13 @@ void read_restore (restore_ctx_t *restore_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx)
|
void write_restore (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
|
||||||
if (restore_ctx->enabled == false) return;
|
if (restore_ctx->enabled == false) return;
|
||||||
|
|
||||||
const u64 words_cur = get_lowest_words_done (restore_ctx, opencl_ctx);
|
const u64 words_cur = get_lowest_words_done (hashcat_ctx);
|
||||||
|
|
||||||
restore_data_t *rd = restore_ctx->rd;
|
restore_data_t *rd = restore_ctx->rd;
|
||||||
|
|
||||||
@ -277,14 +288,16 @@ void write_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx)
|
|||||||
fclose (fp);
|
fclose (fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cycle_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx)
|
void cycle_restore (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
|
||||||
if (restore_ctx->enabled == false) return;
|
if (restore_ctx->enabled == false) return;
|
||||||
|
|
||||||
const char *eff_restore_file = restore_ctx->eff_restore_file;
|
const char *eff_restore_file = restore_ctx->eff_restore_file;
|
||||||
const char *new_restore_file = restore_ctx->new_restore_file;
|
const char *new_restore_file = restore_ctx->new_restore_file;
|
||||||
|
|
||||||
write_restore (restore_ctx, opencl_ctx);
|
write_restore (hashcat_ctx);
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
@ -302,8 +315,11 @@ void cycle_restore (restore_ctx_t *restore_ctx, opencl_ctx_t *opencl_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unlink_restore (restore_ctx_t *restore_ctx, status_ctx_t *status_ctx)
|
void unlink_restore (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
if ((status_ctx->devices_status == STATUS_EXHAUSTED) && (status_ctx->run_thread_level1 == true)) // this is to check for [c]heckpoint
|
if ((status_ctx->devices_status == STATUS_EXHAUSTED) && (status_ctx->run_thread_level1 == true)) // this is to check for [c]heckpoint
|
||||||
{
|
{
|
||||||
unlink (restore_ctx->eff_restore_file);
|
unlink (restore_ctx->eff_restore_file);
|
||||||
@ -317,8 +333,11 @@ void unlink_restore (restore_ctx_t *restore_ctx, status_ctx_t *status_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop_at_checkpoint (restore_ctx_t *restore_ctx, status_ctx_t *status_ctx)
|
void stop_at_checkpoint (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
|
||||||
// this feature only makes sense if --restore-disable was not specified
|
// this feature only makes sense if --restore-disable was not specified
|
||||||
|
|
||||||
if (restore_ctx->enabled == false)
|
if (restore_ctx->enabled == false)
|
||||||
@ -352,8 +371,12 @@ void stop_at_checkpoint (restore_ctx_t *restore_ctx, status_ctx_t *status_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int restore_ctx_init (restore_ctx_t *restore_ctx, user_options_t *user_options, const folder_config_t *folder_config, int argc, char **argv)
|
int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
folder_config_t *folder_config = hashcat_ctx->folder_config;
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
restore_ctx->enabled = false;
|
restore_ctx->enabled = false;
|
||||||
|
|
||||||
char *eff_restore_file = (char *) mymalloc (HCBUFSIZ_TINY);
|
char *eff_restore_file = (char *) mymalloc (HCBUFSIZ_TINY);
|
||||||
@ -368,7 +391,7 @@ int restore_ctx_init (restore_ctx_t *restore_ctx, user_options_t *user_options,
|
|||||||
restore_ctx->eff_restore_file = eff_restore_file;
|
restore_ctx->eff_restore_file = eff_restore_file;
|
||||||
restore_ctx->new_restore_file = new_restore_file;
|
restore_ctx->new_restore_file = new_restore_file;
|
||||||
|
|
||||||
init_restore (restore_ctx);
|
init_restore (hashcat_ctx);
|
||||||
|
|
||||||
if (argc == 0) return 0;
|
if (argc == 0) return 0;
|
||||||
if (argv == NULL) return 0;
|
if (argv == NULL) return 0;
|
||||||
@ -387,7 +410,7 @@ int restore_ctx_init (restore_ctx_t *restore_ctx, user_options_t *user_options,
|
|||||||
|
|
||||||
if (user_options->restore == true)
|
if (user_options->restore == true)
|
||||||
{
|
{
|
||||||
read_restore (restore_ctx);
|
read_restore (hashcat_ctx);
|
||||||
|
|
||||||
restore_data_t *rd = restore_ctx->rd;
|
restore_data_t *rd = restore_ctx->rd;
|
||||||
|
|
||||||
@ -414,8 +437,10 @@ int restore_ctx_init (restore_ctx_t *restore_ctx, user_options_t *user_options,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void restore_ctx_destroy (restore_ctx_t *restore_ctx)
|
void restore_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
|
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
||||||
|
|
||||||
myfree (restore_ctx->eff_restore_file);
|
myfree (restore_ctx->eff_restore_file);
|
||||||
myfree (restore_ctx->new_restore_file);
|
myfree (restore_ctx->new_restore_file);
|
||||||
|
|
||||||
|
@ -152,7 +152,6 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
|||||||
hashes_t *hashes = hashcat_ctx->hashes;
|
hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||||
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
|
||||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
@ -224,7 +223,7 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
|
|||||||
* words_cur
|
* words_cur
|
||||||
*/
|
*/
|
||||||
|
|
||||||
u64 words_cur = get_lowest_words_done (restore_ctx, opencl_ctx);
|
u64 words_cur = get_lowest_words_done (hashcat_ctx);
|
||||||
|
|
||||||
fprintf (out, "CURKU\t%" PRIu64 "\t", words_cur);
|
fprintf (out, "CURKU\t%" PRIu64 "\t", words_cur);
|
||||||
|
|
||||||
@ -320,7 +319,6 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
hashes_t *hashes = hashcat_ctx->hashes;
|
hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||||
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||||
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
|
||||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||||
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
||||||
@ -1033,7 +1031,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
// Restore point
|
// Restore point
|
||||||
|
|
||||||
u64 restore_point = get_lowest_words_done (restore_ctx, opencl_ctx);
|
u64 restore_point = get_lowest_words_done (hashcat_ctx);
|
||||||
|
|
||||||
u64 restore_total = status_ctx->words_base;
|
u64 restore_total = status_ctx->words_base;
|
||||||
|
|
||||||
|
@ -112,14 +112,12 @@ void clear_prompt ()
|
|||||||
|
|
||||||
static void keypress (hashcat_ctx_t *hashcat_ctx)
|
static void keypress (hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||||
|
user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
|
|
||||||
// this is required, because some of the variables down there are not initialized at that point
|
// this is required, because some of the variables down there are not initialized at that point
|
||||||
while (status_ctx->devices_status == STATUS_INIT) hc_sleep_ms (100);
|
while (status_ctx->devices_status == STATUS_INIT) hc_sleep_ms (100);
|
||||||
|
|
||||||
restore_ctx_t *restore_ctx = hashcat_ctx->restore_ctx;
|
|
||||||
user_options_t *user_options = hashcat_ctx->user_options;
|
|
||||||
|
|
||||||
const bool quiet = user_options->quiet;
|
const bool quiet = user_options->quiet;
|
||||||
|
|
||||||
tty_break ();
|
tty_break ();
|
||||||
@ -197,7 +195,7 @@ static void keypress (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
log_info ("");
|
log_info ("");
|
||||||
|
|
||||||
stop_at_checkpoint (restore_ctx, status_ctx);
|
stop_at_checkpoint (hashcat_ctx);
|
||||||
|
|
||||||
log_info ("");
|
log_info ("");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user