1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-28 09:28:12 +00:00

Merge pull request #1977 from magnumripper/master

Mute a -Wformat warning and fix some whitespace noise while at it.
This commit is contained in:
Jens Steube 2019-04-05 09:07:13 +02:00 committed by GitHub
commit c507a649f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -888,11 +888,11 @@ void status_display_machine_readable (hashcat_ctx_t *hashcat_ctx)
void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
{
const hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx;
const status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
hashcat_status_t *hashcat_status = (hashcat_status_t *) hcmalloc (sizeof (hashcat_status_t));
const int rc_status = hashcat_get_status (hashcat_ctx, hashcat_status);
if (rc_status == -1)
@ -901,15 +901,15 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
return;
}
time_t time_now;
time (&time_now);
time_t end;
time_t sec_etc = status_get_sec_etc (hashcat_ctx);
if (overflow_check_u64_add (time_now, sec_etc) == false)
{
end = 1;
@ -928,9 +928,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,33 +938,33 @@ 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_num != 0)
{
printf(",");
}
printf (" { \"device_id\": %d,", device_id + 1);
printf (" \"speed\": %" PRIu64 ",", (u64) (device_info->hashes_msec_dev * 1000));
if (hwmon_ctx->enabled == true)
{
const int temp = hm_get_temperature_with_device_id (hashcat_ctx, device_id);
printf (" \"temp\": %d,", temp);
}
printf (" \"temp\": %d,", temp);
}
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);
printf (" \"estimated_stop\": %" PRIu64 " }", end);
printf (" \"time_start\": %" PRIu64 ",", (u64) status_ctx->runtime_start);
printf (" \"estimated_stop\": %" PRIu64 " }", (u64) end);
hc_fwrite (EOL, strlen (EOL), 1, stdout);
fflush (stdout);
status_status_destroy (hashcat_ctx, hashcat_status);
@ -984,11 +984,11 @@ void status_display (hashcat_ctx_t *hashcat_ctx)
return;
}
if (user_options->status_json == true)
{
status_display_status_json (hashcat_ctx);
return;
}
@ -1668,11 +1668,11 @@ void status_speed_json (hashcat_ctx_t *hashcat_ctx)
return;
}
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;
@ -1680,18 +1680,18 @@ void status_speed_json (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
if (device_info->skipped_warning_dev == true) continue;
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(" ] }");
status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status);
@ -1707,7 +1707,7 @@ void status_speed (hashcat_ctx_t *hashcat_ctx)
return;
}
if (user_options->status_json == true)
{
status_speed_json (hashcat_ctx);
@ -1793,11 +1793,11 @@ void status_progress_json (hashcat_ctx_t *hashcat_ctx)
return;
}
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;
@ -1805,19 +1805,19 @@ void status_progress_json (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
if (device_info->skipped_warning_dev == true) continue;
if (device_num != 0)
{
printf(",");
}
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(" ] }");
status_status_destroy (hashcat_ctx, hashcat_status);
hcfree (hashcat_status);
@ -1833,7 +1833,7 @@ void status_progress (hashcat_ctx_t *hashcat_ctx)
return;
}
if (user_options->status_json == true)
{
status_progress_json (hashcat_ctx);