• Main Page
  • Related Pages
  • Modules
  • 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 
00034 require_once "class.ilVirusScanner.php";
00035 
00036 class ilVirusScannerAntiVir extends ilVirusScanner
00037 {
00043         function ilVirusScannerAntivir($a_scancommand, $a_cleancommand)
00044         {
00045                 $this->ilVirusScanner($a_scancommand, $a_cleancommand);
00046                 $this->type = "antivir";
00047                 $this->scanZipFiles = true;
00048         }
00049 
00058         function scanFile($a_filepath, $a_origname = "")
00059         {
00060                 // This function should:
00061                 // - call the external scanner for a_filepath
00062                 // - set scanFilePath to a_filepath
00063                 // - set scanFileOrigName to a_origname
00064                 // - set scanFileIsInfected according the scan result
00065                 // - set scanResult to the scanner output message
00066                 // - call logScanResult() if file is infected
00067                 // - return the scanResult, if file is infected
00068                 // - return an empty string, if file is not infected
00069 
00070                 $this->scanFilePath = $a_filepath;
00071                 $this->scanFileOrigName = $a_origname;
00072 
00073                 // Call of antivir command
00074                 $cmd = $this->scanCommand . " " . $a_filepath. " 2>&1";
00075                 exec($cmd, $out, $ret);
00076                 $this->scanResult = implode("\n", $out);
00077 
00078                 // sophie could be called
00079                 if (ereg("ALERT:", $this->scanResult))
00080                 {
00081                         $this->scanFileIsInfected = true;
00082                         $this->logScanResult();
00083                         return $this->scanResult;
00084                 }
00085                 else
00086                 {
00087                         $this->scanFileIsInfected = false;
00088                         return "";
00089                 }
00090 
00091                 // antivir has failed (todo)
00092                 $this->log->write("ERROR (Virus Scanner failed): "
00093                                                 . $this->scanResult
00094                                                 . "; COMMAMD=" . $cmd);
00095 
00096         }
00097 
00098 
00099 }
00100 ?>

Generated on Fri Dec 13 2013 17:56:48 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1