From ff52b7477d0a55fe39c89c38d8b706395487d7a1 Mon Sep 17 00:00:00 2001 From: SunStroke74 Date: Fri, 26 Dec 2014 15:36:54 +0500 Subject: File to view HAVP error log File to render "Log" tab with HAVP error log contents. Need to be placed to /usr/local/www folder. --- config/havp/havp_log.php | 105 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 config/havp/havp_log.php (limited to 'config') diff --git a/config/havp/havp_log.php b/config/havp/havp_log.php new file mode 100644 index 00000000..60c02fbf --- /dev/null +++ b/config/havp/havp_log.php @@ -0,0 +1,105 @@ +. + Copyright (C) 2005 Bill Marquette . + Copyright (C) 2003-2004 Manuel Kasper . + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); + +if (file_exists("/usr/local/pkg/havp.inc")) + require_once("/usr/local/pkg/havp.inc"); +else echo "No havp.inc found"; + +$nentries = $config['syslog']['nentries']; +if (!$nentries) + $nentries = 50; + +if ($_POST['clear']) + file_put_contents(HVDEF_HAVP_ERRORLOG, ''); + +function dump_havp_errorlog($logfile, $tail) { + global $g, $config; + $sor = isset($config['syslog']['reverse']) ? "-r" : ""; + $logarr = ""; + $grepline = " "; + if (is_dir($logfile)) { + $logarr = array("File $logfile is a directory."); + } elseif(file_exists($logfile) && filesize($logfile) == 0) { + $logarr = array(" ... Log file is empty."); + } else { + exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); + } + foreach ($logarr as $logent) { + $logent = preg_split("/\s+/", $logent, 3); + echo "\n"; + $entry_date_time = htmlspecialchars($logent[0] . " " . $logent[1]); + $entry_text = htmlspecialchars($logent[2]); + echo "{$entry_date_time}\n"; + echo "{$entry_text}\n"; + echo "\n"; + } +} + +$pgtitle = "Antivirus: HAVP log"; +include("head.inc"); + +?> + + + + + + + + +
+ +
+
+ + + + + + +
+

+
+ " />
+
+
+ + + -- cgit v1.2.3 From ced59f94285b6aa3493113109b35a6ddf397639a Mon Sep 17 00:00:00 2001 From: SunStroke74 Date: Fri, 26 Dec 2014 15:39:06 +0500 Subject: Add tab to view HAVP error log --- config/havp/antivirus.php | 1 + 1 file changed, 1 insertion(+) (limited to 'config') diff --git a/config/havp/antivirus.php b/config/havp/antivirus.php index 0d8cda1d..f86982e5 100644 --- a/config/havp/antivirus.php +++ b/config/havp/antivirus.php @@ -199,6 +199,7 @@ if (pfsense_version_A() == '1') { $tab_array[] = array(gettext("General page"), true, "antivirus.php"); $tab_array[] = array(gettext("HTTP proxy"), false, "pkg_edit.php?xml=havp.xml&id=0"); $tab_array[] = array(gettext("Settings"), false, "pkg_edit.php?xml=havp_avset.xml&id=0"); + $tab_array[] = array(gettext("Log"), false, "havp_log.php"); display_top_tabs($tab_array); ?> -- cgit v1.2.3 From 55ad40d87613791b3162cb940af7657d71869332 Mon Sep 17 00:00:00 2001 From: SunStroke74 Date: Fri, 26 Dec 2014 15:40:33 +0500 Subject: Add tab to view HAVP error log --- config/havp/havp.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/havp/havp.xml b/config/havp/havp.xml index 47611030..3e12f5bb 100644 --- a/config/havp/havp.xml +++ b/config/havp/havp.xml @@ -55,6 +55,10 @@ Settings /pkg_edit.php?xml=havp_avset.xml&id=0 + + Log + /havp_log.php + @@ -302,4 +306,4 @@ havp_deinstall(); - \ No newline at end of file + -- cgit v1.2.3 From 84b3a11f20b2030ef856622be4e1bcc5dabc1927 Mon Sep 17 00:00:00 2001 From: SunStroke74 Date: Fri, 26 Dec 2014 15:41:40 +0500 Subject: Update havp_avset.xml --- config/havp/havp_avset.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/havp/havp_avset.xml b/config/havp/havp_avset.xml index 3d4372f4..1b0d5c5d 100644 --- a/config/havp/havp_avset.xml +++ b/config/havp/havp_avset.xml @@ -23,6 +23,10 @@ /pkg_edit.php?xml=havp_avset.xml&id=0 + + Log + /havp_log.php + @@ -104,4 +108,4 @@ - \ No newline at end of file + -- cgit v1.2.3