-
- if(!csv_output)
- {
- printf(" Operating system: %s\n", agt_info->os);
- printf(" Client version: %s\n", agt_info->version);
- printf(" Last keep alive: %s\n\n", agt_info->last_keepalive);
-
-
- if(end_time)
- {
- printf(" Syscheck last started at: %s\n", agt_info->syscheck_time);
- printf(" Syscheck last ended at: %s\n", agt_info->syscheck_endtime);
- printf(" Rootcheck last started at: %s\n", agt_info->rootcheck_time);
- printf(" Rootcheck last ended at: %s\n\n", agt_info->rootcheck_endtime);
- }
- else
- {
- printf(" Syscheck last started at: %s\n", agt_info->syscheck_time);
- printf(" Rootcheck last started at: %s\n", agt_info->rootcheck_time);
- }
- }
- else
- {
+ if (!csv_output && !json_output) {
+ printf(" Operating system: %s\n", agt_info->os);
+ printf(" Client version: %s\n", agt_info->version);
+ printf(" Last keep alive: %s\n\n", agt_info->last_keepalive);
+
+ if (end_time) {
+ printf(" Syscheck last started at: %s\n", agt_info->syscheck_time);
+ printf(" Syscheck last ended at: %s\n", agt_info->syscheck_endtime);
+ printf(" Rootcheck last started at: %s\n", agt_info->rootcheck_time);
+ printf(" Rootcheck last ended at: %s\n\n", agt_info->rootcheck_endtime);
+ } else {
+ printf(" Syscheck last started at: %s\n", agt_info->syscheck_time);
+ printf(" Rootcheck last started at: %s\n", agt_info->rootcheck_time);
+ }
+ }else if(json_output){
+ cJSON_AddStringToObject(response, "os", agt_info->os);
+ cJSON_AddStringToObject(response, "version", agt_info->version);
+ cJSON_AddStringToObject(response, "lastKeepAlive", agt_info->last_keepalive);
+ cJSON_AddStringToObject(response, "syscheckTime", agt_info->syscheck_time);
+ cJSON_AddStringToObject(response, "syscheckEndTime", end_time ? agt_info->syscheck_endtime : "");
+ cJSON_AddStringToObject(response, "rootcheckTime", agt_info->rootcheck_time);
+ cJSON_AddStringToObject(response, "rootcheckEndTime", end_time ? agt_info->rootcheck_endtime : "");
+
+ } else {