1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Escape some fields of --status-json output

This commit is contained in:
Dávid Bolvanský 2022-09-10 22:35:02 +02:00
parent acbcd04884
commit 3b033af7d6

View File

@ -1828,11 +1828,24 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
end = time_now + sec_etc;
}
printf ("{ \"session\": \"%s\",", hashcat_status->session);
char *session_json_encoded = (char *) hcmalloc (strlen (hashcat_status->session) * 2);
json_encode (hashcat_status->session, session_json_encoded);
printf ("{ \"session\": \"%s\",", session_json_encoded);
hcfree (session_json_encoded);
printf (" \"guess\": {");
if (hashcat_status->guess_base)
{
printf (" \"guess_base\": \"%s\",", hashcat_status->guess_base);
char *guess_base_json_encoded = (char *) hcmalloc (strlen (hashcat_status->guess_base) * 2);
json_encode (hashcat_status->guess_base, guess_base_json_encoded);
printf (" \"guess_base\": \"%s\",", guess_base_json_encoded);
hcfree (guess_base_json_encoded);
}
else
{
@ -1846,7 +1859,13 @@ void status_display_status_json (hashcat_ctx_t *hashcat_ctx)
if (hashcat_status->guess_mod)
{
printf (" \"guess_mod\": \"%s\",", hashcat_status->guess_mod);
char *guess_mod_json_encoded = (char *) hcmalloc (strlen (hashcat_status->guess_mod) * 2);
json_encode (hashcat_status->guess_mod, guess_mod_json_encoded);
printf (" \"guess_mod\": \"%s\",", guess_mod_json_encoded);
hcfree (guess_mod_json_encoded);
}
else
{