From 3bb68e7981e9a5a2d6d28338b825616b9dbaf03c Mon Sep 17 00:00:00 2001 From: f0cker Date: Sat, 15 Jun 2019 22:46:40 +0000 Subject: [PATCH] Added brain status (tx/rx) for all devices --- include/status.h | 2 ++ include/types.h | 2 ++ src/hashcat.c | 2 ++ src/status.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/terminal.c | 4 ++++ 5 files changed, 54 insertions(+) diff --git a/include/status.h b/include/status.h index 2727d6172..8a142e54c 100644 --- a/include/status.h +++ b/include/status.h @@ -95,6 +95,8 @@ char *status_get_brain_link_recv_bytes_dev (const hashcat_ctx_t *hash char *status_get_brain_link_send_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); char *status_get_brain_link_recv_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); char *status_get_brain_link_send_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); +char *status_get_brain_rx_all (const hashcat_ctx_t *hashcat_ctx); +char *status_get_brain_tx_all (const hashcat_ctx_t *hashcat_ctx); #endif char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx); diff --git a/include/types.h b/include/types.h index d4bcd581d..a609c312c 100644 --- a/include/types.h +++ b/include/types.h @@ -2098,6 +2098,8 @@ typedef struct hashcat_status #ifdef WITH_BRAIN int brain_session; int brain_attack; + char *brain_rx_all; + char *brain_tx_all; #endif const char *status_string; int status_number; diff --git a/src/hashcat.c b/src/hashcat.c index 667b7eecc..9e169c73b 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -1484,6 +1484,8 @@ int hashcat_get_status (hashcat_ctx_t *hashcat_ctx, hashcat_status_t *hashcat_st device_info->brain_link_send_bytes_dev = status_get_brain_link_send_bytes_dev (hashcat_ctx, device_id); device_info->brain_link_recv_bytes_sec_dev = status_get_brain_link_recv_bytes_sec_dev (hashcat_ctx, device_id); device_info->brain_link_send_bytes_sec_dev = status_get_brain_link_send_bytes_sec_dev (hashcat_ctx, device_id); + hashcat_status->brain_rx_all = status_get_brain_rx_all (hashcat_ctx); + hashcat_status->brain_tx_all = status_get_brain_tx_all (hashcat_ctx); #endif } diff --git a/src/status.c b/src/status.c index 5594c2607..8ece2d694 100644 --- a/src/status.c +++ b/src/status.c @@ -1833,6 +1833,28 @@ char *status_get_brain_link_recv_bytes_dev (const hashcat_ctx_t *hashcat_ctx, co return display; } +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]; + 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; + +} + char *status_get_brain_link_send_bytes_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx) { const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; @@ -1853,6 +1875,28 @@ char *status_get_brain_link_send_bytes_dev (const hashcat_ctx_t *hashcat_ctx, co return display; } +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]; + 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; + +} + char *status_get_brain_link_recv_bytes_sec_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx) { const backend_ctx_t *backend_ctx = hashcat_ctx->backend_ctx; diff --git a/src/terminal.c b/src/terminal.c index f389da98e..1400ae724 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -1511,6 +1511,10 @@ void status_display (hashcat_ctx_t *hashcat_ctx) #ifdef WITH_BRAIN if (user_options->brain_client == true) { + event_log_info (hashcat_ctx, + "Brain.Link.All...: RX: %sB, TX: %sB", + hashcat_status->brain_rx_all, + hashcat_status->brain_tx_all); for (int device_id = 0; device_id < hashcat_status->device_info_cnt; device_id++) { const device_info_t *device_info = hashcat_status->device_info_buf + device_id;