Fixed strategy for eliminating hashes with zero length in LM when multiple hashes contain a zero hash

pull/2999/head
Jens Steube 3 years ago
parent ee3eb21a0d
commit dbefc7e60e

@ -13,6 +13,7 @@
- Fixed division by zero because backend_ctx->hardware_power_all was not re-inserted after refactoring device_param->hardware_power - Fixed division by zero because backend_ctx->hardware_power_all was not re-inserted after refactoring device_param->hardware_power
- Fixed invalid progress counter initialization in attack-mode 9 when using --skip or --restore - Fixed invalid progress counter initialization in attack-mode 9 when using --skip or --restore
- Fixed out-of-boundary reads in attack-mode 9 that were caused by a missing work item limit in the refactored autotune engine - Fixed out-of-boundary reads in attack-mode 9 that were caused by a missing work item limit in the refactored autotune engine
- Fixed strategy for eliminating hashes with zero length in LM when multiple hashes contain a zero hash
## ##
## Technical ## Technical

@ -2263,51 +2263,56 @@ int hashes_init_zerohash (hashcat_ctx_t *hashcat_ctx)
module_ctx->module_hash_decode_zero_hash (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info); module_ctx->module_hash_decode_zero_hash (hashconfig, hash_buf.digest, hash_buf.salt, hash_buf.esalt, hash_buf.hook_salt, hash_buf.hash_info);
hash_t *found = (hash_t *) hc_bsearch_r (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash_no_salt, (void *) hashconfig); for (u32 i = 0; i < hashes_cnt; i++)
if (found != NULL)
{ {
found->pw_buf = (char *) hcmalloc (1); hash_t *next = &hashes_buf[i];
found->pw_len = 0;
found->cracked = 1;
// should we show the cracked zero hash to the user? int rc = sort_by_hash_no_salt (&hash_buf, next, (void *) hashconfig);
if (false) if (rc == 0)
{ {
// digest pos next->pw_buf = (char *) hcmalloc (1);
next->pw_len = 0;
const u32 digest_pos = found - hashes_buf; next->cracked = 1;
// show the crack // should we show the cracked zero hash to the user?
u8 *out_buf = (u8 *) hcmalloc (HCBUFSIZ_LARGE); if (false)
{
// digest pos
int out_len = hash_encode (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf, HCBUFSIZ_LARGE, 0, digest_pos); const u32 digest_pos = next - hashes_buf;
out_buf[out_len] = 0; // show the crack
// outfile, can be either to file or stdout u8 *out_buf = (u8 *) hcmalloc (HCBUFSIZ_LARGE);
// if an error occurs opening the file, send to stdout as fallback
// the fp gets opened for each cracked hash so that the user can modify (move) the outfile while hashcat runs
outfile_write_open (hashcat_ctx); int out_len = hash_encode (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, (char *) out_buf, HCBUFSIZ_LARGE, 0, digest_pos);
const u8 *plain = (const u8 *) ""; out_buf[out_len] = 0;
u8 *tmp_buf = (u8 *) hcmalloc (HCBUFSIZ_LARGE); // outfile, can be either to file or stdout
// if an error occurs opening the file, send to stdout as fallback
// the fp gets opened for each cracked hash so that the user can modify (move) the outfile while hashcat runs
tmp_buf[0] = 0; outfile_write_open (hashcat_ctx);
const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, plain, 0, 0, NULL, 0, true, (char *) tmp_buf); const u8 *plain = (const u8 *) "";
EVENT_DATA (EVENT_CRACKER_HASH_CRACKED, tmp_buf, tmp_len); u8 *tmp_buf = (u8 *) hcmalloc (HCBUFSIZ_LARGE);
outfile_write_close (hashcat_ctx); tmp_buf[0] = 0;
hcfree (tmp_buf); const int tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, out_len, plain, 0, 0, NULL, 0, true, (char *) tmp_buf);
hcfree (out_buf);
EVENT_DATA (EVENT_CRACKER_HASH_CRACKED, tmp_buf, tmp_len);
outfile_write_close (hashcat_ctx);
hcfree (tmp_buf);
hcfree (out_buf);
}
} }
} }

Loading…
Cancel
Save