Add --restore-file-path option

This option set the restore file path.
It's useful when we need all session files in specific directory.

Example:
hashcat -m 0 --session "Test" --potfile-path "/path/to/my/potfile.potfile"
--restore-file-path "/path/to/my/restore_file.restore" hashs.txt -a 3 ?a?a?a?a
Restore session with :
hashcat --sesion "Test" --restore --restore-file-path
"/path/to/my/restore_file.restore"
pull/550/head
Etienne 8 years ago
parent 5accadb511
commit f35f475b4f

@ -1200,6 +1200,7 @@ typedef struct user_options
char *outfile;
char *outfile_check_dir;
char *potfile_path;
char *restore_file_path;
char **rp_files;
char *rule_buf_l;
char *rule_buf_r;

@ -129,31 +129,32 @@ typedef enum user_options_map
IDX_REMOVE_TIMER = 0xff23,
IDX_RESTORE = 0xff24,
IDX_RESTORE_DISABLE = 0xff25,
IDX_RESTORE_FILE_PATH = 0xff26,
IDX_RP_FILE = 'r',
IDX_RP_GEN_FUNC_MAX = 0xff26,
IDX_RP_GEN_FUNC_MIN = 0xff27,
IDX_RP_GEN_FUNC_MAX = 0xff27,
IDX_RP_GEN_FUNC_MIN = 0xff28,
IDX_RP_GEN = 'g',
IDX_RP_GEN_SEED = 0xff28,
IDX_RP_GEN_SEED = 0xff29,
IDX_RULE_BUF_L = 'j',
IDX_RULE_BUF_R = 'k',
IDX_RUNTIME = 0xff29,
IDX_SCRYPT_TMTO = 0xff2a,
IDX_RUNTIME = 0xff2a,
IDX_SCRYPT_TMTO = 0xff2b,
IDX_SEGMENT_SIZE = 'c',
IDX_SEPARATOR = 'p',
IDX_SESSION = 0xff2b,
IDX_SHOW = 0xff2c,
IDX_SESSION = 0xff2c,
IDX_SHOW = 0xff2d,
IDX_SKIP = 's',
IDX_STATUS = 0xff2d,
IDX_STATUS_TIMER = 0xff2e,
IDX_STDOUT_FLAG = 0xff2f,
IDX_SPEED_ONLY = 0xff30,
IDX_TRUECRYPT_KEYFILES = 0xff31,
IDX_USERNAME = 0xff32,
IDX_VERACRYPT_KEYFILES = 0xff33,
IDX_VERACRYPT_PIM = 0xff34,
IDX_STATUS = 0xff2e,
IDX_STATUS_TIMER = 0xff2f,
IDX_STDOUT_FLAG = 0xff30,
IDX_SPEED_ONLY = 0xff31,
IDX_TRUECRYPT_KEYFILES = 0xff32,
IDX_USERNAME = 0xff33,
IDX_VERACRYPT_KEYFILES = 0xff34,
IDX_VERACRYPT_PIM = 0xff35,
IDX_VERSION_LOWER = 'v',
IDX_VERSION = 'V',
IDX_WEAK_HASH_THRESHOLD = 0xff35,
IDX_WEAK_HASH_THRESHOLD = 0xff36,
IDX_WORKLOAD_PROFILE = 'w'
} user_options_map_t;

