• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilVirusScannerAntiVir.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2005 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 
00035 require_once "class.ilVirusScanner.php";
00036 
00037 class ilVirusScannerAntiVir extends ilVirusScanner
00038 {
00044         function ilVirusScannerAntivir($a_scancommand, $a_cleancommand)
00045         {
00046                 $this->ilVirusScanner($a_scancommand, $a_cleancommand);
00047                 $this->type = "antivir";
00048                 $this->scanZipFiles = true;
00049         }
00050 
00059         function scanFile($a_filepath, $a_origname = "")
00060         {
00061                 // This function should:
00062                 // - call the external scanner for a_filepath
00063                 // - set scanFilePath to a_filepath
00064                 // - set scanFileOrigName to a_origname
00065                 // - set scanFileIsInfected according the scan result
00066                 // - set scanResult to the scanner output message
00067                 // - call logScanResult() if file is infected
00068                 // - return the scanResult, if file is infected
00069                 // - return an empty string, if file is not infected
00070 
00071                 $this->scanFilePath = $a_filepath;
00072                 $this->scanFileOrigName = $a_origname;
00073 
00074                 // Call of antivir command
00075                 $cmd = $this->scanCommand . " " . $a_filepath. " 2>&1";
00076                 exec($cmd, $out, $ret);
00077                 $this->scanResult = implode("\n", $out);
00078 
00079                 // sophie could be called
00080                 if (ereg("ALERT:", $this->scanResult))
00081                 {
00082                         $this->scanFileIsInfected = true;
00083                         $this->logScanResult();
00084                         return $this->scanResult;
00085                 }
00086                 else
00087                 {
00088                         $this->scanFileIsInfected = false;
00089                         return "";
00090                 }
00091 
00092                 // antivir has failed (todo)
00093                 $this->log->write("ERROR (Virus Scanner failed): "
00094                                                 . $this->scanResult
00095                                                 . "; COMMAMD=" . $cmd);
00096 
00097         }
00098 
00099 
00100 }
00101 ?>

Generated on Fri Dec 13 2013 09:06:35 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1