1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 18:08:20 +00:00

Change logic for formatting with multiple devices when some are skipped

This commit is contained in:
Chick3nman 2019-04-02 16:53:59 -05:00
parent 1cf2a4fea6
commit fc1aa83541

View File

@ -931,6 +931,9 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
printf (" \"recovered_salts\": [%d, %d],", hashcat_status->salts_done, hashcat_status->salts_cnt);
printf (" \"rejected\": %" PRIu64 ",", hashcat_status->progress_rejected);
printf (" \"devices\": [");
int device_num = 0;
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;
@ -938,7 +941,8 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
if (device_info->skipped_warning_dev == true) continue;
if (device_id != 0)
if (device_num != 0)
{
printf(",");
}
@ -955,6 +959,8 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
const int util = hm_get_utilization_with_device_id (hashcat_ctx, device_id);
printf (" \"util\": %d }", util);
device_num++;
}
printf (" ],");
printf (" \"time_start\": %" PRIu64 ",", status_ctx->runtime_start);
@ -1668,6 +1674,8 @@ void status_speed_json (hashcat_ctx_t *hashcat_ctx)
printf ("{ \"devices\": [");
int device_num = 0;
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;
@ -1676,14 +1684,14 @@ void status_speed_json (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_warning_dev == true) continue;
if (device_id != 0)
if (device_num != 0)
{
printf(",");
}
printf (" { \"device_id\": %d,", device_id + 1);
printf (" \"speed\": %" PRIu64 " }", (u64) (device_info->hashes_msec_dev_benchmark * 1000));
device_num++;
}
printf(" ] }");
@ -1791,6 +1799,8 @@ void status_progress_json (hashcat_ctx_t *hashcat_ctx)
printf ("{ \"devices\": [");
int device_num = 0;
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;
@ -1799,7 +1809,7 @@ void status_progress_json (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_warning_dev == true) continue;
if (device_id != 0)
if (device_num != 0)
{
printf(",");
}
@ -1807,7 +1817,7 @@ void status_progress_json (hashcat_ctx_t *hashcat_ctx)
printf (" { \"device_id\": %d,", device_id + 1);
printf (" \"progress\": %" PRIu64 ",", device_info->progress_dev);
printf (" \"runtime\": %0.2f }", device_info->runtime_msec_dev);
device_num++;
}
printf(" ] }");