aboutsummaryrefslogtreecommitdiffstats
path: root/config/widget-snort
diff options
context:
space:
mode:
authorbmeeks8 <bmeeks8@bellsouth.net>2013-04-23 22:03:25 -0400
committerbmeeks8 <bmeeks8@bellsouth.net>2013-04-23 22:03:25 -0400
commit02b50f05c58c17b8fff6b9b47e04cda0cb64dbfc (patch)
treef1fef818c0fb1085dd410874fffc7045f26eb2eb /config/widget-snort
parente6ddbc6805970912ba7550e782db3de7506fdae2 (diff)
downloadpfsense-packages-02b50f05c58c17b8fff6b9b47e04cda0cb64dbfc.tar.gz
pfsense-packages-02b50f05c58c17b8fff6b9b47e04cda0cb64dbfc.tar.bz2
pfsense-packages-02b50f05c58c17b8fff6b9b47e04cda0cb64dbfc.zip
Add uninstall function to Snort Dashboard Widget and bump version.
Diffstat (limited to 'config/widget-snort')
-rw-r--r--config/widget-snort/snort_alerts.widget.php1
-rw-r--r--config/widget-snort/widget-snort.inc28
-rw-r--r--config/widget-snort/widget-snort.xml11
3 files changed, 38 insertions, 2 deletions
diff --git a/config/widget-snort/snort_alerts.widget.php b/config/widget-snort/snort_alerts.widget.php
index 3c41dd54..e488bc49 100644
--- a/config/widget-snort/snort_alerts.widget.php
+++ b/config/widget-snort/snort_alerts.widget.php
@@ -90,7 +90,6 @@ if (file_exists("/usr/local/pkg/snort/snort.inc")) {
$snort_alerts[$counter]['instanceid'] = $a_instance[$instanceid]['interface'];
$snort_alerts[$counter]['timestamp'] = $fields[0];
- /* Look for the dash separating date and time so we can handle entries with year in them */
$snort_alerts[$counter]['timeonly'] = substr($fields[0], strpos($fields[0], '-')+1, -8);
$snort_alerts[$counter]['dateonly'] = substr($fields[0], 0, strpos($fields[0], '-'));
$snort_alerts[$counter]['src'] = $fields[6];
diff --git a/config/widget-snort/widget-snort.inc b/config/widget-snort/widget-snort.inc
new file mode 100644
index 00000000..b33059e4
--- /dev/null
+++ b/config/widget-snort/widget-snort.inc
@@ -0,0 +1,28 @@
+<?php
+
+require_once("guiconfig.inc");
+require_once("config.inc");
+
+function widget_snort_uninstall() {
+
+ global $config;
+
+ /* Remove the Snort widget from the Dashboard display list */
+ $widgets = $config['widgets']['sequence'];
+ if (!empty($widgets)) {
+ $widgetlist = explode(",", $widgets);
+ foreach ($widgetlist as $key => $widget) {
+ if (strstr($widget, "snort_alerts-container"))
+ unset($widgetlist[$key]);
+ }
+ $config['widgets']['sequence'] = implode(",", $widgetlist);
+ write_config();
+ }
+
+ /* Remove our associated file */
+ unlink("/usr/local/www/widgets/include/widget-snort.inc");
+ unlink("/usr/local/www/widgets/widgets/snort_alerts.widget.php");
+ unlink("/usr/local/www/widgets/javascript/snort_alerts.js");
+}
+
+?>
diff --git a/config/widget-snort/widget-snort.xml b/config/widget-snort/widget-snort.xml
index f677eee4..ef89c1bb 100644
--- a/config/widget-snort/widget-snort.xml
+++ b/config/widget-snort/widget-snort.xml
@@ -46,8 +46,9 @@
<requirements>Dashboard package and Snort</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>widget-snort</name>
- <version>1.0</version>
+ <version>0.3.3</version>
<title>Widget - Snort</title>
+ <include_file>/usr/local/www/widgets/include/widget-snort.inc</include_file>
<additional_files_needed>
<prefix>/usr/local/www/widgets/javascript/</prefix>
<chmod>0644</chmod>
@@ -58,4 +59,12 @@
<chmod>0644</chmod>
<item>http://www.pfsense.com/packages/config/widget-snort/snort_alerts.widget.php</item>
</additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/www/widgets/include/</prefix>
+ <chmod>0644</chmod>
+ <item>http://www.pfsense.com/packages/config/widget-snort/widget-snort.inc</item>
+ </additional_files_needed>
+ <custom_php_deinstall_command>
+ widget_snort_uninstall();
+ </custom_php_deinstall_command>
</packagegui>