ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilVirusScannerAntiVir.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 public function __construct(string $scan_command, string $clean_command)
24 {
25 parent::__construct($scan_command, $clean_command);
26 $this->type = 'antivir';
27 $this->scanZipFiles = true;
28 }
29
30 public function scanFile(string $file_path, string $org_name = ''): string
31 {
32 $this->scanFilePath = $file_path;
33 $this->scanFileOrigName = $org_name;
34
35 // Call of antivir command
36 $a_filepath = realpath($file_path);
37 $cmd = ilShellUtil::escapeShellCmd($this->scanCommand);
38 $args = ilShellUtil::escapeShellArg(' ' . $a_filepath . ' ');
39 $out = ilShellUtil::execQuoted($cmd, $args);
40 $this->scanResult = implode("\n", $out);
41
42 // sophie could be called
43 if (str_contains($this->scanResult, 'ALERT:')) {
44 $this->scanFileIsInfected = true;
45 $this->logScanResult();
46 return $this->scanResult;
47 }
48
49 $this->scanFileIsInfected = false;
50 return '';
51 }
52}
$out
Definition: buildRTE.php:24
static escapeShellArg(string $a_arg)
static escapeShellCmd(string $a_arg)
static execQuoted(string $cmd, ?string $args=null)
__construct(string $scan_command, string $clean_command)
scanFile(string $file_path, string $org_name='')
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc