11 require_once
"./Services/VirusScanner/classes/class.ilVirusScanner.php";
25 $this->type =
"clamav";
26 $this->scanZipFiles =
true;
34 return ' ' . self::ADD_SCAN_PARAMS .
' ' . $file;
42 $functions = array(
'proc_open',
'proc_close');
44 foreach ($functions as $func) {
45 if (function_exists($func)) {
74 $descriptorspec = array(
75 0 => array(
"pipe",
"r"),
76 1 => array(
"pipe",
"w"),
77 2 => array(
"pipe",
"w")
86 if (!is_resource($process)) {
90 fwrite($pipes[0], $buffer);
93 $detectionReport = stream_get_contents($pipes[1]);
96 $errorReport = stream_get_contents($pipes[2]);
99 $return = proc_close($process);
110 return preg_match(
"/FOUND/", $detectionReport);
120 public function scanFile($a_filepath, $a_origname =
"")
132 $this->scanFilePath = $a_filepath;
133 $this->scanFileOrigName = $a_origname;
135 $perm = fileperms($a_filepath) | 0640;
136 chmod($a_filepath, $perm);
139 $a_filepath = realpath($a_filepath);
140 if(file_exists($a_filepath)) {
145 $this->scanResult = implode(
"\n",
$out);
149 $this->scanFileIsInfected =
true;
153 $this->scanFileIsInfected =
false;
158 $this->log->write(
"ERROR (Virus Scanner failed): " 160 .
"; Path=" . $a_filepath);
hasDetections($detectionReport)
logScanResult()
write the result of the last scan to the log public
__construct($a_scancommand, $a_cleancommand)
Constructor public.
scanFile($a_filepath, $a_origname="")
scan a file for viruses
static escapeShellCmd($a_arg)
escape shell cmd
scanFileFromBuffer($buffer)
Interface to the ClamAV virus protector.
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
Base class for the interface to an external virus scanner This class is abstract and needs to be exte...
buildScanCommandArguments($file='-')
static escapeShellArg($a_arg)
__construct(Container $dic, ilPlugin $plugin)
processBufferScan($buffer)