mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-23 06:01:06 +00:00
Add a warning message if old hccap file is detected and abort
This commit is contained in:
parent
7c5c7047ce
commit
9aabc20248
@ -1733,6 +1733,7 @@ char *stroptitype (const u32 opti_type);
|
||||
char *strhashtype (const u32 hash_mode);
|
||||
char *strparser (const u32 parser_status);
|
||||
|
||||
int check_old_hccap (const char *hashfile);
|
||||
void to_hccapx_t (hashcat_ctx_t *hashcat_ctx, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos);
|
||||
|
||||
void wpa_essid_reuse (hashcat_ctx_t *hashcat_ctx);
|
||||
|
14
src/hashes.c
14
src/hashes.c
@ -477,6 +477,20 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 392 = old hccap_t size
|
||||
|
||||
if ((st.st_size % 392) == 0)
|
||||
{
|
||||
const int rc = check_old_hccap (hashes->hashfile);
|
||||
|
||||
if (rc == 1)
|
||||
{
|
||||
event_log_error (hashcat_ctx, "%s: Old hccap file format detected! You need to update: https://hashcat.net/forum/thread-6273.html", hashes->hashfile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
hashes_avail = st.st_size / sizeof (hccapx_t);
|
||||
}
|
||||
else if (hashconfig->hash_mode == 14600)
|
||||
|
@ -14720,6 +14720,25 @@ char *strparser (const u32 parser_status)
|
||||
return ((char *) PA_255);
|
||||
}
|
||||
|
||||
int check_old_hccap (const char *hashfile)
|
||||
{
|
||||
FILE *fp = fopen (hashfile, "rb");
|
||||
|
||||
if (fp == NULL) return -1;
|
||||
|
||||
u32 signature;
|
||||
|
||||
const int nread = fread (&signature, sizeof (u32), 1, fp);
|
||||
|
||||
if (nread != 1) return -1;
|
||||
|
||||
fclose (fp);
|
||||
|
||||
if (signature == HCCAPX_SIGNATURE) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void to_hccapx_t (hashcat_ctx_t *hashcat_ctx, hccapx_t *hccapx, const u32 salt_pos, const u32 digest_pos)
|
||||
{
|
||||
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||
|
Loading…
Reference in New Issue
Block a user