diff --git a/scan.php b/scan.php index 2e2577d..647ce94 100644 --- a/scan.php +++ b/scan.php @@ -2,13 +2,13 @@ /* * Copyright (c) 2016 Gabor Gyorvari - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,6 +31,7 @@ class MalwareScanner private $flagChecksum = false; private $flagComments = false; private $flagHideOk = false; + private $flagHideErr = false; private $flagHideWhitelist = false; private $flagNoStop = false; private $flagPattern = false; @@ -298,6 +299,9 @@ class MalwareScanner if (isset($options['hide-ok']) || isset($options['k'])) { $this->setFlagHideOk(true); } + if (isset($options['hide-err']) || isset($options['r'])) { + $this->setFlagHideErr(true); + } if (isset($options['hide-whitelist']) || isset($options['w'])) { $this->setFlagHideWhitelist(true); } @@ -396,6 +400,11 @@ class MalwareScanner $this->flagHideOk = $b; } + public function setFlagHideErr($b) + { + $this->flagHideErr = $b; + } + public function setFlagHideWhitelist($b) { $this->flagHideWhitelist = $b; @@ -490,6 +499,9 @@ class MalwareScanner $state = 'WL'; $state_color = $this->ANSI_YELLOW; } else { + if ($this->flagHideErr) { + return; + } $state = 'ER'; $state_color = $this->ANSI_RED; } @@ -820,6 +832,7 @@ class MalwareScanner echo ' -x --extra-check Adds GoogleBot and htaccess to Scan List' . PHP_EOL; echo ' -l --follow-symlink Follow symlinked directories' . PHP_EOL; echo ' -k --hide-ok Hide results with \'OK\' status' . PHP_EOL; + echo ' -r --hide-err Hide results with \'ER\' status' . PHP_EOL; echo ' -w --hide-whitelist Hide results with \'WL\' status' . PHP_EOL; echo ' -n --no-color Disable color mode' . PHP_EOL; echo ' -s --no-stop Continue scanning file after first hit' . PHP_EOL;