ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
14require_once "Services/VirusScanner/classes/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?>
Interface to the AntiVir virus protector.
ilVirusScannerAntivir($a_scancommand, $a_cleancommand)
Constructor @access public.
scanFile($a_filepath, $a_origname="")
scan a file for viruses
Base class for the interface to an external virus scanner.
logScanResult()
write the result of the last scan to the log
ilVirusScanner($a_scancommand, $a_cleancommand)
Constructor @access public.
$cmd
Definition: sahs_server.php:35