-
-
- /* Listing available agents. */
- if(list_agents)
- {
- if(!csv_output)
- {
- printf("\nOSSEC HIDS %s. List of available agents:",
- ARGV0);
+ if (json_output)
+ json_root = cJSON_CreateObject();
+
+ /* List available agents */
+ if (list_agents) {
+ cJSON *json_agents = NULL;
+
+ if (json_output) {
+ cJSON *first = cJSON_CreateObject();
+ json_agents = cJSON_CreateArray();
+ cJSON_AddNumberToObject(json_root, "error", 0);
+ cJSON_AddStringToObject(first, "id", "000");
+ cJSON_AddStringToObject(first, "name", shost);
+ cJSON_AddStringToObject(first, "ip", "127.0.0.1");
+ cJSON_AddStringToObject(first, "status", "Active");
+ cJSON_AddItemToArray(json_agents, first);
+ } else if (csv_output)
+ printf("000,%s (server),127.0.0.1,Active/Local,\n", shost);
+ else {
+ printf("\nOSSEC HIDS %s. List of available agents:", ARGV0);