@ -342,18 +342,25 @@ int restore_ctx_init (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
if (argc == 0) return 0;
if (argv == NULL) return 0;
char *eff_restore_file = (char *) hcmalloc (hashcat_ctx, HCBUFSIZ_TINY); VERIFY_PTR (eff_restore_file);
char *new_restore_file = (char *) hcmalloc (hashcat_ctx, HCBUFSIZ_TINY); VERIFY_PTR (new_restore_file);
if (user_options->restore_file_path == NULL)
{
restore_ctx->eff_restore_file = (char *) hcmalloc (hashcat_ctx, HCBUFSIZ_TINY); VERIFY_PTR (restore_ctx->eff_restore_file);
restore_ctx->new_restore_file = (char *) hcmalloc (hashcat_ctx, HCBUFSIZ_TINY); VERIFY_PTR (restore_ctx->new_restore_file);
snprintf (restore_ctx->eff_restore_file, HCBUFSIZ_TINY - 1, "%s/%s.restore", folder_config->session_dir, user_options->session);
snprintf (restore_ctx->new_restore_file, HCBUFSIZ_TINY - 1, "%s/%s.restore.new", folder_config->session_dir, user_options->session);
}
else
{
restore_ctx->eff_restore_file = hcstrdup(hashcat_ctx, user_options->restore_file_path); VERIFY_PTR(restore_ctx->eff_restore_file);
restore_ctx->new_restore_file = (char *) hcmalloc (hashcat_ctx, HCBUFSIZ_TINY); VERIFY_PTR (restore_ctx->new_restore_file);
snprintf (eff_restore_file, HCBUFSIZ_TINY - 1, "%s/%s.restore", folder_config->session_dir, user_options->session);
snprintf (new_restore_file, HCBUFSIZ_TINY - 1, "%s/%s.restore.new", folder_config->session_dir, user_options->session);
snprintf (restore_ctx->new_restore_file, HCBUFSIZ_TINY - 1, "%s.new", user_options->restore_file_path);
}
restore_ctx->argc = argc;
restore_ctx->argv = argv;
restore_ctx->eff_restore_file = eff_restore_file;
restore_ctx->new_restore_file = new_restore_file;
const int rc_init_restore = init_restore (hashcat_ctx);
if (rc_init_restore == -1) return -1;

@ -46,6 +46,7 @@ static const char *USAGE_BIG[] =
" --session | Str | Define specific session name | --session=mysession",
" --restore | | Restore session from --session |",
" --restore-disable | | Do not write restore file |",
" --restore-file-path | Dir | Specific path to restore file | --restore-file-path=my.restore",
" -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
" --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
" --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",

@ -76,6 +76,7 @@ static const struct option long_options[] =
{"remove", no_argument, 0, IDX_REMOVE},
{"remove-timer", required_argument, 0, IDX_REMOVE_TIMER},
{"restore-disable", no_argument, 0, IDX_RESTORE_DISABLE},
{"restore-file-path", required_argument, 0, IDX_RESTORE_FILE_PATH},
{"restore", no_argument, 0, IDX_RESTORE},
{"rule-left", required_argument, 0, IDX_RULE_BUF_L},
{"rule-right", required_argument, 0, IDX_RULE_BUF_R},
@ -166,6 +167,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx)
user_options->remove = REMOVE;
user_options->remove_timer = REMOVE_TIMER;
user_options->restore_disable = RESTORE_DISABLE;
user_options->restore_file_path = NULL;
user_options->restore = RESTORE;
user_options->restore_timer = RESTORE_TIMER;
user_options->rp_gen_func_max = RP_GEN_FUNC_MAX;
@ -251,6 +253,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
case IDX_STDOUT_FLAG: user_options->stdout_flag = true; break;
case IDX_SPEED_ONLY: user_options->speed_only = true; break;
case IDX_RESTORE_DISABLE: user_options->restore_disable = true; break;
case IDX_RESTORE_FILE_PATH: user_options->restore_file_path = optarg; break;
case IDX_STATUS: user_options->status = true; break;
case IDX_STATUS_TIMER: user_options->status_timer = atoi (optarg); break;
case IDX_MACHINE_READABLE: user_options->machine_readable = true; break;
@ -1223,6 +1226,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx)
logfile_top_string (user_options->outfile);
logfile_top_string (user_options->outfile_check_dir);
logfile_top_string (user_options->potfile_path);
logfile_top_string (user_options->restore_file_path);
logfile_top_string (user_options->rp_files[0]);
logfile_top_string (user_options->rule_buf_l);
logfile_top_string (user_options->rule_buf_r);

Loading…
Cancel
Save