From c2047c4ab76136efcf40d1a1d595e6ecb74471e1 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 13 Nov 2012 12:24:36 +0000 Subject: [PATCH] 2012-11-13 Sergio Martin * pandora_agent: Added several fields to the XML git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7143 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/unix/ChangeLog | 4 ++ pandora_agents/unix/pandora_agent | 96 +++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 6 deletions(-) diff --git a/pandora_agents/unix/ChangeLog b/pandora_agents/unix/ChangeLog index d109621936..b5ed236fe2 100644 --- a/pandora_agents/unix/ChangeLog +++ b/pandora_agents/unix/ChangeLog @@ -1,3 +1,7 @@ +2012-11-13 Sergio Martin + + * pandora_agent: Added several fields to the XML + 2012-08-28 Junichi Satoh * pandora_agent: Improved to be able to use CRLF in pandora_agent.conf. diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 600651c974..b117d2b598 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -360,7 +360,19 @@ sub parse_conf_modules($) { 'intensive_conditions' => [], 'intensive_match' => 0, 'timestamp' => 0, - 'unit' => '', + 'unit' => undef, + 'module_group' => undef, + 'custom_id' => undef, + 'str_warning' => undef, + 'str_critical' => undef, + 'critical_instructions' => undef, + 'warning_instructions' => undef, + 'unknown_instructions' => undef, + 'tags' => undef, + 'critical_inverse' => undef, + 'warning_inverse' => undef, + 'quiet' => undef, + 'module_ff_interval' => undef, 'macros' => {}, }; } elsif ($line =~ /^\s*module_name\s+(.+)$/) { @@ -517,10 +529,46 @@ sub parse_conf_modules($) { } elsif ($line =~ /^\s*module_min_ff_event\s+(.*)\s*$/) { $module->{'min_ff_event'} = $1; # Unit - } elsif ($line =~ /^\s*module_unit\s+(\S+)\s*$/) { + } elsif ($line =~ /^\s*module_unit\s+(.*)\s*$/) { $module->{'unit'} = $1; + # Module_group + } elsif ($line =~ /^\s*module_group\s+(\S+)\s*$/) { + $module->{'module_group'} = $1; + # Custom id + } elsif ($line =~ /^\s*module_custom_id\s+(.*)\s*$/) { + $module->{'custom_id'} = $1; + # Str warning + } elsif ($line =~ /^\s*module_str_warning\s+(.*)\s*$/) { + $module->{'str_warning'} = $1; + # Str critical + } elsif ($line =~ /^\s*module_str_critical\s+(.*)\s*$/) { + $module->{'str_critical'} = $1; + # Critical instructions + } elsif ($line =~ /^\s*module_critical_instructions\s+(.*)\s*$/) { + $module->{'critical_instructions'} = $1; + # Warning instructions + } elsif ($line =~ /^\s*module_warning_instructions\s+(.*)\s*$/) { + $module->{'warning_instructions'} = $1; + # Unknown instructions + } elsif ($line =~ /^\s*module_unknown_instructions\s+(.*)\s*$/) { + $module->{'unknown_instructions'} = $1; + # Tags + } elsif ($line =~ /^\s*module_tags\s+(.*)\s*$/) { + $module->{'tags'} = $1; + # Critical inverse + } elsif ($line =~ /^\s*module_critical_inverse\s+(\S+)\s*$/) { + $module->{'critical_inverse'} = $1; + # Warning inverse + } elsif ($line =~ /^\s*module_warning_inverse\s+(\S+)\s*$/) { + $module->{'warning_inverse'} = $1; + # Quiet + } elsif ($line =~ /^\s*module_quiet\s+(\S+)\s*$/) { + $module->{'quiet'} = $1; + # FF interval + } elsif ($line =~ /^\s*module_ff_interval\s+(\S+)\s*$/) { + $module->{'module_ff_interval'} = $1; # Macros - } elsif ($line =~ /^\s*module_macro(\S+)\s+(\S+)\s*$/) { + } elsif ($line =~ /^\s*module_macro(\S+)\s+(.*)\s*$/) { $module->{'macros'}{$1} = $2; } } @@ -1582,7 +1630,7 @@ sub write_module_xml ($@) { # Critical section $Sem->down () if (defined ($Sem)); - $Xml .= " \n" . + $Xml .= "\n" . " {'name'} . "]]>\n" . " {'description'} . "]]>\n" . " " . $module->{'type'} . "\n"; @@ -1618,8 +1666,44 @@ sub write_module_xml ($@) { $Xml .= " " . $module->{'min_ff_event'} . "\n" if (defined ($module->{'min_ff_event'})); # Unit - $Xml .= " " . $module->{'unit'} . "\n" if (defined ($module->{'unit'})); + $Xml .= " {'unit'} . "]]>\n" if (defined ($module->{'unit'})); + + # Module group + $Xml .= " " . $module->{'module_group'} . "\n" if (defined ($module->{'module_group'})); + + # Custom ID + $Xml .= " {'custom_id'} . "]]>\n" if (defined ($module->{'custom_id'})); + + # Str warning + $Xml .= " {'str_warning'} . "]]>\n" if (defined ($module->{'str_warning'})); + + # Str critical + $Xml .= " {'str_critical'} . "]]>\n" if (defined ($module->{'str_critical'})); + + # Critical instructions + $Xml .= " {'critical_instructions'} . "]]>\n" if (defined ($module->{'critical_instructions'})); + + # Warning instructions + $Xml .= " {'warning_instructions'} . "]]>\n" if (defined ($module->{'warning_instructions'})); + + # Unknown instructions + $Xml .= " {'unknown_instructions'} . "]]>\n" if (defined ($module->{'unknown_instructions'})); + + # Tags + $Xml .= " {'tags'} . "]]>\n" if (defined ($module->{'tags'})); + # Critical inverse + $Xml .= " " . $module->{'critical_inverse'} . "\n" if (defined ($module->{'critical_inverse'})); + + # Warning inverse + $Xml .= " " . $module->{'warning_inverse'} . "\n" if (defined ($module->{'warning_inverse'})); + + # Quiet + $Xml .= " " . $module->{'quiet'} . "\n" if (defined ($module->{'quiet'})); + + # Module FF interval + $Xml .= " " . $module->{'module_ff_interval'} . "\n" if (defined ($module->{'module_ff_interval'})); + # Data list if ($#data > 0) { $Xml .= " \n"; @@ -1633,7 +1717,7 @@ sub write_module_xml ($@) { chomp ($data[0]); $Xml .= " \n"; } - $Xml .= " \n"; + $Xml .= "\n"; $Sem->up () if (defined ($Sem)); }