1 /* @(#) $Id: symantecws_decoder.c,v 1.5 2009/06/24 17:06:24 dcid Exp $ */
3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 3) as published by the FSF - Free Software
11 * License details at the LICENSE file included with OSSEC or
12 * online at: http://www.ossec.net/en/licensing.html
16 #include "eventinfo.h"
19 /* Symantec Web Security decoder init */
20 void *SymantecWS_Decoder_Init()
22 debug1("%s: Initializing SymantecWS decoder..", ARGV0);
24 /* There is nothing to do over here */
29 /* Symantec Web Security decoder
30 * Will extract the action, srcip, id, url and username.
32 * Examples (also online at
33 * http://www.ossec.net/wiki/index.php/Symantec_WebSecurity ).
34 * 20070717,73613,1=5,11=10.1.1.3,10=userc,3=1,2=1
35 * 20070717,73614,1=5,11=1.2.3.4,1106=News,60=http://news.bbc.co.uk/,10=userX,1000=212.58.240.42,2=27
37 void *SymantecWS_Decoder_Exec(Eventinfo *lf)
40 char buf_str[OS_SIZE_1024 +1];
43 /* Initializing buffer */
45 buf_str[OS_SIZE_1024] = '\0';
48 /* Removing date and time */
49 if(!(tmp_str = strchr(lf->log, ',')))
53 if(!(tmp_str = strchr(tmp_str, ',')))
60 /* Getting all the values */
61 while(tmp_str != NULL)
63 /* Checking if we have the username */
64 if(strncmp(tmp_str, "10=", 3) == 0)
68 while(*tmp_str != '\0' && count < 128 && *tmp_str != ',')
70 buf_str[count] = *tmp_str;
73 buf_str[count] = '\0';
77 os_strdup(buf_str, lf->dstuser);
81 /* Checking the ip address */
82 else if(strncmp(tmp_str, "11=", 3) == 0)
86 while(*tmp_str != '\0' && count < 128 && *tmp_str != ',')
88 buf_str[count] = *tmp_str;
91 buf_str[count] = '\0';
93 /* Avoiding memory leaks -- only adding the first one */
96 os_strdup(buf_str, lf->srcip);
100 /* Getting the URL */
101 else if(strncmp(tmp_str, "60=", 3) == 0)
105 while(*tmp_str != '\0' && count < OS_SIZE_1024 && *tmp_str != ',')
107 buf_str[count] = *tmp_str;
110 buf_str[count] = '\0';
112 /* Avoiding memory leaks -- only adding the first one */
115 os_strdup(buf_str, lf->url);
120 else if((strncmp(tmp_str, "3=", 2) == 0) ||
121 (strncmp(tmp_str, "2=", 2) == 0))
124 while(*tmp_str != '\0' && count < 9)
126 buf_str[count] = *tmp_str;
129 buf_str[count] = '\0';
131 /* Avoiding memory leaks -- only adding the first one */
134 os_strdup(buf_str, lf->id);
138 /* Getting next entry */
139 tmp_str = strchr(tmp_str, ',');