mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-12 17:48:14 +00:00
Added progress_mode to status.c
This commit is contained in:
parent
86c1c7ef10
commit
8d81d3bd55
@ -43,8 +43,11 @@ char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
u64 status_get_restore_point (const hashcat_ctx_t *hashcat_ctx);
|
u64 status_get_restore_point (const hashcat_ctx_t *hashcat_ctx);
|
||||||
u64 status_get_restore_total (const hashcat_ctx_t *hashcat_ctx);
|
u64 status_get_restore_total (const hashcat_ctx_t *hashcat_ctx);
|
||||||
double status_get_restore_percent (const hashcat_ctx_t *hashcat_ctx);
|
double status_get_restore_percent (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
int status_get_progress_mode (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
double status_get_progress_finished_percent (const hashcat_ctx_t *hashcat_ctx);
|
||||||
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx);
|
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx);
|
||||||
u64 status_get_progress_rejected (const hashcat_ctx_t *hashcat_ctx);
|
u64 status_get_progress_rejected (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
double status_get_progress_rejected_percent (const hashcat_ctx_t *hashcat_ctx);
|
||||||
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx);
|
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx);
|
||||||
u64 status_get_progress_cur (const hashcat_ctx_t *hashcat_ctx);
|
u64 status_get_progress_cur (const hashcat_ctx_t *hashcat_ctx);
|
||||||
u64 status_get_progress_end (const hashcat_ctx_t *hashcat_ctx);
|
u64 status_get_progress_end (const hashcat_ctx_t *hashcat_ctx);
|
||||||
|
@ -1472,6 +1472,14 @@ typedef enum input_mode
|
|||||||
|
|
||||||
} input_mode_t;
|
} input_mode_t;
|
||||||
|
|
||||||
|
typedef enum progress_mode
|
||||||
|
{
|
||||||
|
PROGRESS_MODE_NONE = 0,
|
||||||
|
PROGRESS_MODE_KEYSPACE_KNOWN = 1,
|
||||||
|
PROGRESS_MODE_KEYSPACE_UNKNOWN = 2,
|
||||||
|
|
||||||
|
} progress_mode_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
bool skipped_dev;
|
bool skipped_dev;
|
||||||
@ -1504,6 +1512,8 @@ typedef struct
|
|||||||
int salts_cnt;
|
int salts_cnt;
|
||||||
int salts_done;
|
int salts_done;
|
||||||
double salts_percent;
|
double salts_percent;
|
||||||
|
int progress_mode;
|
||||||
|
double progress_finished_percent;
|
||||||
u64 progress_cur;
|
u64 progress_cur;
|
||||||
u64 progress_cur_relative_skip;
|
u64 progress_cur_relative_skip;
|
||||||
u64 progress_done;
|
u64 progress_done;
|
||||||
@ -1511,6 +1521,7 @@ typedef struct
|
|||||||
u64 progress_end_relative_skip;
|
u64 progress_end_relative_skip;
|
||||||
u64 progress_ignore;
|
u64 progress_ignore;
|
||||||
u64 progress_rejected;
|
u64 progress_rejected;
|
||||||
|
double progress_rejected_percent;
|
||||||
u64 progress_restored;
|
u64 progress_restored;
|
||||||
u64 progress_skip;
|
u64 progress_skip;
|
||||||
u64 restore_point;
|
u64 restore_point;
|
||||||
|
@ -1145,6 +1145,8 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
|
|||||||
hashcat_status->msec_paused = status_get_msec_paused (hashcat_ctx);
|
hashcat_status->msec_paused = status_get_msec_paused (hashcat_ctx);
|
||||||
hashcat_status->msec_running = status_get_msec_running (hashcat_ctx);
|
hashcat_status->msec_running = status_get_msec_running (hashcat_ctx);
|
||||||
hashcat_status->msec_real = status_get_msec_real (hashcat_ctx);
|
hashcat_status->msec_real = status_get_msec_real (hashcat_ctx);
|
||||||
|
hashcat_status->progress_mode = status_get_progress_mode (hashcat_ctx);
|
||||||
|
hashcat_status->progress_finished_percent = status_get_progress_finished_percent (hashcat_ctx);
|
||||||
hashcat_status->progress_cur_relative_skip = status_get_progress_cur_relative_skip (hashcat_ctx);
|
hashcat_status->progress_cur_relative_skip = status_get_progress_cur_relative_skip (hashcat_ctx);
|
||||||
hashcat_status->progress_cur = status_get_progress_cur (hashcat_ctx);
|
hashcat_status->progress_cur = status_get_progress_cur (hashcat_ctx);
|
||||||
hashcat_status->progress_done = status_get_progress_done (hashcat_ctx);
|
hashcat_status->progress_done = status_get_progress_done (hashcat_ctx);
|
||||||
@ -1152,6 +1154,7 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
|
|||||||
hashcat_status->progress_end = status_get_progress_end (hashcat_ctx);
|
hashcat_status->progress_end = status_get_progress_end (hashcat_ctx);
|
||||||
hashcat_status->progress_ignore = status_get_progress_ignore (hashcat_ctx);
|
hashcat_status->progress_ignore = status_get_progress_ignore (hashcat_ctx);
|
||||||
hashcat_status->progress_rejected = status_get_progress_rejected (hashcat_ctx);
|
hashcat_status->progress_rejected = status_get_progress_rejected (hashcat_ctx);
|
||||||
|
hashcat_status->progress_rejected_percent = status_get_progress_rejected_percent (hashcat_ctx);
|
||||||
hashcat_status->progress_restored = status_get_progress_restored (hashcat_ctx);
|
hashcat_status->progress_restored = status_get_progress_restored (hashcat_ctx);
|
||||||
hashcat_status->progress_skip = status_get_progress_skip (hashcat_ctx);
|
hashcat_status->progress_skip = status_get_progress_skip (hashcat_ctx);
|
||||||
hashcat_status->restore_point = status_get_restore_point (hashcat_ctx);
|
hashcat_status->restore_point = status_get_restore_point (hashcat_ctx);
|
||||||
|
64
src/status.c
64
src/status.c
@ -804,12 +804,43 @@ double status_get_restore_percent (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (restore_total > 0)
|
if (restore_total > 0)
|
||||||
{
|
{
|
||||||
restore_percent = (double) restore_point / (double) restore_total;
|
restore_percent = ((double) restore_point / (double) restore_total) * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
return restore_percent;
|
return restore_percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int status_get_progress_mode (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const u64 progress_end_relative_skip = status_get_progress_end_relative_skip (hashcat_ctx);
|
||||||
|
|
||||||
|
if (progress_end_relative_skip > 0)
|
||||||
|
{
|
||||||
|
return PROGRESS_MODE_KEYSPACE_KNOWN;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PROGRESS_MODE_KEYSPACE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PROGRESS_MODE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
double status_get_progress_finished_percent (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const u64 progress_cur_relative_skip = status_get_progress_cur_relative_skip (hashcat_ctx);
|
||||||
|
const u64 progress_end_relative_skip = status_get_progress_end_relative_skip (hashcat_ctx);
|
||||||
|
|
||||||
|
double progress_finished_percent = 0;
|
||||||
|
|
||||||
|
if (progress_end_relative_skip > 0)
|
||||||
|
{
|
||||||
|
progress_finished_percent = ((double) progress_cur_relative_skip / (double) progress_end_relative_skip) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
return progress_finished_percent;
|
||||||
|
}
|
||||||
|
|
||||||
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx)
|
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
@ -840,6 +871,21 @@ u64 status_get_progress_rejected (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
return progress_rejected;
|
return progress_rejected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double status_get_progress_rejected_percent (const hashcat_ctx_t *hashcat_ctx)
|
||||||
|
{
|
||||||
|
const u64 progress_cur = status_get_progress_cur (hashcat_ctx);
|
||||||
|
const u64 progress_rejected = status_get_progress_rejected (hashcat_ctx);
|
||||||
|
|
||||||
|
double percent_rejected = 0;
|
||||||
|
|
||||||
|
if (progress_cur)
|
||||||
|
{
|
||||||
|
percent_rejected = ((double) (progress_rejected) / (double) progress_cur) * 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
return percent_rejected;
|
||||||
|
}
|
||||||
|
|
||||||
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx)
|
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
const hashes_t *hashes = hashcat_ctx->hashes;
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
||||||
@ -944,10 +990,15 @@ u64 status_get_progress_skip (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
u64 status_get_progress_cur_relative_skip (const hashcat_ctx_t *hashcat_ctx)
|
u64 status_get_progress_cur_relative_skip (const hashcat_ctx_t *hashcat_ctx)
|
||||||
{
|
{
|
||||||
const u64 progress_cur = status_get_progress_cur (hashcat_ctx);
|
|
||||||
const u64 progress_skip = status_get_progress_skip (hashcat_ctx);
|
const u64 progress_skip = status_get_progress_skip (hashcat_ctx);
|
||||||
|
const u64 progress_cur = status_get_progress_cur (hashcat_ctx);
|
||||||
|
|
||||||
const u64 progress_cur_relative_skip = progress_cur - progress_skip;
|
u64 progress_cur_relative_skip = 0;
|
||||||
|
|
||||||
|
if (progress_cur > 0)
|
||||||
|
{
|
||||||
|
progress_cur_relative_skip = progress_cur - progress_skip;
|
||||||
|
}
|
||||||
|
|
||||||
return progress_cur_relative_skip;
|
return progress_cur_relative_skip;
|
||||||
}
|
}
|
||||||
@ -957,7 +1008,12 @@ u64 status_get_progress_end_relative_skip (const hashcat_ctx_t *hashcat_ctx)
|
|||||||
const u64 progress_skip = status_get_progress_skip (hashcat_ctx);
|
const u64 progress_skip = status_get_progress_skip (hashcat_ctx);
|
||||||
const u64 progress_end = status_get_progress_end (hashcat_ctx);
|
const u64 progress_end = status_get_progress_end (hashcat_ctx);
|
||||||
|
|
||||||
const u64 progress_end_relative_skip = progress_end - progress_skip;
|
u64 progress_end_relative_skip = 0;
|
||||||
|
|
||||||
|
if (progress_end > 0)
|
||||||
|
{
|
||||||
|
progress_end_relative_skip = progress_end - progress_skip;
|
||||||
|
}
|
||||||
|
|
||||||
return progress_end_relative_skip;
|
return progress_end_relative_skip;
|
||||||
}
|
}
|
||||||
|
@ -669,9 +669,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
status_get_salts_percent (hashcat_ctx));
|
status_get_salts_percent (hashcat_ctx));
|
||||||
event_log_info (hashcat_ctx, "Recovered/Time.: %s", status_get_cpt (hashcat_ctx));
|
event_log_info (hashcat_ctx, "Recovered/Time.: %s", status_get_cpt (hashcat_ctx));
|
||||||
|
|
||||||
const int input_mode = status_get_input_mode (hashcat_ctx);
|
switch (status_get_input_mode (hashcat_ctx))
|
||||||
|
|
||||||
switch (input_mode)
|
|
||||||
{
|
{
|
||||||
case INPUT_MODE_STRAIGHT_FILE:
|
case INPUT_MODE_STRAIGHT_FILE:
|
||||||
event_log_info (hashcat_ctx, "Input.Base.....: File (%s)", status_get_input_base (hashcat_ctx));
|
event_log_info (hashcat_ctx, "Input.Base.....: File (%s)", status_get_input_base (hashcat_ctx));
|
||||||
@ -730,6 +728,29 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (status_get_progress_mode (hashcat_ctx))
|
||||||
|
{
|
||||||
|
case PROGRESS_MODE_KEYSPACE_KNOWN:
|
||||||
|
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
|
||||||
|
status_get_progress_cur_relative_skip (hashcat_ctx),
|
||||||
|
status_get_progress_end_relative_skip (hashcat_ctx),
|
||||||
|
status_get_progress_finished_percent (hashcat_ctx));
|
||||||
|
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
|
||||||
|
status_get_progress_rejected (hashcat_ctx),
|
||||||
|
status_get_progress_cur_relative_skip (hashcat_ctx),
|
||||||
|
status_get_progress_rejected_percent (hashcat_ctx));
|
||||||
|
event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
|
||||||
|
status_get_restore_point (hashcat_ctx),
|
||||||
|
status_get_restore_total (hashcat_ctx),
|
||||||
|
status_get_restore_percent (hashcat_ctx));
|
||||||
|
break;
|
||||||
|
case PROGRESS_MODE_KEYSPACE_UNKNOWN:
|
||||||
|
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64, status_get_progress_cur_relative_skip (hashcat_ctx));
|
||||||
|
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64, status_get_progress_rejected (hashcat_ctx));
|
||||||
|
event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64, status_get_restore_point (hashcat_ctx));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
const int device_info_cnt = status_get_device_info_cnt (hashcat_ctx);
|
const int device_info_cnt = status_get_device_info_cnt (hashcat_ctx);
|
||||||
const int device_info_active = status_get_device_info_active (hashcat_ctx);
|
const int device_info_active = status_get_device_info_active (hashcat_ctx);
|
||||||
|
|
||||||
@ -744,73 +765,6 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
|
|||||||
|
|
||||||
if (device_info_active > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*...: %9sH/s", status_get_speed_sec_all (hashcat_ctx));
|
if (device_info_active > 1) event_log_info (hashcat_ctx, "Speed.Dev.#*...: %9sH/s", status_get_speed_sec_all (hashcat_ctx));
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* counters
|
|
||||||
*/
|
|
||||||
|
|
||||||
const u64 progress_cur = status_get_progress_cur (hashcat_ctx);
|
|
||||||
const u64 progress_rejected = status_get_progress_rejected (hashcat_ctx);
|
|
||||||
const u64 progress_cur_relative_skip = status_get_progress_cur_relative_skip (hashcat_ctx);
|
|
||||||
const u64 progress_end_relative_skip = status_get_progress_end_relative_skip (hashcat_ctx);
|
|
||||||
|
|
||||||
// Restore point
|
|
||||||
|
|
||||||
const u64 restore_point = status_get_restore_point (hashcat_ctx);
|
|
||||||
const u64 restore_total = status_get_restore_total (hashcat_ctx);
|
|
||||||
const double restore_percent = status_get_restore_percent (hashcat_ctx);
|
|
||||||
|
|
||||||
|
|
||||||
if (progress_end_relative_skip)
|
|
||||||
{
|
|
||||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
||||||
{
|
|
||||||
double percent_finished = (double) progress_cur_relative_skip / (double) progress_end_relative_skip;
|
|
||||||
double percent_rejected = 0.0;
|
|
||||||
|
|
||||||
if (progress_cur)
|
|
||||||
{
|
|
||||||
percent_rejected = (double) (progress_rejected) / (double) progress_cur;
|
|
||||||
}
|
|
||||||
|
|
||||||
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", progress_cur_relative_skip, progress_end_relative_skip, percent_finished * 100);
|
|
||||||
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", progress_rejected, progress_cur_relative_skip, percent_rejected * 100);
|
|
||||||
|
|
||||||
if (user_options->restore_disable == false)
|
|
||||||
{
|
|
||||||
if (percent_finished != 1)
|
|
||||||
{
|
|
||||||
event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)", restore_point, restore_total, restore_percent * 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
||||||
{
|
|
||||||
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
|
|
||||||
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
|
|
||||||
|
|
||||||
if (user_options->restore_disable == false)
|
|
||||||
{
|
|
||||||
event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)", 0ull, 0ull, 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
event_log_info (hashcat_ctx, "Progress.......: %" PRIu64 "", progress_cur_relative_skip);
|
|
||||||
event_log_info (hashcat_ctx, "Rejected.......: %" PRIu64 "", progress_rejected);
|
|
||||||
|
|
||||||
// --restore not allowed if stdin is used -- really? why?
|
|
||||||
|
|
||||||
//if (user_options->restore_disable == false)
|
|
||||||
//{
|
|
||||||
// event_log_info (hashcat_ctx, "Restore.Point..: %" PRIu64 "", restore_point);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status_ctx->run_main_level1 == false) return;
|
if (status_ctx->run_main_level1 == false) return;
|
||||||
|
|
||||||
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
|
||||||
|
Loading…
Reference in New Issue
Block a user