diff --git a/src/terminal.c b/src/terminal.c index 836e7f202..aa7848a37 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -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 {