Copyright (C) 2014 Andrew Nikitin . Copyright (C) 2015 ESF, LLC 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_once("guiconfig.inc"); require_once("pkg-utils.inc"); require_once("service-utils.inc"); require_once("/usr/local/pkg/havp.inc"); $pgtitle = "Antivirus: General page"; include("head.inc"); define('PATH_CLAMDB', '/var/db/clamav'); define('PATH_HAVPLOG', '/var/log/havp/access.log'); define('PATH_AVSTATUS', '/var/tmp/havp.status'); function get_avdb_info() { $r = ''; $path = PATH_CLAMDB . "/{$filename}"; $fl = get_dir(PATH_CLAMDB . "/"); array_shift($fl); array_shift($fl); foreach ($fl as $fname) { $path = PATH_CLAMDB . "/{$fname}"; $ext = end(explode(".", $fname)); if ($ext == "cvd" || $ext == "cld") { $stl = "style='padding-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 4px; border-left: 1px solid #999999;'"; if (file_exists($path)) { $handle = ''; if ($handle = fopen($path, "r")) { $fsize = sprintf("%.2f M", filesize($path)/1024/1024); $s = fread($handle, 1024); $s = explode(':', $s); // datetime $dt = explode(" ", $s[1]); $s[1] = strftime("%Y.%m.%d", strtotime("{$dt[0]} {$dt[1]} {$dt[2]}")); if ($s[0] == 'ClamAV-VDB') { $r .= "{$fname}{$s[1]}$fsize{$s[2]}{$s[3]}{$s[7]}"; } } fclose($handle); } } } return $r; } function get_av_statistic() { return function_exists("havp_get_av_statistic") ? havp_get_av_statistic() : "Function 'havp_get_av_statistic' not found."; } function get_av_viruslog() { return function_exists("havp_get_av_viruslog") ? havp_get_av_viruslog() : "Function 'havp_get_av_viruslog' not found."; } function get_scanlist() { return function_exists("havp_get_filescanlist") ? havp_get_filescanlist() : "Function 'havp_get_filescanlist()' not found."; } function get_scan_log() { $s = function_exists("havp_get_scan_log") ? havp_get_scan_log() : "Function 'havp_get_scan_log()' not found."; $s = str_replace("\n", "
", $s); return $s; } function havp_status() { $s = ""; if (HVDEF_HAVP_STATUS_FILE && file_exists(HVDEF_HAVP_STATUS_FILE)) { $s = file_get_contents(HVDEF_HAVP_STATUS_FILE); } return $s; } function clamd_status() { $s = ""; if (HVDEF_CLAM_STATUS_FILE && file_exists(HVDEF_CLAM_STATUS_FILE)) { $s = file_get_contents(HVDEF_CLAM_STATUS_FILE); } return $s; } function avupdate_status() { $s = "Not found."; if (HVDEF_UPD_STATUS_FILE && file_exists(HVDEF_UPD_STATUS_FILE)) { $s = file_get_contents(HVDEF_UPD_STATUS_FILE); } return str_replace( "\n", "
", $s ); } /* ------------------------------------------------------------------------------ */ /* Start service */ if ($_POST['start'] != '') { // start_service($_POST['start']); if (file_exists(HVDEF_HAVP_STARTUP_SCRIPT)) { mwexec_bg (HVDEF_HAVP_STARTUP_SCRIPT . " start"); sleep(3); } /* Restart service */ } elseif ($_POST['restart'] != '') { // restart_service($_POST['restart']); if (file_exists(HVDEF_HAVP_STARTUP_SCRIPT)) { mwexec_bg (HVDEF_HAVP_STARTUP_SCRIPT . " restart"); sleep(3); } /* Stop service */ } elseif ($_POST['stop'] != '') { // stop_service($_POST['stop']); if (file_exists(HVDEF_HAVP_STARTUP_SCRIPT)) { mwexec_bg (HVDEF_HAVP_STARTUP_SCRIPT . " stop"); sleep(3); } } /* Scan start */ if ($_POST['scanpath'] != '') { $scandir = $_POST['scanpath']; if (function_exists("start_antivirus_scanner")) { start_antivirus_scanner($scandir); } } /* Start AV Update */ if ($_POST['startupdate'] != '') { if (function_exists("havp_update_AV")) { havp_update_AV(); } } /* Clear havp access log */ if ($_POST['clearlog_x'] != '') { file_put_contents(HVDEF_HAVP_ACCESSLOG, ''); } /* ------------------------------------------------------------------------------ */ ?>
Service Status   Version
HTTP Antivirus Proxy ( )
Running"; } else { echo "\"\" Stopped"; } ?>
"; echo " "; echo ""; } else { echo ""; } ?>
Antivirus Server ( )
Running"; } else { echo "\"\" Stopped"; } ?>
 
 
Antivirus Update Update Status
"; ?>  Start Update
Antivirus Base Info
Database Date Size Ver. Signatures Builder
 
File Scanner Scanner Status
 Path:

 Enter file path or catalog for scanning.
\n"; echo "\n"; echo "{$scan['descr']}\n"; echo ""; echo "
"; } } ?>
"; ?>  Start Scanner
 
"; $count--; } } else { echo ""; } ?>
Last Viruses
{$ln[0]} {$ln[1]}{$ln[2]}{$ln[5]}{$ln[9]}
Not found
"; ?> Clear log