ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
11 require_once "Services/VirusScanner/classes/class.ilVirusScanner.php";
12 
14 {
20  public function __construct($a_scancommand, $a_cleancommand)
21  {
22  parent::__construct($a_scancommand, $a_cleancommand);
23  $this->type = "antivir";
24  $this->scanZipFiles = true;
25  }
26 
34  public function scanFile($a_filepath, $a_origname = "")
35  {
36  // This function should:
37  // - call the external scanner for a_filepath
38  // - set scanFilePath to a_filepath
39  // - set scanFileOrigName to a_origname
40  // - set scanFileIsInfected according the scan result
41  // - set scanResult to the scanner output message
42  // - call logScanResult() if file is infected
43  // - return the scanResult, if file is infected
44  // - return an empty string, if file is not infected
45 
46  $this->scanFilePath = $a_filepath;
47  $this->scanFileOrigName = $a_origname;
48 
49  // Call of antivir command
50  $cmd = $this->scanCommand . " " . $a_filepath . " ";
51  exec($cmd, $out, $ret);
52  $this->scanResult = implode("\n", $out);
53 
54  // sophie could be called
55  if (preg_match('/ALERT:/', $this->scanResult)) {
56  $this->scanFileIsInfected = true;
57  $this->logScanResult();
58  return $this->scanResult;
59  } else {
60  $this->scanFileIsInfected = false;
61  return "";
62  }
63 
64  // antivir has failed (todo)
65  $this->log->write("ERROR (Virus Scanner failed): "
66  . $this->scanResult
67  . "; COMMAMD=" . $cmd);
68  }
69 }
Interface to the AntiVir virus protector.
scanFile($a_filepath, $a_origname="")
scan a file for viruses
logScanResult()
write the result of the last scan to the log public
__construct($a_scancommand, $a_cleancommand)
Constructor public.
Base class for the interface to an external virus scanner This class is abstract and needs to be exte...
$ret
Definition: parser.php:6