1 /* @(#) $Id: picviz.c,v 1.2 2009/06/24 17:06:22 dcid Exp $ */
3 /* Copyright (C) 2009 Sebastien Tricaud
4 * Copyright (C) 2009 Trend Micro Inc.
7 * This program is a free software; you can redistribute it
8 * and/or modify it under the terms of the GNU General Public
9 * License (version 3) as published by the FSF - Free Software
14 #include "eventinfo.h"
16 static FILE *picviz_fp;
18 static char *(ossec2picviz[])={"blue","blue","blue","blue",
19 "green","green","green","green",
20 "orange", "orange", "orange", "orange",
21 "red", "red", "red", "red", "red"};
24 void OS_PicvizOpen(char *socket)
26 picviz_fp = fopen(socket, "a");
29 merror("%s: Unable to open picviz socket file '%s'.",
34 void OS_PicvizLog(Eventinfo *lf)
36 char *color = (lf->generated_rule->level > 15) ? "red" : ossec2picviz[lf->generated_rule->level];
51 hostname = lf->hostname ? lf->hostname : "";
52 location = lf->location ? lf->location : "";
53 srcip = lf->srcip ? lf->srcip : "";
54 dstip = lf->dstip ? lf->dstip : "";
55 srcuser = lf->srcuser ? lf->srcuser : "";
56 dstuser = lf->dstuser ? lf->dstuser : "";
57 prgname = lf->program_name ? lf->program_name : "";
58 comment = lf->generated_rule->comment ? lf->generated_rule->comment : "";
61 "time=\"%s\", host=\"%s\", file=\"%s\", sip=\"%s\", dip=\"%s\""
62 ", srcuser=\"%s\", dstuser=\"%s\", prgnme=\"%s\", alert=\"%s\" [color=\"%s\"];\n",
64 hostname, location, srcip, dstip, srcuser, dstuser, prgname, comment, color);
70 void OS_PicvizClose(void)