aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2014-01-02 02:36:52 -0800
committerErmal Luçi <eri@pfsense.org>2014-01-02 02:36:52 -0800
commit8950feb1d56407b3b5af01722a6db2f64020b25b (patch)
treebff9635d0657eeb61a6735ca707eaaab693cd8cc /config
parent5e3ebef13f2715fef8694b4fa34fd75e6ec4f40c (diff)
parent1816cf8bc9f6cab945acd52b7e632b24834de6e3 (diff)
downloadpfsense-packages-8950feb1d56407b3b5af01722a6db2f64020b25b.tar.gz
pfsense-packages-8950feb1d56407b3b5af01722a6db2f64020b25b.tar.bz2
pfsense-packages-8950feb1d56407b3b5af01722a6db2f64020b25b.zip
Merge pull request #567 from bmeeks8/master
Snort Alerts Dashboard Widget Package Update to 0.3.7
Diffstat (limited to 'config')
-rwxr-xr-xconfig/snort/snort_alerts.php2
-rw-r--r--config/widget-snort/snort_alerts.widget.php8
2 files changed, 5 insertions, 5 deletions
diff --git a/config/snort/snort_alerts.php b/config/snort/snort_alerts.php
index ede6cf9a..2b957f61 100755
--- a/config/snort/snort_alerts.php
+++ b/config/snort/snort_alerts.php
@@ -379,7 +379,7 @@ if ($pconfig['arefresh'] == 'on')
/* make sure alert file exists */
if (file_exists("/var/log/snort/snort_{$if_real}{$snort_uuid}/alert")) {
- exec("tail -{$anentries} /var/log/snort/snort_{$if_real}{$snort_uuid}/alert | sort -r > /tmp/alert_{$snort_uuid}");
+ exec("tail -{$anentries} -r /var/log/snort/snort_{$if_real}{$snort_uuid}/alert > /tmp/alert_{$snort_uuid}");
if (file_exists("/tmp/alert_{$snort_uuid}")) {
$tmpblocked = array_flip(snort_get_blocked_ips());
$counter = 0;
diff --git a/config/widget-snort/snort_alerts.widget.php b/config/widget-snort/snort_alerts.widget.php
index 691b03a3..ddf8ac59 100644
--- a/config/widget-snort/snort_alerts.widget.php
+++ b/config/widget-snort/snort_alerts.widget.php
@@ -35,9 +35,7 @@ global $config, $g;
function sksort(&$array, $subkey="id", $sort_ascending=false) {
/* an empty array causes sksort to fail - this test alleviates the error */
if(empty($array))
- {
- return false;
- }
+ return false;
if (count($array)) {
$temp_array[key($array)] = array_shift($array);
};
@@ -100,7 +98,9 @@ if (file_exists("/usr/local/pkg/snort/snort.inc")) {
continue;
$snort_alerts[$counter]['instanceid'] = $a_instance[$instanceid]['interface'];
- $snort_alerts[$counter]['timestamp'] = $fields[0];
+ // fields[0] is the timestamp. Reverse its date order to YY/MM/DD for proper sorting
+ $tmp = substr($fields[0],6,2) . '/' . substr($fields[0],0,2) . '/' . substr($fields[0],3,2);
+ $snort_alerts[$counter]['timestamp'] = str_replace(substr($fields[0],0,8),$tmp,$fields[0]);
$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];