ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilVirusScannerAntiVir.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 
14 require_once "class.ilVirusScanner.php";
15 
17 {
23  function ilVirusScannerAntivir($a_scancommand, $a_cleancommand)
24  {
25  $this->ilVirusScanner($a_scancommand, $a_cleancommand);
26  $this->type = "antivir";
27  $this->scanZipFiles = true;
28  }
29 
38  function scanFile($a_filepath, $a_origname = "")
39  {
40  // This function should:
41  // - call the external scanner for a_filepath
42  // - set scanFilePath to a_filepath
43  // - set scanFileOrigName to a_origname
44  // - set scanFileIsInfected according the scan result
45  // - set scanResult to the scanner output message
46  // - call logScanResult() if file is infected
47  // - return the scanResult, if file is infected
48  // - return an empty string, if file is not infected
49 
50  $this->scanFilePath = $a_filepath;
51  $this->scanFileOrigName = $a_origname;
52 
53  // Call of antivir command
54  $cmd = $this->scanCommand . " " . $a_filepath. " ";
55  exec($cmd, $out, $ret);
56  $this->scanResult = implode("\n", $out);
57 
58  // sophie could be called
59  if (ereg("ALERT:", $this->scanResult))
60  {
61  $this->scanFileIsInfected = true;
62  $this->logScanResult();
63  return $this->scanResult;
64  }
65  else
66  {
67  $this->scanFileIsInfected = false;
68  return "";
69  }
70 
71  // antivir has failed (todo)
72  $this->log->write("ERROR (Virus Scanner failed): "
73  . $this->scanResult
74  . "; COMMAMD=" . $cmd);
75 
76  }
77 
78 
79 }
80 ?>