mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-03 04:11:06 +00:00
Refactored Recovered.New... handling
This commit is contained in:
parent
bf0ffa66d7
commit
a52b70d1c5
@ -39,10 +39,12 @@ char *status_get_guess_candidates_dev (const hashcat_ctx_t *hash
|
||||
char *status_get_hash_name (const hashcat_ctx_t *hashcat_ctx);
|
||||
char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx);
|
||||
int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx);
|
||||
int status_get_digests_done_new (const hashcat_ctx_t *hashcat_ctx);
|
||||
int status_get_digests_done_pot (const hashcat_ctx_t *hashcat_ctx);
|
||||
int status_get_digests_done_zero (const hashcat_ctx_t *hashcat_ctx);
|
||||
int status_get_digests_done_new (const hashcat_ctx_t *hashcat_ctx);
|
||||
int status_get_digests_cnt (const hashcat_ctx_t *hashcat_ctx);
|
||||
double status_get_digests_percent (const hashcat_ctx_t *hashcat_ctx);
|
||||
double status_get_digests_percent_new (const hashcat_ctx_t *hashcat_ctx);
|
||||
int status_get_salts_done (const hashcat_ctx_t *hashcat_ctx);
|
||||
int status_get_salts_cnt (const hashcat_ctx_t *hashcat_ctx);
|
||||
double status_get_salts_percent (const hashcat_ctx_t *hashcat_ctx);
|
||||
|
@ -910,6 +910,8 @@ typedef struct hash
|
||||
void *esalt;
|
||||
void *hook_salt; // additional salt info only used by the hook (host)
|
||||
int cracked;
|
||||
int cracked_pot;
|
||||
int cracked_zero;
|
||||
hashinfo_t *hash_info;
|
||||
char *pw_buf;
|
||||
int pw_len;
|
||||
@ -945,6 +947,8 @@ typedef struct hashes
|
||||
u32 digests_cnt;
|
||||
u32 digests_done;
|
||||
u32 digests_done_pot;
|
||||
u32 digests_done_zero;
|
||||
u32 digests_done_new;
|
||||
u32 digests_saved;
|
||||
|
||||
void *digests_buf;
|
||||
@ -2640,9 +2644,11 @@ typedef struct hashcat_status
|
||||
double msec_real;
|
||||
int digests_cnt;
|
||||
int digests_done;
|
||||
int digests_done_new;
|
||||
int digests_done_pot;
|
||||
int digests_done_zero;
|
||||
int digests_done_new;
|
||||
double digests_percent;
|
||||
double digests_percent_new;
|
||||
int salts_cnt;
|
||||
int salts_done;
|
||||
double salts_percent;
|
||||
|
@ -1927,9 +1927,11 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
|
||||
|
||||
hashcat_status->digests_cnt = status_get_digests_cnt (hashcat_ctx);
|
||||
hashcat_status->digests_done = status_get_digests_done (hashcat_ctx);
|
||||
hashcat_status->digests_done_new = status_get_digests_done_new (hashcat_ctx);
|
||||
hashcat_status->digests_done_pot = status_get_digests_done_pot (hashcat_ctx);
|
||||
hashcat_status->digests_done_zero = status_get_digests_done_zero (hashcat_ctx);
|
||||
hashcat_status->digests_done_new = status_get_digests_done_new (hashcat_ctx);
|
||||
hashcat_status->digests_percent = status_get_digests_percent (hashcat_ctx);
|
||||
hashcat_status->digests_percent_new = status_get_digests_percent_new (hashcat_ctx);
|
||||
hashcat_status->hash_target = status_get_hash_target (hashcat_ctx);
|
||||
hashcat_status->hash_name = status_get_hash_name (hashcat_ctx);
|
||||
hashcat_status->guess_base = status_get_guess_base (hashcat_ctx);
|
||||
|
46
src/hashes.c
46
src/hashes.c
@ -691,6 +691,8 @@ int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
hashes->digests_done++;
|
||||
|
||||
hashes->digests_done_new++;
|
||||
|
||||
cpt_cracked++;
|
||||
|
||||
salt_buf->digests_done++;
|
||||
@ -1995,7 +1997,7 @@ int hashes_init_stage2 (hashcat_ctx_t *hashcat_ctx)
|
||||
u32 digests_cnt = hashes_cnt;
|
||||
u32 digests_done = 0;
|
||||
|
||||
u32 *digests_shown = (u32 *) hccalloc (digests_cnt, sizeof (u32));
|
||||
u32 *digests_shown = (u32 *) hccalloc (digests_cnt, sizeof (u32));
|
||||
|
||||
u32 salts_cnt = 0;
|
||||
u32 salts_done = 0;
|
||||
@ -2150,16 +2152,17 @@ int hashes_init_stage3 (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
u32 digests_done = hashes->digests_done;
|
||||
u32 *digests_shown = hashes->digests_shown;
|
||||
u32 digests_done = hashes->digests_done;
|
||||
u32 digests_done_zero = hashes->digests_done_zero;
|
||||
u32 digests_done_pot = hashes->digests_done_pot;
|
||||
u32 *digests_shown = hashes->digests_shown;
|
||||
|
||||
u32 salts_cnt = hashes->salts_cnt;
|
||||
u32 salts_done = hashes->salts_done;
|
||||
u32 *salts_shown = hashes->salts_shown;
|
||||
u32 salts_cnt = hashes->salts_cnt;
|
||||
u32 salts_done = hashes->salts_done;
|
||||
u32 *salts_shown = hashes->salts_shown;
|
||||
|
||||
hash_t *hashes_buf = hashes->hashes_buf;
|
||||
|
||||
salt_t *salts_buf = hashes->salts_buf;
|
||||
hash_t *hashes_buf = hashes->hashes_buf;
|
||||
salt_t *salts_buf = hashes->salts_buf;
|
||||
|
||||
for (u32 salt_idx = 0; salt_idx < salts_cnt; salt_idx++)
|
||||
{
|
||||
@ -2171,12 +2174,25 @@ int hashes_init_stage3 (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const u32 hashes_idx = salt_buf->digests_offset + digest_idx;
|
||||
|
||||
if (hashes_buf[hashes_idx].cracked == 1)
|
||||
if (hashes_buf[hashes_idx].cracked_pot == 1)
|
||||
{
|
||||
digests_shown[hashes_idx] = 1;
|
||||
|
||||
digests_done++;
|
||||
|
||||
digests_done_pot++;
|
||||
|
||||
salt_buf->digests_done++;
|
||||
}
|
||||
|
||||
if (hashes_buf[hashes_idx].cracked_zero == 1)
|
||||
{
|
||||
digests_shown[hashes_idx] = 1;
|
||||
|
||||
digests_done++;
|
||||
|
||||
digests_done_zero++;
|
||||
|
||||
salt_buf->digests_done++;
|
||||
}
|
||||
}
|
||||
@ -2191,10 +2207,12 @@ int hashes_init_stage3 (hashcat_ctx_t *hashcat_ctx)
|
||||
if (salts_done == salts_cnt) mycracked (hashcat_ctx);
|
||||
}
|
||||
|
||||
hashes->digests_done = digests_done;
|
||||
hashes->digests_done = digests_done;
|
||||
hashes->digests_done_zero = digests_done_zero;
|
||||
hashes->digests_done_pot = digests_done_pot;
|
||||
|
||||
hashes->salts_cnt = salts_cnt;
|
||||
hashes->salts_done = salts_done;
|
||||
hashes->salts_cnt = salts_cnt;
|
||||
hashes->salts_done = salts_done;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2553,7 +2571,7 @@ int hashes_init_zerohash (hashcat_ctx_t *hashcat_ctx)
|
||||
next->pw_buf = (char *) hcmalloc (1);
|
||||
next->pw_len = 0;
|
||||
|
||||
next->cracked = 1;
|
||||
next->cracked_zero = 1;
|
||||
|
||||
// should we show the cracked zero hash to the user?
|
||||
|
||||
|
36
src/main.c
36
src/main.c
@ -414,24 +414,30 @@ static void main_potfile_hash_left (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAY
|
||||
static void main_potfile_num_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const void *buf, MAYBE_UNUSED const size_t len)
|
||||
{
|
||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||
hashes_t *hashes = hashcat_ctx->hashes;
|
||||
hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
if (user_options->quiet == true) return;
|
||||
|
||||
hashes->digests_done_pot = hashes->digests_done;
|
||||
|
||||
if (hashes->digests_done_pot > 0)
|
||||
if (hashes->digests_done_zero == 1)
|
||||
{
|
||||
if (hashes->digests_done_pot == 1)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "INFO: Removed 1 hash found as potfile entry or as empty hash.");
|
||||
event_log_info (hashcat_ctx, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
event_log_info (hashcat_ctx, "INFO: Removed %d hashes found as potfile entries or as empty hashes.", hashes->digests_done_pot);
|
||||
event_log_info (hashcat_ctx, NULL);
|
||||
}
|
||||
event_log_info (hashcat_ctx, "INFO: Removed hash found as empty hash.");
|
||||
event_log_info (hashcat_ctx, NULL);
|
||||
}
|
||||
else if (hashes->digests_done_zero > 1)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "INFO: Removed %d hashes found as empty hashes.", hashes->digests_done_zero);
|
||||
event_log_info (hashcat_ctx, NULL);
|
||||
}
|
||||
|
||||
if (hashes->digests_done_pot == 1)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "INFO: Removed hash found as potfile entry.");
|
||||
event_log_info (hashcat_ctx, NULL);
|
||||
}
|
||||
else if (hashes->digests_done_pot > 1)
|
||||
{
|
||||
event_log_info (hashcat_ctx, "INFO: Removed %d hashes found as potfile entries.", hashes->digests_done_pot);
|
||||
event_log_info (hashcat_ctx, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,7 +447,7 @@ static void main_potfile_all_cracked (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, M
|
||||
|
||||
if (user_options->quiet == true) return;
|
||||
|
||||
event_log_info (hashcat_ctx, "INFO: All hashes found in potfile! Use --show to display them.");
|
||||
event_log_info (hashcat_ctx, "INFO: All hashes found as potfile and/or empty entries! Use --show to display them.");
|
||||
event_log_info (hashcat_ctx, NULL);
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ void potfile_update_hash (hashcat_ctx_t *hashcat_ctx, hash_t *found, char *line_
|
||||
found->pw_buf[found->pw_len] = 0;
|
||||
}
|
||||
|
||||
found->cracked = 1;
|
||||
found->cracked_pot = 1;
|
||||
|
||||
// if enabled, update also the loopback file
|
||||
|
||||
|
31
src/status.c
31
src/status.c
@ -893,13 +893,6 @@ int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx)
|
||||
return hashes->digests_done;
|
||||
}
|
||||
|
||||
int status_get_digests_done_new (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
return hashes->digests_done - hashes->digests_done_pot;
|
||||
}
|
||||
|
||||
int status_get_digests_done_pot (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||
@ -907,6 +900,20 @@ int status_get_digests_done_pot (const hashcat_ctx_t *hashcat_ctx)
|
||||
return hashes->digests_done_pot;
|
||||
}
|
||||
|
||||
int status_get_digests_done_zero (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
return hashes->digests_done_zero;
|
||||
}
|
||||
|
||||
int status_get_digests_done_new (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
return hashes->digests_done_new;
|
||||
}
|
||||
|
||||
int status_get_digests_cnt (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||
@ -923,6 +930,15 @@ double status_get_digests_percent (const hashcat_ctx_t *hashcat_ctx)
|
||||
return ((double) hashes->digests_done / (double) hashes->digests_cnt) * 100;
|
||||
}
|
||||
|
||||
double status_get_digests_percent_new (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||
|
||||
if (hashes->digests_cnt == 0) return 0;
|
||||
|
||||
return ((double) hashes->digests_done_new / (double) hashes->digests_cnt) * 100;
|
||||
}
|
||||
|
||||
int status_get_salts_done (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||
@ -1929,7 +1945,6 @@ char *status_get_brain_rx_all (const hashcat_ctx_t *hashcat_ctx)
|
||||
format_speed_display_1k (brain_rx_all, display, HCBUFSIZ_TINY);
|
||||
|
||||
return display;
|
||||
|
||||
}
|
||||
|
||||
char *status_get_brain_link_send_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
||||
|
115
src/terminal.c
115
src/terminal.c
@ -2335,104 +2335,33 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
||||
"Speed.#*.........: %9sH/s",
|
||||
hashcat_status->speed_sec_all);
|
||||
}
|
||||
if (hashcat_status->digests_done_pot > 0)
|
||||
|
||||
if (hashcat_status->salts_cnt > 1)
|
||||
{
|
||||
if (hashcat_status->salts_cnt > 1)
|
||||
{
|
||||
const int digests_new = hashcat_status->digests_done - hashcat_status->digests_done_pot;
|
||||
const double digests_new_perc = (double) digests_new / (double) hashcat_status->digests_cnt * 100;
|
||||
|
||||
if (digests_new >= 1)
|
||||
{
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.Total..: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent,
|
||||
hashcat_status->salts_done,
|
||||
hashcat_status->salts_cnt,
|
||||
hashcat_status->salts_percent);
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.New....: %u/%u (%.2f%%) Digests",
|
||||
digests_new,
|
||||
hashcat_status->digests_cnt,
|
||||
digests_new_perc);
|
||||
}
|
||||
else
|
||||
{
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.Total..: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent,
|
||||
hashcat_status->salts_done,
|
||||
hashcat_status->salts_cnt,
|
||||
hashcat_status->salts_percent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const int digests_new = hashcat_status->digests_done - hashcat_status->digests_done_pot;
|
||||
const double digests_new_perc = (double) digests_new / (double) hashcat_status->digests_cnt * 100;
|
||||
|
||||
if (digests_new >= 1)
|
||||
{
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.Total..: %u/%u (%.2f%%) Digests",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent);
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.New....: %u/%u (%.2f%%) Digests",
|
||||
digests_new,
|
||||
hashcat_status->digests_cnt,
|
||||
digests_new_perc);
|
||||
}
|
||||
else
|
||||
{
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.Total..: %u/%u (%.2f%%) Digests",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent);
|
||||
}
|
||||
}
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered........: %u/%u (%.2f%%) Digests (total), %u/%u (%.2f%%) Digests (new), %u/%u (%.2f%%) Salts",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent,
|
||||
hashcat_status->digests_done_new,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent_new,
|
||||
hashcat_status->salts_done,
|
||||
hashcat_status->salts_cnt,
|
||||
hashcat_status->salts_percent);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hashcat_status->salts_cnt > 1)
|
||||
{
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.Total..: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent,
|
||||
hashcat_status->salts_done,
|
||||
hashcat_status->salts_cnt,
|
||||
hashcat_status->salts_percent);
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.New....: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent,
|
||||
hashcat_status->salts_done,
|
||||
hashcat_status->salts_cnt,
|
||||
hashcat_status->salts_percent);
|
||||
}
|
||||
else
|
||||
{
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.Total..: %u/%u (%.2f%%) Digests",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent);
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered.New....: %u/%u (%.2f%%) Digests",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent);
|
||||
}
|
||||
event_log_info (hashcat_ctx,
|
||||
"Recovered........: %u/%u (%.2f%%) Digests (total), %u/%u (%.2f%%) Digests (new)",
|
||||
hashcat_status->digests_done,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent,
|
||||
hashcat_status->digests_done_new,
|
||||
hashcat_status->digests_cnt,
|
||||
hashcat_status->digests_percent_new);
|
||||
}
|
||||
|
||||
if (hashcat_status->digests_cnt > 1000)
|
||||
{
|
||||
const int digests_remain = hashcat_status->digests_cnt - hashcat_status->digests_done;
|
||||
|
Loading…
Reference in New Issue
Block a user