1
mirror of https://github.com/hashcat/hashcat synced 2024-11-06 11:40:38 +01:00

Add back input queue in status view

Implements https://github.com/hashcat/hashcat/issues/577
This commit is contained in:
jsteube 2016-11-10 22:30:17 +01:00
parent e3bc15eece
commit 4d9cb462a9
5 changed files with 284 additions and 49 deletions

View File

@ -24,7 +24,13 @@ char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx)
int status_get_status_number (const hashcat_ctx_t *hashcat_ctx);
int status_get_input_mode (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_base (const hashcat_ctx_t *hashcat_ctx);
int status_get_input_base_offset (const hashcat_ctx_t *hashcat_ctx);
int status_get_input_base_count (const hashcat_ctx_t *hashcat_ctx);
double status_get_input_base_percent (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_mod (const hashcat_ctx_t *hashcat_ctx);
int status_get_input_mod_offset (const hashcat_ctx_t *hashcat_ctx);
int status_get_input_mod_count (const hashcat_ctx_t *hashcat_ctx);
double status_get_input_mod_percent (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_charset (const hashcat_ctx_t *hashcat_ctx);
int status_get_input_mask_length (const hashcat_ctx_t *hashcat_ctx);
char *status_get_input_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);

View File

@ -1576,8 +1576,14 @@ typedef struct
char *hash_type;
int input_mode;
char *input_base;
char *input_charset;
int input_base_offset;
int input_base_count;
double input_base_percent;
char *input_mod;
int input_mod_offset;
int input_mod_count;
double input_mod_percent;
char *input_charset;
int input_mask_length;
char *session;
char *status_string;

View File

@ -1188,10 +1188,16 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st
hashcat_status->hash_target = status_get_hash_target (hashcat_ctx);
hashcat_status->hash_type = status_get_hash_type (hashcat_ctx);
hashcat_status->input_base = status_get_input_base (hashcat_ctx);
hashcat_status->input_base_offset = status_get_input_base_offset (hashcat_ctx);
hashcat_status->input_base_count = status_get_input_base_count (hashcat_ctx);
hashcat_status->input_base_percent = status_get_input_base_percent (hashcat_ctx);
hashcat_status->input_mod = status_get_input_mod (hashcat_ctx);
hashcat_status->input_mod_offset = status_get_input_mod_offset (hashcat_ctx);
hashcat_status->input_mod_count = status_get_input_mod_count (hashcat_ctx);
hashcat_status->input_mod_percent = status_get_input_mod_percent (hashcat_ctx);
hashcat_status->input_charset = status_get_input_charset (hashcat_ctx);
hashcat_status->input_mask_length = status_get_input_mask_length (hashcat_ctx);
hashcat_status->input_mode = status_get_input_mode (hashcat_ctx);
hashcat_status->input_mod = status_get_input_mod (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_real = status_get_msec_real (hashcat_ctx);

View File

@ -458,6 +458,86 @@ char *status_get_input_base (const hashcat_ctx_t *hashcat_ctx)
return NULL;
}
int status_get_input_base_offset (const hashcat_ctx_t *hashcat_ctx)
{
const user_options_t *user_options = hashcat_ctx->user_options;
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
return straight_ctx->dicts_pos + 1;
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
return 1;
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
{
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
return mask_ctx->masks_pos + 1;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
return straight_ctx->dicts_pos + 1;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
{
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
return straight_ctx->dicts_pos + 1;
}
return 0;
}
int status_get_input_base_count (const hashcat_ctx_t *hashcat_ctx)
{
const user_options_t *user_options = hashcat_ctx->user_options;
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
return straight_ctx->dicts_cnt;
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
return 1;
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
{
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
return mask_ctx->masks_cnt;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
return straight_ctx->dicts_cnt;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
{
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
return straight_ctx->dicts_cnt;
}
return 0;
}
double status_get_input_base_percent (const hashcat_ctx_t *hashcat_ctx)
{
const int input_base_offset = status_get_input_base_offset (hashcat_ctx);
const int input_base_count = status_get_input_base_count (hashcat_ctx);
return ((double) input_base_offset / (double) input_base_count) * 100;
}
char *status_get_input_mod (const hashcat_ctx_t *hashcat_ctx)
{
const user_options_t *user_options = hashcat_ctx->user_options;
@ -499,6 +579,78 @@ char *status_get_input_mod (const hashcat_ctx_t *hashcat_ctx)
return NULL;
}
int status_get_input_mod_offset (const hashcat_ctx_t *hashcat_ctx)
{
const user_options_t *user_options = hashcat_ctx->user_options;
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
return 1;
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
return 1;
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
{
return 1;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
return mask_ctx->masks_pos + 1;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
{
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
return mask_ctx->masks_pos + 1;
}
return 0;
}
int status_get_input_mod_count (const hashcat_ctx_t *hashcat_ctx)
{
const user_options_t *user_options = hashcat_ctx->user_options;
if (user_options->attack_mode == ATTACK_MODE_STRAIGHT)
{
return 1;
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
return 1;
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
{
return 1;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
return mask_ctx->masks_cnt + 1;
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
{
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
return mask_ctx->masks_cnt + 1;
}
return 0;
}
double status_get_input_mod_percent (const hashcat_ctx_t *hashcat_ctx)
{
const int input_mod_offset = status_get_input_mod_offset (hashcat_ctx);
const int input_mod_count = status_get_input_mod_count (hashcat_ctx);
return ((double) input_mod_offset / (double) input_mod_count) * 100;
}
char *status_get_input_charset (const hashcat_ctx_t *hashcat_ctx)
{
const user_options_t *user_options = hashcat_ctx->user_options;

View File

@ -687,28 +687,28 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
*/
event_log_info (hashcat_ctx,
"Session........: %s",
"Session..........: %s",
hashcat_status->session);
event_log_info (hashcat_ctx,
"Status.........: %s",
"Status...........: %s",
hashcat_status->status_string);
event_log_info (hashcat_ctx,
"Hash.Type......: %s",
"Hash.Type........: %s",
hashcat_status->hash_type);
event_log_info (hashcat_ctx,
"Hash.Target....: %s",
"Hash.Target......: %s",
hashcat_status->hash_target);
event_log_info (hashcat_ctx,
"Time.Started...: %s (%s)",
"Time.Started.....: %s (%s)",
hashcat_status->time_started_absolute,
hashcat_status->time_started_relative);
event_log_info (hashcat_ctx,
"Time.Estimated.: %s (%s)",
"Time.Estimated...: %s (%s)",
hashcat_status->time_estimated_absolute,
hashcat_status->time_estimated_relative);
@ -717,7 +717,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_FILE:
event_log_info (hashcat_ctx,
"Input.Base.....: File (%s)",
"Input.Base.......: File (%s)",
hashcat_status->input_base);
break;
@ -725,11 +725,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_FILE_RULES_FILE:
event_log_info (hashcat_ctx,
"Input.Base.....: File (%s)",
"Input.Base.......: File (%s)",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod......: Rules (%s)",
"Input.Mod........: Rules (%s)",
hashcat_status->input_mod);
break;
@ -737,28 +737,28 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_FILE_RULES_GEN:
event_log_info (hashcat_ctx,
"Input.Base.....: File (%s)",
"Input.Base.......: File (%s)",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod......: Rules (Generated)");
"Input.Mod........: Rules (Generated)");
break;
case INPUT_MODE_STRAIGHT_STDIN:
event_log_info (hashcat_ctx,
"Input.Base.....: Pipe");
"Input.Base.......: Pipe");
break;
case INPUT_MODE_STRAIGHT_STDIN_RULES_FILE:
event_log_info (hashcat_ctx,
"Input.Base.....: Pipe");
"Input.Base.......: Pipe");
event_log_info (hashcat_ctx,
"Input.Mod......: Rules (%s)",
"Input.Mod........: Rules (%s)",
hashcat_status->input_mod);
break;
@ -766,21 +766,21 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_STRAIGHT_STDIN_RULES_GEN:
event_log_info (hashcat_ctx,
"Input.Base.....: Pipe");
"Input.Base.......: Pipe");
event_log_info (hashcat_ctx,
"Input.Mod......: Rules (Generated)");
"Input.Mod........: Rules (Generated)");
break;
case INPUT_MODE_COMBINATOR_BASE_LEFT:
event_log_info (hashcat_ctx,
"Input.Base.....: File (%s), Left Side",
"Input.Base.......: File (%s), Left Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod......: File (%s), Right Side",
"Input.Mod........: File (%s), Right Side",
hashcat_status->input_mod);
break;
@ -788,11 +788,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_COMBINATOR_BASE_RIGHT:
event_log_info (hashcat_ctx,
"Input.Base.....: File (%s), Right Side",
"Input.Base.......: File (%s), Right Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod......: File (%s), Left Side",
"Input.Mod........: File (%s), Left Side",
hashcat_status->input_mod);
break;
@ -800,7 +800,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_MASK:
event_log_info (hashcat_ctx,
"Input.Mask.....: %s [%d]",
"Input.Mask.......: %s [%d]",
hashcat_status->input_base,
hashcat_status->input_mask_length);
@ -809,12 +809,12 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_MASK_CS:
event_log_info (hashcat_ctx,
"Input.Mask.....: %s [%d]",
"Input.Mask.......: %s [%d]",
hashcat_status->input_base,
hashcat_status->input_mask_length);
event_log_info (hashcat_ctx,
"Input.Charset..: %s ",
"Input.Charset....: %s ",
hashcat_status->input_charset);
break;
@ -822,11 +822,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_HYBRID1:
event_log_info (hashcat_ctx,
"Input.Base.....: File (%s), Left Side",
"Input.Base.......: File (%s), Left Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod......: Mask (%s) [%d], Right Side",
"Input.Mod........: Mask (%s) [%d], Right Side",
hashcat_status->input_mod,
hashcat_status->input_mask_length);
@ -835,16 +835,16 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_HYBRID1_CS:
event_log_info (hashcat_ctx,
"Input.Base.....: File (%s), Left Side",
"Input.Base.......: File (%s), Left Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod......: Mask (%s) [%d], Right Side",
"Input.Mod........: Mask (%s) [%d], Right Side",
hashcat_status->input_mod,
hashcat_status->input_mask_length);
event_log_info (hashcat_ctx,
"Input.Charset..: %s",
"Input.Charset....: %s",
hashcat_status->input_charset);
break;
@ -852,11 +852,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_HYBRID2:
event_log_info (hashcat_ctx,
"Input.Base.....: File (%s), Right Side",
"Input.Base.......: File (%s), Right Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod......: Mask (%s) [%d], Left Side",
"Input.Mod........: Mask (%s) [%d], Left Side",
hashcat_status->input_mod,
hashcat_status->input_mask_length);
@ -865,21 +865,86 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case INPUT_MODE_HYBRID2_CS:
event_log_info (hashcat_ctx,
"Input.Base.....: File (%s), Right Side",
"Input.Base.......: File (%s), Right Side",
hashcat_status->input_base);
event_log_info (hashcat_ctx,
"Input.Mod......: Mask (%s) [%d], Left Side",
"Input.Mod........: Mask (%s) [%d], Left Side",
hashcat_status->input_mod,
hashcat_status->input_mask_length);
event_log_info (hashcat_ctx,
"Input.Charset..: %s",
"Input.Charset....: %s",
hashcat_status->input_charset);
break;
}
switch (hashcat_status->input_mode)
{
case INPUT_MODE_STRAIGHT_FILE:
event_log_info (hashcat_ctx,
"Input.Queue......: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
break;
case INPUT_MODE_STRAIGHT_STDIN:
event_log_info (hashcat_ctx,
"Input.Queue......: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
break;
case INPUT_MODE_MASK:
event_log_info (hashcat_ctx,
"Input.Queue......: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
break;
case INPUT_MODE_HYBRID1:
event_log_info (hashcat_ctx,
"Input.Queue.Base.: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
event_log_info (hashcat_ctx,
"Input.Queue.Mod..: %d/%d (%.02f%%)",
hashcat_status->input_mod_offset,
hashcat_status->input_mod_count,
hashcat_status->input_mod_percent);
break;
case INPUT_MODE_HYBRID2:
event_log_info (hashcat_ctx,
"Input.Queue.Base.: %d/%d (%.02f%%)",
hashcat_status->input_base_offset,
hashcat_status->input_base_count,
hashcat_status->input_base_percent);
event_log_info (hashcat_ctx,
"Input.Queue.Mod..: %d/%d (%.02f%%)",
hashcat_status->input_mod_offset,
hashcat_status->input_mod_count,
hashcat_status->input_mod_percent);
break;
}
for (int device_id = 0; device_id < hashcat_status->device_info_cnt; device_id++)
{
const device_info_t *device_info = hashcat_status->device_info_buf + device_id;
@ -887,7 +952,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id + 1,
"Speed.Dev.#%d.....: %9sH/s (%0.2fms)", device_id + 1,
device_info->speed_sec_dev,
device_info->exec_msec_dev);
}
@ -895,12 +960,12 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->device_info_active > 1)
{
event_log_info (hashcat_ctx,
"Speed.Dev.#*...: %9sH/s",
"Speed.Dev.#*.....: %9sH/s",
hashcat_status->speed_sec_all);
}
event_log_info (hashcat_ctx,
"Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts",
"Recovered........: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts",
hashcat_status->digests_done,
hashcat_status->digests_cnt,
hashcat_status->digests_percent,
@ -909,7 +974,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
hashcat_status->salts_percent);
event_log_info (hashcat_ctx,
"Recovered/Time.: %s",
"Recovered/Time...: %s",
hashcat_status->cpt);
switch (hashcat_status->progress_mode)
@ -917,19 +982,19 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case PROGRESS_MODE_KEYSPACE_KNOWN:
event_log_info (hashcat_ctx,
"Progress.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
"Progress.........: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
hashcat_status->progress_cur_relative_skip,
hashcat_status->progress_end_relative_skip,
hashcat_status->progress_finished_percent);
event_log_info (hashcat_ctx,
"Rejected.......: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
"Rejected.........: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
hashcat_status->progress_rejected,
hashcat_status->progress_cur_relative_skip,
hashcat_status->progress_rejected_percent);
event_log_info (hashcat_ctx,
"Restore.Point..: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
"Restore.Point....: %" PRIu64 "/%" PRIu64 " (%.02f%%)",
hashcat_status->restore_point,
hashcat_status->restore_total,
hashcat_status->restore_percent);
@ -939,15 +1004,15 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
case PROGRESS_MODE_KEYSPACE_UNKNOWN:
event_log_info (hashcat_ctx,
"Progress.......: %" PRIu64,
"Progress.........: %" PRIu64,
hashcat_status->progress_cur_relative_skip);
event_log_info (hashcat_ctx,
"Rejected.......: %" PRIu64,
"Rejected.........: %" PRIu64,
hashcat_status->progress_rejected);
event_log_info (hashcat_ctx,
"Restore.Point..: %" PRIu64,
"Restore.Point....: %" PRIu64,
hashcat_status->restore_point);
break;
@ -962,7 +1027,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (device_info->input_candidates_dev == NULL) continue;
event_log_info (hashcat_ctx,
"Candidates.#%d..: %s", device_id + 1,
"Candidates.#%d....: %s", device_id + 1,
device_info->input_candidates_dev);
}
@ -977,7 +1042,7 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
if (device_info->hwmon_dev == NULL) continue;
event_log_info (hashcat_ctx,
"HWMon.Dev.#%d...: %s", device_id + 1,
"HWMon.Dev.#%d.....: %s", device_id + 1,
device_info->hwmon_dev);
}
}
@ -1043,7 +1108,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id + 1,
"Speed.Dev.#%d.....: %9sH/s (%0.2fms)", device_id + 1,
device_info->speed_sec_dev,
device_info->exec_msec_dev);
}
@ -1051,7 +1116,7 @@ void status_benchmark (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->device_info_active > 1)
{
event_log_info (hashcat_ctx,
"Speed.Dev.#*...: %9sH/s",
"Speed.Dev.#*.....: %9sH/s",
hashcat_status->speed_sec_all);
}