2016-09-08 07:21:25 +00:00
|
|
|
/**
|
2016-09-11 20:20:15 +00:00
|
|
|
* Author......: See docs/credits.txt
|
2016-09-08 07:21:25 +00:00
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "types.h"
|
|
|
|
#include "memory.h"
|
2016-10-04 16:30:00 +00:00
|
|
|
#include "convert.h"
|
2016-09-20 11:18:47 +00:00
|
|
|
#include "thread.h"
|
2016-09-29 22:38:29 +00:00
|
|
|
#include "timer.h"
|
2019-03-31 15:39:00 +00:00
|
|
|
#include "hashes.h"
|
2016-09-15 14:02:52 +00:00
|
|
|
#include "hwmon.h"
|
2016-10-04 16:30:00 +00:00
|
|
|
#include "outfile.h"
|
2016-10-17 11:44:07 +00:00
|
|
|
#include "monitor.h"
|
2016-10-29 20:44:01 +00:00
|
|
|
#include "mpsp.h"
|
2017-03-24 09:45:40 +00:00
|
|
|
#include "terminal.h"
|
2017-08-16 15:51:35 +00:00
|
|
|
#include "shared.h"
|
2019-03-31 15:39:00 +00:00
|
|
|
#include "status.h"
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2021-07-18 19:48:54 +00:00
|
|
|
static const char *const ST_0000 = "Initializing";
|
|
|
|
static const char *const ST_0001 = "Autotuning";
|
|
|
|
static const char *const ST_0002 = "Selftest";
|
|
|
|
static const char *const ST_0003 = "Running";
|
|
|
|
static const char *const ST_0004 = "Paused";
|
|
|
|
static const char *const ST_0005 = "Exhausted";
|
|
|
|
static const char *const ST_0006 = "Cracked";
|
|
|
|
static const char *const ST_0007 = "Aborted";
|
|
|
|
static const char *const ST_0008 = "Quit";
|
|
|
|
static const char *const ST_0009 = "Bypass";
|
|
|
|
static const char *const ST_0010 = "Aborted (Checkpoint)";
|
|
|
|
static const char *const ST_0011 = "Aborted (Runtime)";
|
|
|
|
static const char *const ST_0012 = "Running (Checkpoint Quit requested)";
|
|
|
|
static const char *const ST_0013 = "Error";
|
|
|
|
static const char *const ST_0014 = "Aborted (Finish)";
|
|
|
|
static const char *const ST_0015 = "Running (Quit after attack requested)";
|
|
|
|
static const char *const ST_0016 = "Autodetect";
|
|
|
|
static const char *const ST_9999 = "Unknown! Bug!";
|
2016-09-24 19:44:43 +00:00
|
|
|
|
2016-11-16 16:06:39 +00:00
|
|
|
static const char UNITS[7] = { ' ', 'k', 'M', 'G', 'T', 'P', 'E' };
|
|
|
|
|
2021-07-18 19:48:54 +00:00
|
|
|
static const char *const ETA_ABSOLUTE_MAX_EXCEEDED = "Next Big Bang"; // in honor of ighashgpu
|
|
|
|
static const char *const ETA_RELATIVE_MAX_EXCEEDED = "> 10 years";
|
2017-08-16 15:51:35 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
static char *status_get_rules_file (const hashcat_ctx_t *hashcat_ctx)
|
2016-09-08 08:01:49 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
2016-09-08 08:01:49 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
if (user_options->rp_files_cnt > 0)
|
2016-09-08 08:01:49 +00:00
|
|
|
{
|
2018-01-31 15:36:04 +00:00
|
|
|
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_TINY);
|
2016-09-08 08:01:49 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
int tmp_len = 0;
|
2016-09-08 08:01:49 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
u32 i;
|
2016-09-08 08:01:49 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
for (i = 0; i < user_options->rp_files_cnt - 1; i++)
|
|
|
|
{
|
2018-12-07 09:37:56 +00:00
|
|
|
tmp_len += snprintf (tmp_buf + tmp_len, HCBUFSIZ_TINY - tmp_len, "%s, ", user_options->rp_files[i]);
|
2016-10-16 17:32:43 +00:00
|
|
|
}
|
2016-09-08 08:01:49 +00:00
|
|
|
|
2018-12-07 09:37:56 +00:00
|
|
|
tmp_len += snprintf (tmp_buf + tmp_len, HCBUFSIZ_TINY - tmp_len, "%s", user_options->rp_files[i]);
|
2016-09-08 08:01:49 +00:00
|
|
|
|
2016-11-12 14:46:42 +00:00
|
|
|
tmp_buf[tmp_len] = 0;
|
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
return tmp_buf; // yes, user need to free()
|
2016-09-08 08:01:49 +00:00
|
|
|
}
|
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
return NULL;
|
2016-09-24 19:44:43 +00:00
|
|
|
}
|
2016-10-04 14:35:24 +00:00
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
void format_timer_display (struct tm *tm, char *buf, size_t len)
|
|
|
|
{
|
2017-11-24 19:05:54 +00:00
|
|
|
const char *const time_entities_s[] = { "year", "day", "hour", "min", "sec" };
|
|
|
|
const char *const time_entities_m[] = { "years", "days", "hours", "mins", "secs" };
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
if (tm->tm_year - 70)
|
|
|
|
{
|
2017-11-14 04:46:26 +00:00
|
|
|
const char *time_entity1 = ((tm->tm_year - 70) == 1) ? time_entities_s[0] : time_entities_m[0];
|
|
|
|
const char *time_entity2 = ( tm->tm_yday == 1) ? time_entities_s[1] : time_entities_m[1];
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2022-03-22 15:17:26 +00:00
|
|
|
snprintf (buf, len, "%u %s, %u %s", tm->tm_year - 70, time_entity1, tm->tm_yday, time_entity2);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
else if (tm->tm_yday)
|
|
|
|
{
|
2017-11-14 04:46:26 +00:00
|
|
|
const char *time_entity1 = (tm->tm_yday == 1) ? time_entities_s[1] : time_entities_m[1];
|
|
|
|
const char *time_entity2 = (tm->tm_hour == 1) ? time_entities_s[2] : time_entities_m[2];
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2022-03-22 15:17:26 +00:00
|
|
|
snprintf (buf, len, "%u %s, %u %s", tm->tm_yday, time_entity1, tm->tm_hour, time_entity2);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
else if (tm->tm_hour)
|
|
|
|
{
|
2017-11-14 04:46:26 +00:00
|
|
|
const char *time_entity1 = (tm->tm_hour == 1) ? time_entities_s[2] : time_entities_m[2];
|
|
|
|
const char *time_entity2 = (tm->tm_min == 1) ? time_entities_s[3] : time_entities_m[3];
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2022-03-22 15:17:26 +00:00
|
|
|
snprintf (buf, len, "%u %s, %u %s", tm->tm_hour, time_entity1, tm->tm_min, time_entity2);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
else if (tm->tm_min)
|
|
|
|
{
|
2017-11-14 04:46:26 +00:00
|
|
|
const char *time_entity1 = (tm->tm_min == 1) ? time_entities_s[3] : time_entities_m[3];
|
|
|
|
const char *time_entity2 = (tm->tm_sec == 1) ? time_entities_s[4] : time_entities_m[4];
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2022-03-22 15:17:26 +00:00
|
|
|
snprintf (buf, len, "%u %s, %u %s", tm->tm_min, time_entity1, tm->tm_sec, time_entity2);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-11-14 04:46:26 +00:00
|
|
|
const char *time_entity1 = (tm->tm_sec == 1) ? time_entities_s[4] : time_entities_m[4];
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2022-03-22 15:17:26 +00:00
|
|
|
snprintf (buf, len, "%u %s", tm->tm_sec, time_entity1);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void format_speed_display (double val, char *buf, size_t len)
|
|
|
|
{
|
|
|
|
if (val <= 0)
|
|
|
|
{
|
|
|
|
buf[0] = '0';
|
|
|
|
buf[1] = ' ';
|
|
|
|
buf[2] = 0;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 level = 0;
|
|
|
|
|
|
|
|
while (val > 99999)
|
|
|
|
{
|
|
|
|
val /= 1000;
|
|
|
|
|
|
|
|
level++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* generate output */
|
|
|
|
|
|
|
|
if (level == 0)
|
|
|
|
{
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (buf, len, "%.0f ", val);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (buf, len, "%.1f %c", val, UNITS[level]);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-01 10:31:17 +00:00
|
|
|
void format_speed_display_1k (double val, char *buf, size_t len)
|
|
|
|
{
|
|
|
|
if (val <= 0)
|
|
|
|
{
|
|
|
|
buf[0] = '0';
|
|
|
|
buf[1] = ' ';
|
|
|
|
buf[2] = 0;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 level = 0;
|
|
|
|
|
|
|
|
while (val > 999)
|
|
|
|
{
|
|
|
|
val /= 1000;
|
|
|
|
|
|
|
|
level++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* generate output */
|
|
|
|
|
|
|
|
if (level == 0)
|
|
|
|
{
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (buf, len, "%.0f ", val);
|
2018-09-01 10:31:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (buf, len, "%.1f %c", val, UNITS[level]);
|
2018-09-01 10:31:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-14 14:07:24 +00:00
|
|
|
double get_avg_exec_time (hc_device_param_t *device_param, const int last_num_entries)
|
|
|
|
{
|
|
|
|
int exec_pos = (int) device_param->exec_pos - last_num_entries;
|
|
|
|
|
|
|
|
if (exec_pos < 0) exec_pos += EXEC_CACHE;
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
double exec_msec_sum = 0;
|
2016-09-14 14:07:24 +00:00
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
int exec_msec_cnt = 0;
|
2016-09-14 14:07:24 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < last_num_entries; i++)
|
|
|
|
{
|
2016-10-17 11:44:07 +00:00
|
|
|
double exec_msec = device_param->exec_msec[(exec_pos + i) % EXEC_CACHE];
|
2016-09-14 14:07:24 +00:00
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
if (exec_msec > 0)
|
2016-09-14 14:07:24 +00:00
|
|
|
{
|
2016-10-17 11:44:07 +00:00
|
|
|
exec_msec_sum += exec_msec;
|
2016-09-14 14:07:24 +00:00
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
exec_msec_cnt++;
|
2016-09-14 14:07:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
if (exec_msec_cnt == 0) return 0;
|
2016-09-14 14:07:24 +00:00
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
return exec_msec_sum / exec_msec_cnt;
|
2016-09-14 14:07:24 +00:00
|
|
|
}
|
|
|
|
|
2016-10-17 13:19:25 +00:00
|
|
|
int status_get_device_info_cnt (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
return backend_ctx->backend_devices_cnt;
|
2016-10-17 13:19:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int status_get_device_info_active (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
return backend_ctx->backend_devices_active;
|
2016-10-17 13:19:25 +00:00
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
bool status_get_skipped_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-10-17 13:19:25 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-10-17 13:19:25 +00:00
|
|
|
|
|
|
|
return device_param->skipped;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
bool status_get_skipped_warning_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2019-03-04 09:29:57 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2019-03-04 09:29:57 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2019-03-04 09:29:57 +00:00
|
|
|
|
|
|
|
return device_param->skipped_warning;
|
|
|
|
}
|
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
char *status_get_session (const hashcat_ctx_t *hashcat_ctx)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-03-19 19:41:50 +00:00
|
|
|
return strdup (user_options->session);
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
int status_get_brain_session (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
return user_options->brain_session;
|
|
|
|
}
|
|
|
|
|
|
|
|
int status_get_brain_attack (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
|
|
|
return user_options->brain_attack;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
const char *status_get_status_string (const hashcat_ctx_t *hashcat_ctx)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
const int devices_status = status_ctx->devices_status;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-03-07 22:06:50 +00:00
|
|
|
// special case: running but checkpoint quit requested
|
|
|
|
|
|
|
|
if (devices_status == STATUS_RUNNING)
|
|
|
|
{
|
|
|
|
if (status_ctx->checkpoint_shutdown == true)
|
|
|
|
{
|
2017-11-14 04:46:26 +00:00
|
|
|
return ST_0012;
|
2017-03-07 22:06:50 +00:00
|
|
|
}
|
2021-05-05 20:53:04 +00:00
|
|
|
|
|
|
|
if (status_ctx->finish_shutdown == true)
|
|
|
|
{
|
|
|
|
return ST_0015;
|
|
|
|
}
|
2017-03-07 22:06:50 +00:00
|
|
|
}
|
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
switch (devices_status)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-11-14 04:46:26 +00:00
|
|
|
case STATUS_INIT: return ST_0000;
|
|
|
|
case STATUS_AUTOTUNE: return ST_0001;
|
|
|
|
case STATUS_SELFTEST: return ST_0002;
|
|
|
|
case STATUS_RUNNING: return ST_0003;
|
|
|
|
case STATUS_PAUSED: return ST_0004;
|
|
|
|
case STATUS_EXHAUSTED: return ST_0005;
|
|
|
|
case STATUS_CRACKED: return ST_0006;
|
|
|
|
case STATUS_ABORTED: return ST_0007;
|
|
|
|
case STATUS_QUIT: return ST_0008;
|
|
|
|
case STATUS_BYPASS: return ST_0009;
|
|
|
|
case STATUS_ABORTED_CHECKPOINT: return ST_0010;
|
|
|
|
case STATUS_ABORTED_RUNTIME: return ST_0011;
|
2018-07-10 11:17:07 +00:00
|
|
|
case STATUS_ERROR: return ST_0013;
|
2021-05-05 20:53:04 +00:00
|
|
|
case STATUS_ABORTED_FINISH: return ST_0014;
|
2021-06-05 20:11:18 +00:00
|
|
|
case STATUS_AUTODETECT: return ST_0016;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
|
|
|
|
2017-11-14 04:46:26 +00:00
|
|
|
return ST_9999;
|
2016-10-16 17:32:43 +00:00
|
|
|
}
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-17 22:13:40 +00:00
|
|
|
int status_get_status_number (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
return status_ctx->devices_status;
|
|
|
|
}
|
|
|
|
|
2019-01-21 09:00:44 +00:00
|
|
|
char *status_get_hash_name (const hashcat_ctx_t *hashcat_ctx)
|
2016-10-16 17:32:43 +00:00
|
|
|
{
|
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2019-01-21 09:00:44 +00:00
|
|
|
return hcstrdup (hashconfig->hash_name);
|
2016-10-16 17:32:43 +00:00
|
|
|
}
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2019-01-21 09:00:44 +00:00
|
|
|
char *status_get_hash_target (const hashcat_ctx_t *hashcat_ctx)
|
2016-10-16 17:32:43 +00:00
|
|
|
{
|
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
2019-01-05 18:18:30 +00:00
|
|
|
const module_ctx_t *module_ctx = hashcat_ctx->module_ctx;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2019-08-07 14:20:26 +00:00
|
|
|
if ((hashes->digests_cnt == 1) || (hashes->hashfile == NULL))
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2019-01-19 19:09:32 +00:00
|
|
|
if (module_ctx->module_hash_encode_status != MODULE_DEFAULT)
|
|
|
|
{
|
|
|
|
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
2016-10-19 11:51:06 +00:00
|
|
|
|
2019-01-25 10:14:04 +00:00
|
|
|
const int tmp_len = module_ctx->module_hash_encode_status (hashconfig, hashes->digests_buf, hashes->salts_buf, hashes->esalts_buf, hashes->hook_salts_buf, NULL, tmp_buf, HCBUFSIZ_LARGE);
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2019-01-19 19:09:32 +00:00
|
|
|
char *tmp_buf2 = (char *) hcmalloc (tmp_len + 1);
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2019-01-19 19:09:32 +00:00
|
|
|
memcpy (tmp_buf2, tmp_buf, tmp_len);
|
2017-03-24 09:45:40 +00:00
|
|
|
|
2019-01-19 19:09:32 +00:00
|
|
|
tmp_buf2[tmp_len] = 0;
|
2016-10-19 11:51:06 +00:00
|
|
|
|
2020-05-14 17:21:59 +00:00
|
|
|
hcfree (tmp_buf);
|
2016-10-19 11:51:06 +00:00
|
|
|
|
2019-01-19 19:09:32 +00:00
|
|
|
return tmp_buf2;
|
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
|
|
|
|
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2021-04-04 09:38:02 +00:00
|
|
|
if (hashconfig->opts_type & OPTS_TYPE_BINARY_HASHFILE_OPTIONAL)
|
|
|
|
{
|
|
|
|
if (hashes->hashfile)
|
|
|
|
{
|
|
|
|
return hcstrdup (hashes->hashfile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return hcstrdup (hashes->hashfile);
|
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
}
|
2019-01-05 18:18:30 +00:00
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
char *tmp_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
|
2016-10-16 17:32:43 +00:00
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
const int tmp_len = hash_encode (hashcat_ctx->hashconfig, hashcat_ctx->hashes, hashcat_ctx->module_ctx, tmp_buf, HCBUFSIZ_LARGE, 0, 0);
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
tmp_buf[tmp_len] = 0;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
compress_terminal_line_length (tmp_buf, 19, 6); // 19 = strlen ("Hash.Target......: ")
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
char *tmp_buf2 = strdup (tmp_buf);
|
2019-01-05 18:18:30 +00:00
|
|
|
|
2020-05-14 17:21:59 +00:00
|
|
|
hcfree (tmp_buf);
|
2019-08-04 02:09:07 +00:00
|
|
|
|
|
|
|
return tmp_buf2;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
|
|
|
|
return hcstrdup (hashes->hashfile);
|
2016-10-16 17:32:43 +00:00
|
|
|
}
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
int status_get_guess_mode (const hashcat_ctx_t *hashcat_ctx)
|
2016-10-16 17:32:43 +00:00
|
|
|
{
|
|
|
|
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
bool has_wordlist = false;
|
|
|
|
bool has_rule_file = false;
|
|
|
|
bool has_rule_gen = false;
|
|
|
|
bool has_base_left = false;
|
|
|
|
bool has_mask_cs = false;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
if (user_options_extra->wordlist_mode == WL_MODE_FILE) has_wordlist = true;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
if (user_options->rp_files_cnt > 0) has_rule_file = true;
|
|
|
|
if (user_options->rp_gen > 0) has_rule_gen = true;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_LEFT) has_base_left = true;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
if (user_options->custom_charset_1) has_mask_cs = true;
|
|
|
|
if (user_options->custom_charset_2) has_mask_cs = true;
|
|
|
|
if (user_options->custom_charset_3) has_mask_cs = true;
|
|
|
|
if (user_options->custom_charset_4) has_mask_cs = true;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
if (has_wordlist == true)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
if (has_rule_file == true)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-03-24 22:39:09 +00:00
|
|
|
return GUESS_MODE_STRAIGHT_FILE_RULES_FILE;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
if (has_rule_gen == true)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-03-24 22:39:09 +00:00
|
|
|
return GUESS_MODE_STRAIGHT_FILE_RULES_GEN;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
return GUESS_MODE_STRAIGHT_FILE;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
if (has_rule_file == true)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2019-08-04 02:09:07 +00:00
|
|
|
return GUESS_MODE_STRAIGHT_STDIN_RULES_FILE;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
if (has_rule_gen == true)
|
|
|
|
{
|
|
|
|
return GUESS_MODE_STRAIGHT_STDIN_RULES_GEN;
|
|
|
|
}
|
|
|
|
return GUESS_MODE_STRAIGHT_STDIN;
|
2016-10-16 17:32:43 +00:00
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
2016-10-16 17:32:43 +00:00
|
|
|
{
|
|
|
|
if (has_base_left == true)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-03-24 22:39:09 +00:00
|
|
|
return GUESS_MODE_COMBINATOR_BASE_LEFT;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
return GUESS_MODE_COMBINATOR_BASE_RIGHT;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
if (has_mask_cs == true)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-03-24 22:39:09 +00:00
|
|
|
return GUESS_MODE_MASK_CS;
|
2016-10-16 17:32:43 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
return GUESS_MODE_MASK;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
if (has_mask_cs == true)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-03-24 22:39:09 +00:00
|
|
|
return GUESS_MODE_HYBRID1_CS;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
return GUESS_MODE_HYBRID1;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
2016-10-11 13:02:54 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
if (has_mask_cs == true)
|
2016-10-11 13:02:54 +00:00
|
|
|
{
|
2017-03-24 22:39:09 +00:00
|
|
|
return GUESS_MODE_HYBRID2_CS;
|
2016-10-11 13:02:54 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
return GUESS_MODE_HYBRID2;
|
2016-10-11 13:02:54 +00:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
return GUESS_MODE_NONE;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
char *status_get_guess_base (const hashcat_ctx_t *hashcat_ctx)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2017-03-23 15:41:12 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
2016-10-04 14:35:24 +00:00
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
2016-09-19 13:52:01 +00:00
|
|
|
{
|
2017-03-23 15:41:12 +00:00
|
|
|
if (user_options_extra->wordlist_mode == WL_MODE_FILE)
|
|
|
|
{
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
2016-09-18 20:16:03 +00:00
|
|
|
|
2017-03-23 15:41:12 +00:00
|
|
|
return strdup (straight_ctx->dict);
|
|
|
|
}
|
2016-09-19 13:52:01 +00:00
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
2016-10-04 16:30:00 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
2016-10-04 16:30:00 +00:00
|
|
|
|
2016-10-29 21:18:15 +00:00
|
|
|
if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_LEFT)
|
2016-10-16 17:32:43 +00:00
|
|
|
{
|
2017-03-19 19:41:50 +00:00
|
|
|
return strdup (combinator_ctx->dict1);
|
2016-10-16 17:32:43 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
return strdup (combinator_ctx->dict2);
|
2016-10-04 16:30:00 +00:00
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-03-19 19:41:50 +00:00
|
|
|
return strdup (mask_ctx->mask);
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-03-19 19:41:50 +00:00
|
|
|
return strdup (straight_ctx->dict);
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
|
2017-06-30 14:51:57 +00:00
|
|
|
{
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-06-30 14:51:57 +00:00
|
|
|
return strdup (mask_ctx->mask);
|
|
|
|
}
|
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
2016-10-16 17:32:43 +00:00
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
return strdup (straight_ctx->dict);
|
|
|
|
}
|
2016-10-16 17:32:43 +00:00
|
|
|
return NULL;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
int status_get_guess_base_offset (const hashcat_ctx_t *hashcat_ctx)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2016-11-10 21:30:17 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
|
|
|
|
return straight_ctx->dicts_pos + 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
|
|
|
|
return mask_ctx->masks_pos + 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
|
|
|
|
return straight_ctx->dicts_pos + 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
|
2017-06-30 14:51:57 +00:00
|
|
|
{
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
2016-11-10 21:30:17 +00:00
|
|
|
|
2017-06-30 14:51:57 +00:00
|
|
|
return mask_ctx->masks_pos + 1;
|
|
|
|
}
|
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
|
|
|
|
return straight_ctx->dicts_pos + 1;
|
2016-11-10 21:30:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
int status_get_guess_base_count (const hashcat_ctx_t *hashcat_ctx)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2016-11-10 21:30:17 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
|
|
|
|
return straight_ctx->dicts_cnt;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
|
|
|
|
return mask_ctx->masks_cnt;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
|
|
|
|
return straight_ctx->dicts_cnt;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
|
2017-06-30 14:51:57 +00:00
|
|
|
{
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
2016-11-10 21:30:17 +00:00
|
|
|
|
2017-06-30 14:51:57 +00:00
|
|
|
return mask_ctx->masks_cnt;
|
|
|
|
}
|
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
|
|
|
|
return straight_ctx->dicts_cnt;
|
2016-11-10 21:30:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
double status_get_guess_base_percent (const hashcat_ctx_t *hashcat_ctx)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-03-24 22:39:09 +00:00
|
|
|
const int guess_base_offset = status_get_guess_base_offset (hashcat_ctx);
|
|
|
|
const int guess_base_count = status_get_guess_base_count (hashcat_ctx);
|
2016-11-10 21:30:17 +00:00
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
if (guess_base_count == 0) return 0;
|
2017-02-14 20:21:24 +00:00
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
return ((double) guess_base_offset / (double) guess_base_count) * 100;
|
2016-11-10 21:30:17 +00:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
char *status_get_guess_mod (const hashcat_ctx_t *hashcat_ctx)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2016-10-16 17:32:43 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
2016-10-04 14:35:24 +00:00
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
2016-09-19 13:52:01 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
return status_get_rules_file (hashcat_ctx);
|
2016-09-19 13:52:01 +00:00
|
|
|
}
|
2017-11-05 06:39:03 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
2016-10-04 16:30:00 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
2016-10-04 16:30:00 +00:00
|
|
|
|
2016-10-29 21:18:15 +00:00
|
|
|
if (combinator_ctx->combs_mode == COMBINATOR_MODE_BASE_LEFT)
|
2016-10-16 17:32:43 +00:00
|
|
|
{
|
2017-03-19 19:41:50 +00:00
|
|
|
return strdup (combinator_ctx->dict2);
|
2016-10-16 17:32:43 +00:00
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
return strdup (combinator_ctx->dict1);
|
2016-10-04 16:30:00 +00:00
|
|
|
}
|
2017-11-05 06:39:03 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2017-11-05 06:39:03 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2016-10-16 17:32:43 +00:00
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-03-19 19:41:50 +00:00
|
|
|
return strdup (mask_ctx->mask);
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2017-11-05 06:39:03 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
|
2017-06-30 14:51:57 +00:00
|
|
|
{
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-06-30 14:51:57 +00:00
|
|
|
return strdup (straight_ctx->dict);
|
|
|
|
}
|
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
|
|
|
|
return strdup (mask_ctx->mask);
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
int status_get_guess_mod_offset (const hashcat_ctx_t *hashcat_ctx)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2016-11-10 21:30:17 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
|
|
|
|
return mask_ctx->masks_pos + 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
|
2017-06-30 14:51:57 +00:00
|
|
|
{
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
2016-11-10 21:30:17 +00:00
|
|
|
|
2017-06-30 14:51:57 +00:00
|
|
|
return straight_ctx->dicts_pos + 1;
|
|
|
|
}
|
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
|
|
|
|
return mask_ctx->masks_pos + 1;
|
2016-11-10 21:30:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
int status_get_guess_mod_count (const hashcat_ctx_t *hashcat_ctx)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2016-11-10 21:30:17 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
if ((user_options->attack_mode == ATTACK_MODE_STRAIGHT) || (user_options->attack_mode == ATTACK_MODE_ASSOCIATION))
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_COMBI)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_BF)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
|
2016-11-11 21:30:03 +00:00
|
|
|
return mask_ctx->masks_cnt;
|
2016-11-10 21:30:17 +00:00
|
|
|
}
|
2017-11-11 04:54:48 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-07-18 12:45:15 +00:00
|
|
|
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
|
2017-06-30 14:51:57 +00:00
|
|
|
{
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
2016-11-10 21:30:17 +00:00
|
|
|
|
2017-06-30 14:51:57 +00:00
|
|
|
return straight_ctx->dicts_cnt;
|
|
|
|
}
|
|
|
|
|
2019-08-04 02:09:07 +00:00
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
|
|
|
|
return mask_ctx->masks_cnt;
|
2016-11-10 21:30:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
double status_get_guess_mod_percent (const hashcat_ctx_t *hashcat_ctx)
|
2016-11-10 21:30:17 +00:00
|
|
|
{
|
2017-03-24 22:39:09 +00:00
|
|
|
const int guess_mod_offset = status_get_guess_mod_offset (hashcat_ctx);
|
|
|
|
const int guess_mod_count = status_get_guess_mod_count (hashcat_ctx);
|
2016-11-10 21:30:17 +00:00
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
if (guess_mod_count == 0) return 0;
|
2017-02-14 20:21:24 +00:00
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
return ((double) guess_mod_offset / (double) guess_mod_count) * 100;
|
2016-11-10 21:30:17 +00:00
|
|
|
}
|
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
char *status_get_guess_charset (const hashcat_ctx_t *hashcat_ctx)
|
2016-10-16 17:32:43 +00:00
|
|
|
{
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
const char *custom_charset_1 = user_options->custom_charset_1;
|
|
|
|
const char *custom_charset_2 = user_options->custom_charset_2;
|
|
|
|
const char *custom_charset_3 = user_options->custom_charset_3;
|
|
|
|
const char *custom_charset_4 = user_options->custom_charset_4;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
if ((custom_charset_1 != NULL) || (custom_charset_2 != NULL) || (custom_charset_3 != NULL) || (custom_charset_4 != NULL))
|
2016-09-08 07:21:25 +00:00
|
|
|
{
|
2017-10-03 05:10:10 +00:00
|
|
|
char *tmp_buf;
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
if (custom_charset_1 == NULL) custom_charset_1 = "Undefined";
|
|
|
|
if (custom_charset_2 == NULL) custom_charset_2 = "Undefined";
|
|
|
|
if (custom_charset_3 == NULL) custom_charset_3 = "Undefined";
|
|
|
|
if (custom_charset_4 == NULL) custom_charset_4 = "Undefined";
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2017-10-03 05:10:10 +00:00
|
|
|
hc_asprintf (&tmp_buf, "-1 %s, -2 %s, -3 %s, -4 %s", custom_charset_1, custom_charset_2, custom_charset_3, custom_charset_4);
|
2016-09-08 07:21:25 +00:00
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
return tmp_buf;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
|
|
|
|
2016-10-16 17:32:43 +00:00
|
|
|
return NULL;
|
2016-09-08 07:21:25 +00:00
|
|
|
}
|
2016-09-29 20:27:04 +00:00
|
|
|
|
2017-03-24 22:39:09 +00:00
|
|
|
int status_get_guess_mask_length (const hashcat_ctx_t *hashcat_ctx)
|
2016-10-29 20:44:01 +00:00
|
|
|
{
|
2019-10-09 17:18:18 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
2016-10-29 20:44:01 +00:00
|
|
|
|
|
|
|
if (mask_ctx == NULL) return -1;
|
|
|
|
|
|
|
|
if (mask_ctx->mask == NULL) return -1;
|
|
|
|
|
2019-10-09 17:18:18 +00:00
|
|
|
return mp_get_length (mask_ctx->mask, hashconfig->opts_type);
|
2016-10-29 20:44:01 +00:00
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-10-17 14:46:16 +00:00
|
|
|
{
|
2016-11-05 13:46:00 +00:00
|
|
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-23 15:31:22 +00:00
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
2016-10-17 14:46:16 +00:00
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
2016-10-29 13:12:45 +00:00
|
|
|
if (status_ctx->accessible == false) return NULL;
|
2016-10-23 15:31:22 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-10-17 14:46:16 +00:00
|
|
|
|
2018-01-31 15:36:04 +00:00
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
2016-10-17 14:46:16 +00:00
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == true) || (device_param->skipped_warning == true))
|
|
|
|
{
|
|
|
|
snprintf (display, HCBUFSIZ_TINY, "[Skipped]");
|
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2016-10-17 14:46:16 +00:00
|
|
|
if (user_options_extra->attack_kern == ATTACK_KERN_BF)
|
|
|
|
{
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (display, HCBUFSIZ_TINY, "[Generating]");
|
2016-10-17 14:46:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (display, HCBUFSIZ_TINY, "[Copying]");
|
2016-10-17 14:46:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((device_param->outerloop_left == 0) || (device_param->innerloop_left == 0)) return display;
|
|
|
|
|
2018-02-08 18:13:29 +00:00
|
|
|
const u64 outerloop_first = 0;
|
|
|
|
const u64 outerloop_last = device_param->outerloop_left - 1;
|
2016-10-17 14:46:16 +00:00
|
|
|
|
|
|
|
const u32 innerloop_first = 0;
|
|
|
|
const u32 innerloop_last = device_param->innerloop_left - 1;
|
|
|
|
|
2019-03-15 20:48:49 +00:00
|
|
|
plain_t plain1 = { outerloop_first, innerloop_first, 0, 0, 0, 0, 0 };
|
|
|
|
plain_t plain2 = { outerloop_last, innerloop_last, 0, 0, 0, 0, 0 };
|
2016-10-17 14:46:16 +00:00
|
|
|
|
2017-06-17 15:57:30 +00:00
|
|
|
u32 plain_buf1[(64 * 2) + 2] = { 0 };
|
|
|
|
u32 plain_buf2[(64 * 2) + 2] = { 0 };
|
2016-10-17 14:46:16 +00:00
|
|
|
|
|
|
|
u8 *plain_ptr1 = (u8 *) plain_buf1;
|
|
|
|
u8 *plain_ptr2 = (u8 *) plain_buf2;
|
|
|
|
|
|
|
|
int plain_len1 = 0;
|
|
|
|
int plain_len2 = 0;
|
|
|
|
|
|
|
|
build_plain ((hashcat_ctx_t *) hashcat_ctx, device_param, &plain1, plain_buf1, &plain_len1);
|
|
|
|
build_plain ((hashcat_ctx_t *) hashcat_ctx, device_param, &plain2, plain_buf2, &plain_len2);
|
|
|
|
|
2019-02-12 14:30:42 +00:00
|
|
|
const bool always_ascii = (hashconfig->opts_type & OPTS_TYPE_PT_ALWAYS_ASCII) ? true : false;
|
2016-11-05 12:27:08 +00:00
|
|
|
|
2016-12-09 13:54:13 +00:00
|
|
|
const bool need_hex1 = need_hexify (plain_ptr1, plain_len1, 0, always_ascii);
|
|
|
|
const bool need_hex2 = need_hexify (plain_ptr2, plain_len2, 0, always_ascii);
|
2016-10-17 14:46:16 +00:00
|
|
|
|
2023-01-07 02:07:34 +00:00
|
|
|
if((need_hex1 == true) || (need_hex2 == true))
|
|
|
|
{
|
|
|
|
// Right candidate needs to be $HEX-ed
|
|
|
|
if(need_hex1 == false)
|
|
|
|
{
|
|
|
|
exec_hexify (plain_ptr2, plain_len2, plain_ptr2);
|
|
|
|
|
|
|
|
plain_ptr1[plain_len1] = 0;
|
|
|
|
plain_ptr2[plain_len2 * 2] = 0;
|
|
|
|
|
|
|
|
snprintf (display, HCBUFSIZ_TINY, "%s -> $HEX[%s]", plain_ptr1, plain_ptr2);
|
|
|
|
}
|
|
|
|
// Left candidate needs to be $HEX-ed
|
|
|
|
else if(need_hex2 == false)
|
|
|
|
{
|
2016-10-17 14:46:16 +00:00
|
|
|
exec_hexify (plain_ptr1, plain_len1, plain_ptr1);
|
2023-01-07 02:07:34 +00:00
|
|
|
|
2016-10-17 14:46:16 +00:00
|
|
|
plain_ptr1[plain_len1 * 2] = 0;
|
2023-01-07 02:07:34 +00:00
|
|
|
plain_ptr2[plain_len2] = 0;
|
2016-10-29 20:19:00 +00:00
|
|
|
|
2023-01-07 02:07:34 +00:00
|
|
|
snprintf (display, HCBUFSIZ_TINY, "$HEX[%s] -> %s", plain_ptr1, plain_ptr2);
|
|
|
|
}
|
|
|
|
// Both candidates need to be $HEX-ed
|
|
|
|
else {
|
|
|
|
exec_hexify (plain_ptr1, plain_len1, plain_ptr1);
|
|
|
|
exec_hexify (plain_ptr2, plain_len2, plain_ptr2);
|
2023-01-07 00:15:48 +00:00
|
|
|
|
2023-01-07 02:07:34 +00:00
|
|
|
plain_ptr1[plain_len1 * 2] = 0;
|
|
|
|
plain_ptr2[plain_len2 * 2] = 0;
|
|
|
|
|
|
|
|
snprintf (display, HCBUFSIZ_TINY, "$HEX[%s] -> $HEX[%s]", plain_ptr1, plain_ptr2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Neither candidate needs to be $HEX-ed
|
|
|
|
else
|
|
|
|
{
|
|
|
|
plain_ptr1[plain_len1] = 0;
|
|
|
|
plain_ptr2[plain_len2] = 0;
|
2016-10-17 14:46:16 +00:00
|
|
|
|
2023-01-07 02:07:34 +00:00
|
|
|
snprintf (display, HCBUFSIZ_TINY, "%s -> %s", plain_ptr1, plain_ptr2);
|
|
|
|
}
|
2016-10-17 14:46:16 +00:00
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
int status_get_digests_done (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
|
|
|
return hashes->digests_done;
|
|
|
|
}
|
|
|
|
|
2022-08-19 10:02:21 +00:00
|
|
|
int status_get_digests_done_pot (const hashcat_ctx_t *hashcat_ctx)
|
2022-08-18 09:21:34 +00:00
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
2022-08-19 10:02:21 +00:00
|
|
|
return hashes->digests_done_pot;
|
2022-08-18 09:21:34 +00:00
|
|
|
}
|
|
|
|
|
2022-08-19 10:02:21 +00:00
|
|
|
int status_get_digests_done_zero (const hashcat_ctx_t *hashcat_ctx)
|
2022-02-14 22:54:36 +00:00
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
2022-08-19 10:02:21 +00:00
|
|
|
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;
|
2022-02-14 22:54:36 +00:00
|
|
|
}
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
int status_get_digests_cnt (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
|
|
|
return hashes->digests_cnt;
|
|
|
|
}
|
|
|
|
|
|
|
|
double status_get_digests_percent (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
2017-02-14 20:21:24 +00:00
|
|
|
if (hashes->digests_cnt == 0) return 0;
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
return ((double) hashes->digests_done / (double) hashes->digests_cnt) * 100;
|
|
|
|
}
|
|
|
|
|
2022-08-19 10:02:21 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
int status_get_salts_done (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
|
|
|
return hashes->salts_done;
|
|
|
|
}
|
|
|
|
|
|
|
|
int status_get_salts_cnt (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
|
|
|
return hashes->salts_cnt;
|
|
|
|
}
|
|
|
|
|
|
|
|
double status_get_salts_percent (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
2017-02-14 20:21:24 +00:00
|
|
|
if (hashes->salts_cnt == 0) return 0;
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
return ((double) hashes->salts_done / (double) hashes->salts_cnt) * 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
double status_get_msec_running (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
double msec_running = hc_timer_get (status_ctx->timer_running);
|
|
|
|
|
|
|
|
return msec_running;
|
|
|
|
}
|
|
|
|
|
|
|
|
double status_get_msec_paused (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
double msec_paused = status_ctx->msec_paused;
|
|
|
|
|
|
|
|
if (status_ctx->devices_status == STATUS_PAUSED)
|
|
|
|
{
|
|
|
|
double msec_paused_tmp = hc_timer_get (status_ctx->timer_paused);
|
|
|
|
|
|
|
|
msec_paused += msec_paused_tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
return msec_paused;
|
|
|
|
}
|
|
|
|
|
2016-10-17 13:19:25 +00:00
|
|
|
double status_get_msec_real (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const double msec_running = status_get_msec_running (hashcat_ctx);
|
|
|
|
const double msec_paused = status_get_msec_paused (hashcat_ctx);
|
|
|
|
|
|
|
|
const double msec_real = msec_running - msec_paused;
|
|
|
|
|
|
|
|
return msec_real;
|
|
|
|
}
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
char *status_get_time_started_absolute (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t time_start = status_ctx->runtime_start;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2016-12-03 13:59:35 +00:00
|
|
|
char buf[32] = { 0 };
|
2016-12-03 05:32:18 +00:00
|
|
|
|
2017-12-11 21:44:58 +00:00
|
|
|
char *start = ctime_r (&time_start, buf);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
const size_t start_len = strlen (start);
|
|
|
|
|
|
|
|
if (start[start_len - 1] == '\n') start[start_len - 1] = 0;
|
|
|
|
if (start[start_len - 2] == '\r') start[start_len - 2] = 0;
|
|
|
|
|
2016-10-26 23:12:06 +00:00
|
|
|
return strdup (start);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char *status_get_time_started_relative (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
time_t time_now;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
time (&time_now);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t time_start = status_ctx->runtime_start;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
time_t sec_run = time_now - time_start;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
struct tm *tmp;
|
2017-08-16 17:43:41 +00:00
|
|
|
struct tm tm;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
tmp = gmtime_r (&sec_run, &tm);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2018-01-31 15:36:04 +00:00
|
|
|
char *display_run = (char *) hcmalloc (HCBUFSIZ_TINY);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
format_timer_display (tmp, display_run, HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
return display_run;
|
|
|
|
}
|
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
time_t status_get_sec_etc (const hashcat_ctx_t *hashcat_ctx)
|
2016-10-17 11:44:07 +00:00
|
|
|
{
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
time_t sec_etc = 0;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
if ((user_options_extra->wordlist_mode == WL_MODE_FILE) || (user_options_extra->wordlist_mode == WL_MODE_MASK))
|
|
|
|
{
|
|
|
|
if (status_ctx->devices_status != STATUS_CRACKED)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
|
|
|
const u64 progress_ignore = status_get_progress_ignore (hashcat_ctx);
|
|
|
|
|
|
|
|
const double hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx);
|
|
|
|
|
|
|
|
if (hashes_msec_all > 0)
|
|
|
|
{
|
|
|
|
const u64 progress_left_relative_skip = progress_end_relative_skip - progress_cur_relative_skip;
|
|
|
|
|
|
|
|
u64 msec_left = (u64) ((progress_left_relative_skip - progress_ignore) / hashes_msec_all);
|
|
|
|
|
|
|
|
sec_etc = msec_left / 1000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-16 15:51:35 +00:00
|
|
|
return sec_etc;
|
|
|
|
}
|
2016-10-20 22:28:14 +00:00
|
|
|
|
2017-08-16 15:51:35 +00:00
|
|
|
char *status_get_time_estimated_absolute (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2017-12-10 00:40:45 +00:00
|
|
|
time_t sec_etc = status_get_sec_etc (hashcat_ctx);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
time_t now;
|
|
|
|
time (&now);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2016-12-03 13:59:35 +00:00
|
|
|
char buf[32] = { 0 };
|
2016-12-03 05:32:18 +00:00
|
|
|
|
2017-08-16 15:51:35 +00:00
|
|
|
char *etc;
|
|
|
|
|
|
|
|
if (overflow_check_u64_add (now, sec_etc) == false)
|
|
|
|
{
|
|
|
|
etc = (char *) ETA_ABSOLUTE_MAX_EXCEEDED;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-12-10 00:40:45 +00:00
|
|
|
time_t end = now + sec_etc;
|
2017-08-16 15:51:35 +00:00
|
|
|
|
2017-12-11 21:44:58 +00:00
|
|
|
etc = ctime_r (&end, buf);
|
2017-08-16 15:51:35 +00:00
|
|
|
|
|
|
|
if (etc == NULL) etc = (char *) ETA_ABSOLUTE_MAX_EXCEEDED;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
const size_t etc_len = strlen (etc);
|
|
|
|
|
|
|
|
if (etc[etc_len - 1] == '\n') etc[etc_len - 1] = 0;
|
|
|
|
if (etc[etc_len - 2] == '\r') etc[etc_len - 2] = 0;
|
|
|
|
|
2016-10-26 23:12:06 +00:00
|
|
|
return strdup (etc);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char *status_get_time_estimated_relative (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2017-08-16 15:51:35 +00:00
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2018-01-31 15:36:04 +00:00
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
time_t sec_etc = status_get_sec_etc (hashcat_ctx);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2017-08-16 17:43:41 +00:00
|
|
|
struct tm *tmp;
|
|
|
|
struct tm tm;
|
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
tmp = gmtime_r (&sec_etc, &tm);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2017-08-16 15:51:35 +00:00
|
|
|
if (tmp == NULL)
|
|
|
|
{
|
|
|
|
snprintf (display, HCBUFSIZ_TINY, "%s", ETA_RELATIVE_MAX_EXCEEDED);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
2017-08-16 15:51:35 +00:00
|
|
|
else
|
2016-10-20 22:28:14 +00:00
|
|
|
{
|
2017-08-16 15:51:35 +00:00
|
|
|
format_timer_display (tmp, display, HCBUFSIZ_TINY);
|
2016-10-20 22:28:14 +00:00
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
if (user_options->runtime > 0)
|
|
|
|
{
|
|
|
|
const int runtime_left = get_runtime_left (hashcat_ctx);
|
|
|
|
|
2016-10-30 19:37:02 +00:00
|
|
|
char *tmp_display = strdup (display);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
if (runtime_left > 0)
|
|
|
|
{
|
2017-12-10 00:40:45 +00:00
|
|
|
time_t sec_left = runtime_left;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
struct tm *tmp_left;
|
2017-08-16 17:43:41 +00:00
|
|
|
struct tm tm_left;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
tmp_left = gmtime_r (&sec_left, &tm_left);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2018-01-31 15:36:04 +00:00
|
|
|
char *display_left = (char *) hcmalloc (HCBUFSIZ_TINY);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
format_timer_display (tmp_left, display_left, HCBUFSIZ_TINY);
|
|
|
|
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (display, HCBUFSIZ_TINY, "%s; Runtime limited: %s", tmp_display, display_left);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2020-05-14 17:21:59 +00:00
|
|
|
hcfree (display_left);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (display, HCBUFSIZ_TINY, "%s; Runtime limit exceeded", tmp_display);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
|
2020-05-14 17:21:59 +00:00
|
|
|
hcfree (tmp_display);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2016-10-17 12:25:16 +00:00
|
|
|
u64 status_get_restore_point (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2016-10-20 19:27:42 +00:00
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
const u64 restore_point = status_ctx->words_cur;
|
2016-10-17 12:25:16 +00:00
|
|
|
|
|
|
|
return restore_point;
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 status_get_restore_total (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
const u64 restore_total = status_ctx->words_base;
|
|
|
|
|
|
|
|
return restore_total;
|
|
|
|
}
|
|
|
|
|
|
|
|
double status_get_restore_percent (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
double restore_percent = 0;
|
|
|
|
|
|
|
|
const u64 restore_point = status_get_restore_point (hashcat_ctx);
|
|
|
|
const u64 restore_total = status_get_restore_total (hashcat_ctx);
|
|
|
|
|
|
|
|
if (restore_total > 0)
|
|
|
|
{
|
2016-10-17 14:22:32 +00:00
|
|
|
restore_percent = ((double) restore_point / (double) restore_total) * 100;
|
2016-10-17 12:25:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return restore_percent;
|
|
|
|
}
|
|
|
|
|
2016-10-17 14:22:32 +00:00
|
|
|
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;
|
|
|
|
}
|
2019-08-04 02:09:07 +00:00
|
|
|
return PROGRESS_MODE_KEYSPACE_UNKNOWN;
|
2016-10-17 14:22:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
u64 status_get_progress_done (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
u64 progress_done = 0;
|
|
|
|
|
|
|
|
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
|
|
|
{
|
|
|
|
progress_done += status_ctx->words_progress_done[salt_pos];
|
|
|
|
}
|
|
|
|
|
|
|
|
return progress_done;
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 status_get_progress_rejected (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
u64 progress_rejected = 0;
|
|
|
|
|
|
|
|
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
|
|
|
{
|
|
|
|
progress_rejected += status_ctx->words_progress_rejected[salt_pos];
|
|
|
|
}
|
|
|
|
|
|
|
|
return progress_rejected;
|
|
|
|
}
|
|
|
|
|
2016-10-17 14:22:32 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
u64 status_get_progress_restored (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
u64 progress_restored = 0;
|
|
|
|
|
|
|
|
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
|
|
|
{
|
|
|
|
progress_restored += status_ctx->words_progress_restored[salt_pos];
|
|
|
|
}
|
|
|
|
|
|
|
|
return progress_restored;
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 status_get_progress_cur (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const u64 progress_done = status_get_progress_done (hashcat_ctx);
|
|
|
|
const u64 progress_rejected = status_get_progress_rejected (hashcat_ctx);
|
|
|
|
const u64 progress_restored = status_get_progress_restored (hashcat_ctx);
|
|
|
|
|
|
|
|
const u64 progress_cur = progress_done + progress_rejected + progress_restored;
|
|
|
|
|
|
|
|
return progress_cur;
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 status_get_progress_ignore (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2021-07-14 08:26:57 +00:00
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
2020-09-29 13:56:32 +00:00
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
// we have no salt based skips in this attack mode
|
|
|
|
// ?? words_progress_restored[]
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2021-07-14 08:26:57 +00:00
|
|
|
u64 words_cnt = status_ctx->words_cnt;
|
|
|
|
|
|
|
|
if (user_options->limit)
|
|
|
|
{
|
|
|
|
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
|
|
|
|
words_cnt = MIN (user_options->limit, status_ctx->words_base);
|
|
|
|
|
|
|
|
if (user_options->slow_candidates == true)
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) words_cnt *= straight_ctx->kernel_rules_cnt;
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) words_cnt *= combinator_ctx->combs_cnt;
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) words_cnt *= mask_ctx->bfs_cnt;
|
|
|
|
}
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
// Important for ETA only
|
|
|
|
|
|
|
|
u64 progress_ignore = 0;
|
|
|
|
|
|
|
|
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
|
|
|
|
{
|
|
|
|
if (hashes->salts_shown[salt_pos] == 1)
|
|
|
|
{
|
|
|
|
const u64 all = status_ctx->words_progress_done[salt_pos]
|
|
|
|
+ status_ctx->words_progress_rejected[salt_pos]
|
|
|
|
+ status_ctx->words_progress_restored[salt_pos];
|
|
|
|
|
2021-07-14 08:26:57 +00:00
|
|
|
const u64 left = words_cnt - all;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
progress_ignore += left;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return progress_ignore;
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 status_get_progress_end (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
u64 progress_end = status_ctx->words_cnt;
|
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
progress_end *= hashes->salts_cnt;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
if (user_options->limit)
|
|
|
|
{
|
|
|
|
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
progress_end = MIN (user_options->limit, status_ctx->words_base);
|
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
progress_end *= hashes->salts_cnt;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2018-11-07 13:20:40 +00:00
|
|
|
if (user_options->slow_candidates == true)
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_end *= straight_ctx->kernel_rules_cnt;
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_end *= combinator_ctx->combs_cnt;
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_end *= mask_ctx->bfs_cnt;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return progress_end;
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 status_get_progress_skip (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
|
|
|
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
|
|
|
|
|
|
|
|
u64 progress_skip = 0;
|
|
|
|
|
|
|
|
if (user_options->skip)
|
|
|
|
{
|
|
|
|
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
|
|
|
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
|
|
|
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
|
|
|
|
2020-09-29 13:56:32 +00:00
|
|
|
progress_skip = MIN (user_options->skip, status_ctx->words_base);
|
|
|
|
|
|
|
|
if (user_options->attack_mode == ATTACK_MODE_ASSOCIATION)
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
progress_skip *= hashes->salts_cnt;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2018-11-07 13:20:40 +00:00
|
|
|
if (user_options->slow_candidates == true)
|
|
|
|
{
|
|
|
|
// nothing to do
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) progress_skip *= straight_ctx->kernel_rules_cnt;
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) progress_skip *= combinator_ctx->combs_cnt;
|
|
|
|
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) progress_skip *= mask_ctx->bfs_cnt;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return progress_skip;
|
|
|
|
}
|
|
|
|
|
|
|
|
u64 status_get_progress_cur_relative_skip (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const u64 progress_skip = status_get_progress_skip (hashcat_ctx);
|
2016-10-17 14:22:32 +00:00
|
|
|
const u64 progress_cur = status_get_progress_cur (hashcat_ctx);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2016-10-17 14:22:32 +00:00
|
|
|
u64 progress_cur_relative_skip = 0;
|
|
|
|
|
|
|
|
if (progress_cur > 0)
|
|
|
|
{
|
|
|
|
progress_cur_relative_skip = progress_cur - progress_skip;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
return progress_cur_relative_skip;
|
|
|
|
}
|
|
|
|
|
|
|
|
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_end = status_get_progress_end (hashcat_ctx);
|
|
|
|
|
2016-10-17 14:22:32 +00:00
|
|
|
u64 progress_end_relative_skip = 0;
|
|
|
|
|
|
|
|
if (progress_end > 0)
|
|
|
|
{
|
|
|
|
progress_end_relative_skip = progress_end - progress_skip;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
return progress_end_relative_skip;
|
|
|
|
}
|
2016-10-16 17:32:43 +00:00
|
|
|
|
2016-10-17 11:44:07 +00:00
|
|
|
double status_get_hashes_msec_all (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
double hashes_all_msec = 0;
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
for (int backend_devices_idx = 0; backend_devices_idx < backend_ctx->backend_devices_cnt; backend_devices_idx++)
|
2016-10-17 11:44:07 +00:00
|
|
|
{
|
2019-04-30 11:38:44 +00:00
|
|
|
hashes_all_msec += status_get_hashes_msec_dev (hashcat_ctx, backend_devices_idx);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return hashes_all_msec;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
double status_get_hashes_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-10-17 11:44:07 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
u64 speed_cnt = 0;
|
|
|
|
double speed_msec = 0;
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2016-10-17 11:44:07 +00:00
|
|
|
{
|
2018-02-11 20:29:57 +00:00
|
|
|
const u32 speed_pos = MAX (device_param->speed_pos, 1);
|
2018-02-11 09:56:08 +00:00
|
|
|
|
2018-02-11 13:25:55 +00:00
|
|
|
for (u32 i = 0; i < speed_pos; i++)
|
2016-10-17 11:44:07 +00:00
|
|
|
{
|
|
|
|
speed_cnt += device_param->speed_cnt[i];
|
|
|
|
speed_msec += device_param->speed_msec[i];
|
|
|
|
}
|
|
|
|
|
2018-02-11 09:56:08 +00:00
|
|
|
speed_cnt /= speed_pos;
|
|
|
|
speed_msec /= speed_pos;
|
|
|
|
}
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
double hashes_dev_msec = 0;
|
2016-10-17 15:20:19 +00:00
|
|
|
|
|
|
|
if (speed_msec > 0)
|
|
|
|
{
|
|
|
|
hashes_dev_msec = (double) speed_cnt / speed_msec;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hashes_dev_msec;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
double status_get_hashes_msec_dev_benchmark (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-10-17 15:20:19 +00:00
|
|
|
{
|
|
|
|
// this function increases accuracy for benchmark modes
|
|
|
|
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-17 15:20:19 +00:00
|
|
|
|
|
|
|
u64 speed_cnt = 0;
|
|
|
|
double speed_msec = 0;
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-10-17 15:20:19 +00:00
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2016-10-17 15:20:19 +00:00
|
|
|
{
|
2018-08-02 18:47:17 +00:00
|
|
|
const u32 speed_pos = MAX (device_param->speed_pos, 1);
|
|
|
|
|
|
|
|
speed_cnt += device_param->speed_cnt[speed_pos - 1];
|
|
|
|
speed_msec += device_param->speed_msec[speed_pos - 1];
|
2016-10-17 15:20:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double hashes_dev_msec = 0;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
if (speed_msec > 0)
|
|
|
|
{
|
|
|
|
hashes_dev_msec = (double) speed_cnt / speed_msec;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hashes_dev_msec;
|
|
|
|
}
|
|
|
|
|
|
|
|
double status_get_exec_msec_all (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
double exec_all_msec = 0;
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
for (int backend_devices_idx = 0; backend_devices_idx < backend_ctx->backend_devices_cnt; backend_devices_idx++)
|
2016-10-17 11:44:07 +00:00
|
|
|
{
|
2019-04-30 11:38:44 +00:00
|
|
|
exec_all_msec += status_get_exec_msec_dev (hashcat_ctx, backend_devices_idx);
|
2016-10-17 11:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return exec_all_msec;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
double status_get_exec_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-10-17 11:44:07 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
double exec_dev_msec = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2016-10-17 11:44:07 +00:00
|
|
|
{
|
|
|
|
exec_dev_msec = get_avg_exec_time (device_param, EXEC_CACHE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return exec_dev_msec;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *status_get_speed_sec_all (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const double hashes_msec_all = status_get_hashes_msec_all (hashcat_ctx);
|
|
|
|
|
2018-01-31 15:36:04 +00:00
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
format_speed_display (hashes_msec_all * 1000, display, HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
char *status_get_speed_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-10-17 11:44:07 +00:00
|
|
|
{
|
2019-04-30 11:38:44 +00:00
|
|
|
const double hashes_msec_dev = status_get_hashes_msec_dev (hashcat_ctx, backend_devices_idx);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
2018-01-31 15:36:04 +00:00
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
2016-10-17 11:44:07 +00:00
|
|
|
|
|
|
|
format_speed_display (hashes_msec_dev * 1000, display, HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2016-10-17 13:19:25 +00:00
|
|
|
int status_get_cpt_cur_min (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2016-10-23 15:31:22 +00:00
|
|
|
const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
2016-10-29 13:12:45 +00:00
|
|
|
if (status_ctx->accessible == false) return 0;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t now = time (NULL);
|
2016-10-17 13:19:25 +00:00
|
|
|
|
|
|
|
int cpt_cur_min = 0;
|
|
|
|
|
2016-10-25 10:25:53 +00:00
|
|
|
for (int i = 0; i < CPT_CACHE; i++)
|
2016-10-17 13:19:25 +00:00
|
|
|
{
|
2021-06-18 05:57:15 +00:00
|
|
|
const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
|
|
|
if ((timestamp + 60) > now)
|
|
|
|
{
|
|
|
|
cpt_cur_min += cracked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return cpt_cur_min;
|
|
|
|
}
|
|
|
|
|
|
|
|
int status_get_cpt_cur_hour (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2016-10-23 15:31:22 +00:00
|
|
|
const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
2016-10-29 13:12:45 +00:00
|
|
|
if (status_ctx->accessible == false) return 0;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t now = time (NULL);
|
2016-10-17 13:19:25 +00:00
|
|
|
|
|
|
|
int cpt_cur_hour = 0;
|
|
|
|
|
2016-10-25 10:25:53 +00:00
|
|
|
for (int i = 0; i < CPT_CACHE; i++)
|
2016-10-17 13:19:25 +00:00
|
|
|
{
|
2021-06-18 05:57:15 +00:00
|
|
|
const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
|
|
|
if ((timestamp + 3600) > now)
|
|
|
|
{
|
|
|
|
cpt_cur_hour += cracked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return cpt_cur_hour;
|
|
|
|
}
|
|
|
|
|
|
|
|
int status_get_cpt_cur_day (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
2016-10-23 15:31:22 +00:00
|
|
|
const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
2016-10-29 13:12:45 +00:00
|
|
|
if (status_ctx->accessible == false) return 0;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t now = time (NULL);
|
2016-10-17 13:19:25 +00:00
|
|
|
|
|
|
|
int cpt_cur_day = 0;
|
|
|
|
|
2016-10-25 10:25:53 +00:00
|
|
|
for (int i = 0; i < CPT_CACHE; i++)
|
2016-10-17 13:19:25 +00:00
|
|
|
{
|
2021-06-18 05:57:15 +00:00
|
|
|
const u32 cracked = cpt_ctx->cpt_buf[i].cracked;
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t timestamp = cpt_ctx->cpt_buf[i].timestamp;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
|
|
|
if ((timestamp + 86400) > now)
|
|
|
|
{
|
|
|
|
cpt_cur_day += cracked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return cpt_cur_day;
|
|
|
|
}
|
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
double status_get_cpt_avg_min (const hashcat_ctx_t *hashcat_ctx)
|
2016-10-17 13:19:25 +00:00
|
|
|
{
|
|
|
|
const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
|
|
|
|
|
|
|
const double msec_real = status_get_msec_real (hashcat_ctx);
|
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
const double min_real = (msec_real / 1000) / 60;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
double cpt_avg_min = 0;
|
|
|
|
|
|
|
|
if (min_real > 1)
|
|
|
|
{
|
|
|
|
cpt_avg_min = (double) cpt_ctx->cpt_total / min_real;
|
|
|
|
}
|
|
|
|
|
|
|
|
return cpt_avg_min;
|
2016-10-17 13:19:25 +00:00
|
|
|
}
|
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
double status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx)
|
2016-10-17 13:19:25 +00:00
|
|
|
{
|
|
|
|
const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
|
|
|
|
|
|
|
const double msec_real = status_get_msec_real (hashcat_ctx);
|
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
const double hour_real = (msec_real / 1000) / (60 * 60);
|
|
|
|
|
|
|
|
double cpt_avg_hour = 0;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
if (hour_real > 1)
|
|
|
|
{
|
|
|
|
cpt_avg_hour = (double) cpt_ctx->cpt_total / hour_real;
|
|
|
|
}
|
|
|
|
|
|
|
|
return cpt_avg_hour;
|
2016-10-17 13:19:25 +00:00
|
|
|
}
|
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
double status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx)
|
2016-10-17 13:19:25 +00:00
|
|
|
{
|
|
|
|
const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
|
|
|
|
|
|
|
const double msec_real = status_get_msec_real (hashcat_ctx);
|
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
const double day_real = (msec_real / 1000) / (60 * 60 * 24);
|
|
|
|
|
|
|
|
double cpt_avg_day = 0;
|
|
|
|
|
|
|
|
if (day_real > 1)
|
|
|
|
{
|
|
|
|
cpt_avg_day = (double) cpt_ctx->cpt_total / day_real;
|
|
|
|
}
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
return cpt_avg_day;
|
2016-10-17 13:19:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx;
|
|
|
|
|
2017-12-10 00:40:45 +00:00
|
|
|
const time_t now = time (NULL);
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2017-10-03 05:10:10 +00:00
|
|
|
char *cpt;
|
2016-10-17 13:19:25 +00:00
|
|
|
|
|
|
|
const int cpt_cur_min = status_get_cpt_cur_min (hashcat_ctx);
|
|
|
|
const int cpt_cur_hour = status_get_cpt_cur_hour (hashcat_ctx);
|
|
|
|
const int cpt_cur_day = status_get_cpt_cur_day (hashcat_ctx);
|
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
const double cpt_avg_min = status_get_cpt_avg_min (hashcat_ctx);
|
|
|
|
const double cpt_avg_hour = status_get_cpt_avg_hour (hashcat_ctx);
|
|
|
|
const double cpt_avg_day = status_get_cpt_avg_day (hashcat_ctx);
|
2016-10-17 13:19:25 +00:00
|
|
|
|
2021-06-18 05:57:15 +00:00
|
|
|
if ((cpt_ctx->cpt_start + (60 * 60 * 24)) < now)
|
2016-10-17 13:19:25 +00:00
|
|
|
{
|
2022-03-22 15:17:26 +00:00
|
|
|
hc_asprintf (&cpt, "CUR:%u,%u,%u AVG:%.2f,%.2f,%.2f (Min,Hour,Day)",
|
2016-10-17 13:19:25 +00:00
|
|
|
cpt_cur_min,
|
|
|
|
cpt_cur_hour,
|
|
|
|
cpt_cur_day,
|
|
|
|
cpt_avg_min,
|
|
|
|
cpt_avg_hour,
|
|
|
|
cpt_avg_day);
|
|
|
|
}
|
2021-06-18 05:57:15 +00:00
|
|
|
else if ((cpt_ctx->cpt_start + (60 * 60)) < now)
|
2016-10-17 13:19:25 +00:00
|
|
|
{
|
2022-08-27 09:08:36 +00:00
|
|
|
hc_asprintf (&cpt, "CUR:%u,%u,N/A AVG:%.2f,%.2f,N/A (Min,Hour,Day)",
|
2016-10-17 13:19:25 +00:00
|
|
|
cpt_cur_min,
|
|
|
|
cpt_cur_hour,
|
|
|
|
cpt_avg_min,
|
2021-06-18 05:57:15 +00:00
|
|
|
cpt_avg_hour);
|
2016-10-17 13:19:25 +00:00
|
|
|
}
|
|
|
|
else if ((cpt_ctx->cpt_start + 60) < now)
|
|
|
|
{
|
2022-03-22 15:17:26 +00:00
|
|
|
hc_asprintf (&cpt, "CUR:%u,N/A,N/A AVG:%.2f,N/A,N/A (Min,Hour,Day)",
|
2016-10-17 13:19:25 +00:00
|
|
|
cpt_cur_min,
|
2021-06-18 05:57:15 +00:00
|
|
|
cpt_avg_min);
|
2016-10-17 13:19:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-06-18 05:57:15 +00:00
|
|
|
hc_asprintf (&cpt, "CUR:N/A,N/A,N/A AVG:N/A,N/A,N/A (Min,Hour,Day)");
|
2016-10-17 13:19:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return cpt;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_salt_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-08-17 23:41:07 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-08-17 23:41:07 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-08-17 23:41:07 +00:00
|
|
|
|
|
|
|
int salt_pos = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-08-17 23:41:07 +00:00
|
|
|
{
|
2022-01-04 17:07:18 +00:00
|
|
|
salt_pos = (int) device_param->kernel_param.salt_pos_host;
|
2018-08-17 23:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return salt_pos;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_innerloop_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-08-17 23:41:07 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-08-17 23:41:07 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-08-17 23:41:07 +00:00
|
|
|
|
|
|
|
int innerloop_pos = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-08-17 23:41:07 +00:00
|
|
|
{
|
|
|
|
innerloop_pos = (int) device_param->innerloop_pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
return innerloop_pos;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_innerloop_left_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-08-18 00:17:42 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-08-18 00:17:42 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-08-18 00:17:42 +00:00
|
|
|
|
|
|
|
int innerloop_left = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-08-18 00:17:42 +00:00
|
|
|
{
|
|
|
|
innerloop_left = (int) device_param->innerloop_left;
|
|
|
|
}
|
|
|
|
|
|
|
|
return innerloop_left;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_iteration_pos_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-08-17 23:41:07 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-08-17 23:41:07 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-08-17 23:41:07 +00:00
|
|
|
|
|
|
|
int iteration_pos = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-08-17 23:41:07 +00:00
|
|
|
{
|
2022-01-04 17:07:18 +00:00
|
|
|
iteration_pos = (int) device_param->kernel_param.loop_pos;
|
2018-08-17 23:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return iteration_pos;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_iteration_left_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-08-18 00:17:42 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-08-18 00:17:42 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-08-18 00:17:42 +00:00
|
|
|
|
|
|
|
int iteration_left = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-08-18 00:17:42 +00:00
|
|
|
{
|
2022-01-04 17:07:18 +00:00
|
|
|
iteration_left = (int) device_param->kernel_param.loop_cnt;
|
2018-08-18 00:17:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return iteration_left;
|
|
|
|
}
|
|
|
|
|
2022-03-18 08:42:01 +00:00
|
|
|
char *status_get_device_name (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
|
|
|
{
|
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
|
|
|
|
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
|
|
|
|
|
|
|
return device_param->device_name;
|
|
|
|
}
|
|
|
|
|
2022-03-18 10:37:35 +00:00
|
|
|
cl_device_type status_get_device_type (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
|
|
|
{
|
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
|
|
|
|
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
|
|
|
|
|
|
|
return device_param->opencl_device_type;
|
|
|
|
}
|
|
|
|
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_brain_link_client_id_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-10-28 15:47:13 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-10-28 15:47:13 +00:00
|
|
|
|
|
|
|
int brain_client_id = -1;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
|
|
|
brain_client_id = device_param->brain_link_client_fd;
|
|
|
|
}
|
|
|
|
|
|
|
|
return brain_client_id;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_brain_link_status_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-10-28 15:47:13 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-10-28 15:47:13 +00:00
|
|
|
|
|
|
|
int brain_link_status_dev = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
|
|
|
if (device_param->brain_link_client_fd != -1) brain_link_status_dev = BRAIN_LINK_STATUS_CONNECTED;
|
|
|
|
if (device_param->brain_link_recv_active == true) brain_link_status_dev = BRAIN_LINK_STATUS_RECEIVING;
|
|
|
|
if (device_param->brain_link_send_active == true) brain_link_status_dev = BRAIN_LINK_STATUS_SENDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
return brain_link_status_dev;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
char *status_get_brain_link_recv_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-10-28 15:47:13 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-10-28 15:47:13 +00:00
|
|
|
|
|
|
|
u64 brain_link_recv_bytes = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
|
|
|
brain_link_recv_bytes = device_param->brain_link_recv_bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
format_speed_display_1k (brain_link_recv_bytes, display, HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2019-06-15 22:46:40 +00:00
|
|
|
char *status_get_brain_rx_all (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
|
|
|
double brain_rx_all = 0;
|
|
|
|
|
|
|
|
for (int backend_devices_idx = 0; backend_devices_idx < backend_ctx->backend_devices_cnt; backend_devices_idx++)
|
|
|
|
{
|
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2022-01-11 03:58:30 +00:00
|
|
|
|
2019-06-15 22:46:40 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
|
|
|
{
|
|
|
|
brain_rx_all += device_param->brain_link_recv_bytes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
format_speed_display_1k (brain_rx_all, display, HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
char *status_get_brain_link_send_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-10-28 15:47:13 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-10-28 15:47:13 +00:00
|
|
|
|
|
|
|
u64 brain_link_send_bytes = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
|
|
|
brain_link_send_bytes = device_param->brain_link_send_bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
format_speed_display_1k (brain_link_send_bytes, display, HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2019-06-15 22:46:40 +00:00
|
|
|
char *status_get_brain_tx_all (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
|
|
|
double brain_tx_all = 0;
|
|
|
|
|
|
|
|
for (int backend_devices_idx = 0; backend_devices_idx < backend_ctx->backend_devices_cnt; backend_devices_idx++)
|
|
|
|
{
|
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2022-01-11 03:58:30 +00:00
|
|
|
|
2019-06-15 22:46:40 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
|
|
|
{
|
|
|
|
brain_tx_all += device_param->brain_link_send_bytes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
format_speed_display_1k (brain_tx_all, display, HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
return display;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
char *status_get_brain_link_recv_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-10-28 15:47:13 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-10-28 15:47:13 +00:00
|
|
|
|
|
|
|
u64 brain_link_recv_bytes = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
|
|
|
for (int idx = 0; idx < LINK_SPEED_COUNT; idx++)
|
|
|
|
{
|
|
|
|
double ms = hc_timer_get (device_param->brain_link_recv_speed.timer[idx]);
|
|
|
|
|
|
|
|
if (ms >= 1000) continue;
|
|
|
|
|
|
|
|
brain_link_recv_bytes += device_param->brain_link_recv_speed.bytes[idx];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
|
|
|
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (display, HCBUFSIZ_TINY, "%.2f M", (double) (brain_link_recv_bytes * 8) / 1024 / 1024);
|
2018-10-28 15:47:13 +00:00
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
char *status_get_brain_link_send_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-10-28 15:47:13 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-10-28 15:47:13 +00:00
|
|
|
|
|
|
|
u64 brain_link_send_bytes = 0;
|
|
|
|
|
2019-03-04 09:29:57 +00:00
|
|
|
if ((device_param->skipped == false) && (device_param->skipped_warning == false))
|
2018-10-28 15:47:13 +00:00
|
|
|
{
|
|
|
|
for (int idx = 0; idx < LINK_SPEED_COUNT; idx++)
|
|
|
|
{
|
|
|
|
double ms = hc_timer_get (device_param->brain_link_send_speed.timer[idx]);
|
|
|
|
|
|
|
|
if (ms >= 1000) continue;
|
|
|
|
|
|
|
|
brain_link_send_bytes += device_param->brain_link_send_speed.bytes[idx];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char *display = (char *) hcmalloc (HCBUFSIZ_TINY);
|
|
|
|
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (display, HCBUFSIZ_TINY, "%.2f M", (double) (brain_link_send_bytes * 8) / 1024 / 1024);
|
2018-10-28 15:47:13 +00:00
|
|
|
|
|
|
|
return display;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-06-19 18:32:07 +00:00
|
|
|
#if defined(__APPLE__)
|
|
|
|
char *status_get_hwmon_fan_dev (const hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
char *fanspeed_str = (char *) hcmalloc (HCBUFSIZ_TINY);
|
|
|
|
|
|
|
|
hc_thread_mutex_lock (status_ctx->mux_hwmon);
|
|
|
|
|
|
|
|
hm_get_fanspeed_apple ((hashcat_ctx_t *) hashcat_ctx, fanspeed_str);
|
|
|
|
|
|
|
|
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
|
|
|
|
|
|
|
|
return fanspeed_str;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-10-17 15:02:56 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-10-17 15:02:56 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-10-17 15:02:56 +00:00
|
|
|
|
2018-01-31 15:36:04 +00:00
|
|
|
char *output_buf = (char *) hcmalloc (HCBUFSIZ_TINY);
|
2016-10-17 15:02:56 +00:00
|
|
|
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (output_buf, HCBUFSIZ_TINY, "N/A");
|
2016-10-17 15:02:56 +00:00
|
|
|
|
|
|
|
if (device_param->skipped == true) return output_buf;
|
2019-03-04 09:29:57 +00:00
|
|
|
if (device_param->skipped_warning == true) return output_buf;
|
|
|
|
|
2016-10-17 15:02:56 +00:00
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
hc_thread_mutex_lock (status_ctx->mux_hwmon);
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
const int num_temperature = hm_get_temperature_with_devices_idx ((hashcat_ctx_t *) hashcat_ctx, backend_devices_idx);
|
|
|
|
const int num_fanspeed = hm_get_fanspeed_with_devices_idx ((hashcat_ctx_t *) hashcat_ctx, backend_devices_idx);
|
|
|
|
const int num_utilization = hm_get_utilization_with_devices_idx ((hashcat_ctx_t *) hashcat_ctx, backend_devices_idx);
|
|
|
|
const int num_corespeed = hm_get_corespeed_with_devices_idx ((hashcat_ctx_t *) hashcat_ctx, backend_devices_idx);
|
|
|
|
const int num_memoryspeed = hm_get_memoryspeed_with_devices_idx ((hashcat_ctx_t *) hashcat_ctx, backend_devices_idx);
|
|
|
|
const int num_buslanes = hm_get_buslanes_with_devices_idx ((hashcat_ctx_t *) hashcat_ctx, backend_devices_idx);
|
2016-10-17 15:02:56 +00:00
|
|
|
|
|
|
|
int output_len = 0;
|
|
|
|
|
|
|
|
if (num_temperature >= 0)
|
|
|
|
{
|
2016-11-21 13:22:52 +00:00
|
|
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Temp:%3dc ", num_temperature);
|
2016-10-17 15:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (num_fanspeed >= 0)
|
|
|
|
{
|
2016-11-21 13:22:52 +00:00
|
|
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Fan:%3d%% ", num_fanspeed);
|
2016-10-17 15:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (num_utilization >= 0)
|
|
|
|
{
|
2016-11-21 13:22:52 +00:00
|
|
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Util:%3d%% ", num_utilization);
|
2016-10-17 15:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (num_corespeed >= 0)
|
|
|
|
{
|
2017-02-22 17:34:33 +00:00
|
|
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Core:%4dMHz ", num_corespeed);
|
2016-10-17 15:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (num_memoryspeed >= 0)
|
|
|
|
{
|
2017-02-22 17:34:33 +00:00
|
|
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Mem:%4dMHz ", num_memoryspeed);
|
2016-10-17 15:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (num_buslanes >= 0)
|
|
|
|
{
|
2022-03-22 15:17:26 +00:00
|
|
|
output_len += snprintf (output_buf + output_len, HCBUFSIZ_TINY - output_len, "Bus:%u ", num_buslanes);
|
2016-10-17 15:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (output_len > 0)
|
|
|
|
{
|
2016-11-21 13:22:52 +00:00
|
|
|
// trims the trailing space
|
|
|
|
|
2016-11-21 14:58:44 +00:00
|
|
|
output_buf[output_len - 1] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-07 09:37:56 +00:00
|
|
|
snprintf (output_buf, HCBUFSIZ_TINY, "N/A");
|
2016-10-17 15:02:56 +00:00
|
|
|
}
|
2016-11-21 13:22:52 +00:00
|
|
|
|
2016-10-17 15:02:56 +00:00
|
|
|
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
|
|
|
|
|
|
|
|
return output_buf;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-11-10 16:50:29 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-11-10 16:50:29 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-11-10 16:50:29 +00:00
|
|
|
|
|
|
|
if (device_param->skipped == true) return -1;
|
2019-03-04 09:29:57 +00:00
|
|
|
if (device_param->skipped_warning == true) return -1;
|
|
|
|
|
2016-11-10 16:50:29 +00:00
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
hc_thread_mutex_lock (status_ctx->mux_hwmon);
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
const int num_corespeed = hm_get_corespeed_with_devices_idx ((hashcat_ctx_t *) hashcat_ctx, backend_devices_idx);
|
2016-11-10 16:50:29 +00:00
|
|
|
|
|
|
|
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
|
|
|
|
|
|
|
|
return num_corespeed;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-11-10 16:50:29 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-11-10 16:50:29 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-11-10 16:50:29 +00:00
|
|
|
|
|
|
|
if (device_param->skipped == true) return -1;
|
2019-03-04 09:29:57 +00:00
|
|
|
if (device_param->skipped_warning == true) return -1;
|
|
|
|
|
2016-11-10 16:50:29 +00:00
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
hc_thread_mutex_lock (status_ctx->mux_hwmon);
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
const int num_memoryspeed = hm_get_memoryspeed_with_devices_idx ((hashcat_ctx_t *) hashcat_ctx, backend_devices_idx);
|
2016-11-10 16:50:29 +00:00
|
|
|
|
|
|
|
hc_thread_mutex_unlock (status_ctx->mux_hwmon);
|
|
|
|
|
|
|
|
return num_memoryspeed;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
u64 status_get_progress_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-12-09 22:44:43 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-12-09 22:44:43 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-12-09 22:44:43 +00:00
|
|
|
|
|
|
|
if (device_param->skipped == true) return 0;
|
2019-03-04 09:29:57 +00:00
|
|
|
if (device_param->skipped_warning == true) return 0;
|
|
|
|
|
2016-12-09 22:44:43 +00:00
|
|
|
return device_param->outerloop_left;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
double status_get_runtime_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2016-12-09 22:44:43 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2016-12-09 22:44:43 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2016-12-09 22:44:43 +00:00
|
|
|
|
|
|
|
if (device_param->skipped == true) return 0;
|
2019-03-04 09:29:57 +00:00
|
|
|
if (device_param->skipped_warning == true) return 0;
|
|
|
|
|
2018-07-31 12:41:25 +00:00
|
|
|
return device_param->outerloop_msec;
|
2016-12-09 22:44:43 +00:00
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_kernel_accel_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-02-02 22:22:21 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-02-02 22:22:21 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-02-02 22:22:21 +00:00
|
|
|
|
|
|
|
if (device_param->skipped == true) return 0;
|
2019-03-04 09:29:57 +00:00
|
|
|
if (device_param->skipped_warning == true) return 0;
|
|
|
|
|
2018-02-02 22:22:21 +00:00
|
|
|
if (device_param->kernel_accel_prev) return device_param->kernel_accel_prev;
|
|
|
|
|
|
|
|
return device_param->kernel_accel;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_kernel_loops_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-02-02 22:22:21 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-02-02 22:22:21 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-02-02 22:22:21 +00:00
|
|
|
|
|
|
|
if (device_param->skipped == true) return 0;
|
2019-03-04 09:29:57 +00:00
|
|
|
if (device_param->skipped_warning == true) return 0;
|
|
|
|
|
2018-02-02 22:22:21 +00:00
|
|
|
if (device_param->kernel_loops_prev) return device_param->kernel_loops_prev;
|
|
|
|
|
|
|
|
return device_param->kernel_loops;
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_kernel_threads_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-02-02 22:22:21 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-02-02 22:22:21 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-02-02 22:22:21 +00:00
|
|
|
|
|
|
|
if (device_param->skipped == true) return 0;
|
2019-03-04 09:29:57 +00:00
|
|
|
if (device_param->skipped_warning == true) return 0;
|
|
|
|
|
2021-08-17 15:38:45 +00:00
|
|
|
if (device_param->kernel_threads_prev) return device_param->kernel_threads_prev;
|
|
|
|
|
2018-02-11 20:29:57 +00:00
|
|
|
return device_param->kernel_threads;
|
2018-02-02 22:22:21 +00:00
|
|
|
}
|
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
int status_get_vector_width_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
2018-02-02 22:22:21 +00:00
|
|
|
{
|
2019-04-25 12:45:17 +00:00
|
|
|
const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx;
|
2018-02-02 22:22:21 +00:00
|
|
|
|
2019-04-30 11:38:44 +00:00
|
|
|
hc_device_param_t *device_param = &backend_ctx->devices_param[backend_devices_idx];
|
2018-02-02 22:22:21 +00:00
|
|
|
|
|
|
|
if (device_param->skipped == true) return 0;
|
2019-03-04 09:29:57 +00:00
|
|
|
if (device_param->skipped_warning == true) return 0;
|
|
|
|
|
2018-02-02 22:22:21 +00:00
|
|
|
return device_param->vector_width;
|
|
|
|
}
|
|
|
|
|
2016-10-17 11:55:55 +00:00
|
|
|
int status_progress_init (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
2016-11-20 21:54:52 +00:00
|
|
|
status_ctx->words_progress_done = (u64 *) hccalloc (hashes->salts_cnt, sizeof (u64));
|
|
|
|
status_ctx->words_progress_rejected = (u64 *) hccalloc (hashes->salts_cnt, sizeof (u64));
|
|
|
|
status_ctx->words_progress_restored = (u64 *) hccalloc (hashes->salts_cnt, sizeof (u64));
|
2016-10-17 11:55:55 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void status_progress_destroy (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
hcfree (status_ctx->words_progress_done);
|
|
|
|
hcfree (status_ctx->words_progress_rejected);
|
|
|
|
hcfree (status_ctx->words_progress_restored);
|
|
|
|
|
|
|
|
status_ctx->words_progress_done = NULL;
|
|
|
|
status_ctx->words_progress_rejected = NULL;
|
|
|
|
status_ctx->words_progress_restored = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void status_progress_reset (hashcat_ctx_t *hashcat_ctx)
|
|
|
|
{
|
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
hashes_t *hashes = hashcat_ctx->hashes;
|
|
|
|
|
|
|
|
memset (status_ctx->words_progress_done, 0, hashes->salts_cnt * sizeof (u64));
|
|
|
|
memset (status_ctx->words_progress_rejected, 0, hashes->salts_cnt * sizeof (u64));
|
|
|
|
memset (status_ctx->words_progress_restored, 0, hashes->salts_cnt * sizeof (u64));
|
|
|
|
}
|
|
|
|
|
2016-10-06 07:47:34 +00:00
|
|
|
int status_ctx_init (hashcat_ctx_t *hashcat_ctx)
|
2016-09-29 21:25:29 +00:00
|
|
|
{
|
2016-10-06 07:47:34 +00:00
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
2016-09-29 21:25:29 +00:00
|
|
|
status_ctx->devices_status = STATUS_INIT;
|
|
|
|
|
2016-11-02 21:45:39 +00:00
|
|
|
status_ctx->run_main_level1 = true;
|
|
|
|
status_ctx->run_main_level2 = true;
|
|
|
|
status_ctx->run_main_level3 = true;
|
|
|
|
status_ctx->run_thread_level1 = true;
|
|
|
|
status_ctx->run_thread_level2 = true;
|
2016-09-29 21:25:29 +00:00
|
|
|
|
2016-11-02 21:45:39 +00:00
|
|
|
status_ctx->shutdown_inner = false;
|
|
|
|
status_ctx->shutdown_outer = false;
|
2016-10-31 22:19:44 +00:00
|
|
|
|
2016-10-23 11:38:41 +00:00
|
|
|
status_ctx->checkpoint_shutdown = false;
|
2021-05-05 20:53:04 +00:00
|
|
|
status_ctx->finish_shutdown = false;
|
2016-10-23 11:38:41 +00:00
|
|
|
|
2016-11-20 21:54:52 +00:00
|
|
|
status_ctx->hashcat_status_final = (hashcat_status_t *) hcmalloc (sizeof (hashcat_status_t));
|
2016-11-02 21:45:39 +00:00
|
|
|
|
2016-09-29 21:49:33 +00:00
|
|
|
hc_thread_mutex_init (status_ctx->mux_dispatcher);
|
|
|
|
hc_thread_mutex_init (status_ctx->mux_counter);
|
|
|
|
hc_thread_mutex_init (status_ctx->mux_display);
|
|
|
|
hc_thread_mutex_init (status_ctx->mux_hwmon);
|
|
|
|
|
2016-09-29 21:25:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-10-06 07:47:34 +00:00
|
|
|
void status_ctx_destroy (hashcat_ctx_t *hashcat_ctx)
|
2016-09-29 21:25:29 +00:00
|
|
|
{
|
2016-10-06 07:47:34 +00:00
|
|
|
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
2016-09-29 21:49:33 +00:00
|
|
|
hc_thread_mutex_delete (status_ctx->mux_dispatcher);
|
|
|
|
hc_thread_mutex_delete (status_ctx->mux_counter);
|
|
|
|
hc_thread_mutex_delete (status_ctx->mux_display);
|
|
|
|
hc_thread_mutex_delete (status_ctx->mux_hwmon);
|
2016-09-29 21:25:29 +00:00
|
|
|
|
2016-11-02 21:45:39 +00:00
|
|
|
hcfree (status_ctx->hashcat_status_final);
|
|
|
|
|
2016-10-01 22:00:21 +00:00
|
|
|
memset (status_ctx, 0, sizeof (status_ctx_t));
|
2016-09-29 21:25:29 +00:00
|
|
|
}
|
2017-05-18 14:14:25 +00:00
|
|
|
|
2017-05-30 10:15:55 +00:00
|
|
|
void status_status_destroy (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_status)
|
2017-05-18 14:14:25 +00:00
|
|
|
{
|
2017-05-30 10:15:55 +00:00
|
|
|
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
|
|
|
|
|
|
|
if (status_ctx == NULL) return;
|
|
|
|
|
|
|
|
if (status_ctx->accessible == false) return;
|
2017-05-19 12:09:14 +00:00
|
|
|
|
2019-01-21 09:00:44 +00:00
|
|
|
hcfree (hashcat_status->hash_target);
|
|
|
|
hcfree (hashcat_status->hash_name);
|
2017-05-30 10:15:55 +00:00
|
|
|
hcfree (hashcat_status->session);
|
|
|
|
hcfree (hashcat_status->time_estimated_absolute);
|
|
|
|
hcfree (hashcat_status->time_estimated_relative);
|
|
|
|
hcfree (hashcat_status->time_started_absolute);
|
|
|
|
hcfree (hashcat_status->time_started_relative);
|
|
|
|
hcfree (hashcat_status->speed_sec_all);
|
|
|
|
hcfree (hashcat_status->guess_base);
|
|
|
|
hcfree (hashcat_status->guess_mod);
|
|
|
|
hcfree (hashcat_status->guess_charset);
|
|
|
|
hcfree (hashcat_status->cpt);
|
2021-06-18 11:13:16 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
hcfree (hashcat_status->brain_rx_all);
|
|
|
|
hcfree (hashcat_status->brain_tx_all);
|
|
|
|
#endif
|
2017-05-18 14:14:25 +00:00
|
|
|
|
2019-01-21 09:00:44 +00:00
|
|
|
hashcat_status->hash_target = NULL;
|
|
|
|
hashcat_status->hash_name = NULL;
|
2017-05-30 10:15:55 +00:00
|
|
|
hashcat_status->session = NULL;
|
|
|
|
hashcat_status->time_estimated_absolute = NULL;
|
|
|
|
hashcat_status->time_estimated_relative = NULL;
|
|
|
|
hashcat_status->time_started_absolute = NULL;
|
|
|
|
hashcat_status->time_started_relative = NULL;
|
|
|
|
hashcat_status->speed_sec_all = NULL;
|
|
|
|
hashcat_status->guess_base = NULL;
|
|
|
|
hashcat_status->guess_mod = NULL;
|
|
|
|
hashcat_status->guess_charset = NULL;
|
|
|
|
hashcat_status->cpt = NULL;
|
2021-06-18 11:13:16 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
hashcat_status->brain_rx_all = NULL;
|
|
|
|
hashcat_status->brain_tx_all = NULL;
|
|
|
|
#endif
|
2017-05-30 10:15:55 +00:00
|
|
|
|
|
|
|
for (int device_id = 0; device_id < hashcat_status->device_info_cnt; device_id++)
|
2017-05-18 14:14:25 +00:00
|
|
|
{
|
2017-05-30 10:15:55 +00:00
|
|
|
device_info_t *device_info = hashcat_status->device_info_buf + device_id;
|
|
|
|
|
2017-05-19 12:09:14 +00:00
|
|
|
hcfree (device_info->speed_sec_dev);
|
|
|
|
hcfree (device_info->guess_candidates_dev);
|
|
|
|
hcfree (device_info->hwmon_dev);
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
hcfree (device_info->brain_link_recv_bytes_dev);
|
|
|
|
hcfree (device_info->brain_link_send_bytes_dev);
|
|
|
|
hcfree (device_info->brain_link_recv_bytes_sec_dev);
|
|
|
|
hcfree (device_info->brain_link_send_bytes_sec_dev);
|
|
|
|
#endif
|
2017-05-30 10:15:55 +00:00
|
|
|
|
2018-09-01 10:31:17 +00:00
|
|
|
device_info->speed_sec_dev = NULL;
|
|
|
|
device_info->guess_candidates_dev = NULL;
|
|
|
|
device_info->hwmon_dev = NULL;
|
2018-10-28 15:47:13 +00:00
|
|
|
#ifdef WITH_BRAIN
|
|
|
|
device_info->brain_link_recv_bytes_dev = NULL;
|
|
|
|
device_info->brain_link_send_bytes_dev = NULL;
|
|
|
|
device_info->brain_link_recv_bytes_sec_dev = NULL;
|
|
|
|
device_info->brain_link_send_bytes_sec_dev = NULL;
|
|
|
|
#endif
|
2017-05-18 14:14:25 +00:00
|
|
|
}
|
2017-05-30 10:15:55 +00:00
|
|
|
}
|