19 declare(strict_types=1);
23 public function __construct(
string $scan_command,
string $clean_command)
26 $this->type =
"sophos";
27 $this->scanZipFiles =
true;
30 public function scanFile(
string $file_path,
string $org_name =
""): string
32 $this->scanFilePath = $file_path;
33 $this->scanFileOrigName = $org_name;
37 $a_filepath = realpath($file_path);
40 $cmd = $cmd .
" " . $args .
" 2>&1";
41 exec($cmd,
$out, $ret);
42 $this->scanResult = implode(
"\n",
$out);
45 if ((
int) $ret === 0) {
46 if (preg_match(
"/FILE INFECTED/", $this->scanResult)) {
47 $this->scanFileIsInfected =
true;
52 $this->scanFileIsInfected =
false;
57 $this->log->write(
"ERROR (Virus Scanner failed): " 59 .
"; COMMAMD=" . $cmd);
65 $cmd = $this->cleanCommand .
" -ss -archive " . $file_path .
" 2>&1";
66 exec($cmd,
$out, $ret);
67 $this->scanResult = implode(
"\n",
$out) .
" [" . $ret .
"]";
74 if ((
int) $ret === 0) {
75 $this->cleanFileIsCleaned =
false;
77 } elseif ((
int) $ret === 3) {
78 $this->scanFileIsInfected =
true;
83 $this->error->raiseError(
84 $this->
lng->txt(
"virus_scan_error") .
" " 85 . $this->
lng->txt(
"virus_scan_message") .
" " 91 public function cleanFile(
string $file_path,
string $org_name =
""): string
93 $this->cleanFilePath = $file_path;
94 $this->cleanFileOrigName = $org_name;
103 $cmd = $this->cleanCommand .
" -di -nc -ss -eec -archive " . $file_path .
" 2>&1";
104 exec($cmd,
$out, $ret);
105 $this->cleanResult = implode(
"\n",
$out) .
" [" . $ret .
"]";
121 if ((
int) $ret === 20) {
122 $this->cleanFileIsCleaned =
true;
126 $this->cleanFileIsCleaned =
false;
scanFile(string $file_path, string $org_name="")
__construct(string $scan_command, string $clean_command)
cleanFile(string $file_path, string $org_name="")
static escapeShellArg(string $a_arg)
static escapeShellCmd(string $a_arg)
__construct(Container $dic, ilPlugin $plugin)