aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-10-07 23:18:37 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-10-07 23:18:37 +0000
commit538b98941fab76c8673f7eb5178b03982f48cd31 (patch)
treee423102c6c3cea54974ba09127fdbfb47207c3e9
parentfdbf66d2810f301430b231609089d080dbbc5635 (diff)
downloadpfsense-packages-538b98941fab76c8673f7eb5178b03982f48cd31.tar.gz
pfsense-packages-538b98941fab76c8673f7eb5178b03982f48cd31.tar.bz2
pfsense-packages-538b98941fab76c8673f7eb5178b03982f48cd31.zip
Make snort alerts clickable
-rw-r--r--packages/snort/snort.inc10
-rw-r--r--packages/snort/snort_alerts.php6
2 files changed, 15 insertions, 1 deletions
diff --git a/packages/snort/snort.inc b/packages/snort/snort.inc
index f13e2990..fd27ad49 100644
--- a/packages/snort/snort.inc
+++ b/packages/snort/snort.inc
@@ -503,4 +503,14 @@ function get_snort_alert($ip) {
return "n/a";
}
+function make_clickable($buffer) {
+ $buffer = eregi_replace("(^|[ \n\r\t])((http(s?)://)(www\.)?([a-z0-9_-]+(\.[a-z0-9_-]+)+)(/[^/ \n\r]*)*)","\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $buffer);
+ $buffer = eregi_replace("(^|[ \n\r\t])((ftp://)(www\.)?([a-z0-9_-]+(\.[a-z0-9_-]+)+)(/[^/ \n\r]*)*)","\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $buffer);
+ $buffer = eregi_replace("([a-z_-][a-z0-9\._-]*@[a-z0-9_-]+(\.[a-z0-9_-]+)+)","<a href=\"mailto:\\1\">\\1</a>", $buffer);
+ $buffer = eregi_replace("(^|[ \n\r\t])(www\.([a-z0-9_-]+(\.[a-z0-9_-]+)+)(/[^/ \n\r]*)*)","\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $buffer);
+ $buffer = eregi_replace("(^|[ \n\r\t])(ftp\.([a-z0-9_-]+(\.[a-z0-9_-]+)+)(/[^/ \n\r]*)*)","\\1<a href=\"ftp://\\2\" target=\"_blank\">\\2</a>", $buffer);
+
+ return $buffer;
+}
+
?> \ No newline at end of file
diff --git a/packages/snort/snort_alerts.php b/packages/snort/snort_alerts.php
index 81fe4bf3..dfa20b68 100644
--- a/packages/snort/snort_alerts.php
+++ b/packages/snort/snort_alerts.php
@@ -32,6 +32,7 @@
require("globals.inc");
require("guiconfig.inc");
+require("/usr/local/pkg/snort.inc");
$snort_logfile = "{$g['varlog_path']}/snort/alert";
@@ -101,8 +102,11 @@ function dump_log_file($logfile, $tail, $withorig = true, $grepfor = "", $grepin
foreach ($logarr as $logent) {
if(!logent)
continue;
+ $ww_logent = $logent;
+ $ww_logent = str_replace("[", " [ ", $ww_logent);
+ $ww_logent = str_replace("]", " ] ", $ww_logent);
echo "<tr valign=\"top\">\n";
- echo "<td colspan=\"2\" class=\"listr\">" . $logent . "&nbsp;</td>\n";
+ echo "<td colspan=\"2\" class=\"listr\">" . make_clickable($ww_logent) . "&nbsp;</td>\n";
echo "</tr>\n";
}
}