1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 01:50:10 +00:00

Dictstat: On Windows, the st_ino attribute in the stat struct is not set which can lead to invalid cache hits. Added the filename to the database entry.

This commit is contained in:
Jens Steube 2020-03-10 15:42:55 +01:00
parent 8c3808bad5
commit d706f90a75
5 changed files with 23 additions and 2 deletions

View File

@ -108,6 +108,7 @@
- Building: Fix for library compilation failure due to multiple defenition of sbob_xx64() - Building: Fix for library compilation failure due to multiple defenition of sbob_xx64()
- Building: Updated BUILD.md - Building: Updated BUILD.md
- Cracking bcrypt and Password Safe v2: Use a feedback from the compute API backend to dynamically find out optimal thread count - Cracking bcrypt and Password Safe v2: Use a feedback from the compute API backend to dynamically find out optimal thread count
- Dictstat: On Windows, the st_ino attribute in the stat struct is not set which can lead to invalid cache hits. Added the filename to the database entry.
- Documents: Added README on how to build hashcat on MSYS2 - Documents: Added README on how to build hashcat on MSYS2
- File handling: Print a truncation warning when an oversized line is detected - File handling: Print a truncation warning when an oversized line is detected
- My Wallet: Added additional plaintext pattern used in newer versions - My Wallet: Added additional plaintext pattern used in newer versions

View File

@ -18,7 +18,7 @@
#define MAX_DICTSTAT 100000 #define MAX_DICTSTAT 100000
#define DICTSTAT_FILENAME "hashcat.dictstat2" #define DICTSTAT_FILENAME "hashcat.dictstat2"
#define DICTSTAT_VERSION (0x6863646963743200 | 0x01) #define DICTSTAT_VERSION (0x6863646963743200 | 0x02)
int sort_by_dictstat (const void *s1, const void *s2); int sort_by_dictstat (const void *s1, const void *s2);

View File

@ -1656,6 +1656,8 @@ typedef struct dictstat
char encoding_from[64]; char encoding_from[64];
char encoding_to[64]; char encoding_to[64];
u8 hash_filename[16];
} dictstat_t; } dictstat_t;
typedef struct hashdump typedef struct hashdump

View File

@ -17,6 +17,10 @@ int sort_by_dictstat (const void *s1, const void *s2)
const dictstat_t *d1 = (const dictstat_t *) s1; const dictstat_t *d1 = (const dictstat_t *) s1;
const dictstat_t *d2 = (const dictstat_t *) s2; const dictstat_t *d2 = (const dictstat_t *) s2;
const int rc_hash = memcmp (d1->hash_filename, d2->hash_filename, 16);
if (rc_hash != 0) return rc_hash;
const int rc_from = strcmp (d1->encoding_from, d2->encoding_from); const int rc_from = strcmp (d1->encoding_from, d2->encoding_from);
if (rc_from != 0) return rc_from; if (rc_from != 0) return rc_from;

View File

@ -13,6 +13,7 @@
#include "rp_cpu.h" #include "rp_cpu.h"
#include "shared.h" #include "shared.h"
#include "wordlist.h" #include "wordlist.h"
#include "emu_inc_hash_sha1.h"
size_t convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const size_t line_len) size_t convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const size_t line_len)
{ {
@ -340,7 +341,7 @@ int count_words (hashcat_ctx_t *hashcat_ctx, HCFILE *fp, const char *dictfile, u
dictstat_t d; dictstat_t d;
d.cnt = 0; memset (&d, 0, sizeof (d));
if (fstat (hc_fileno (fp), &d.stat)) if (fstat (hc_fileno (fp), &d.stat))
{ {
@ -378,6 +379,19 @@ int count_words (hashcat_ctx_t *hashcat_ctx, HCFILE *fp, const char *dictfile, u
return 0; return 0;
} }
const size_t dictfile_len = strlen (dictfile);
u32 *dictfile_padded = (u32 *) hcmalloc (dictfile_len + 64); // padding required for sha1_update()
sha1_ctx_t sha1_ctx;
sha1_init (&sha1_ctx);
sha1_update (&sha1_ctx, dictfile_padded, dictfile_len);
sha1_final (&sha1_ctx);
hcfree (dictfile_padded);
memcpy (d.hash_filename, sha1_ctx.h, 16);
const u64 cached_cnt = dictstat_find (hashcat_ctx, &d); const u64 cached_cnt = dictstat_find (hashcat_ctx, &d);
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l) == 0) if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l) == 0)