Pattern Loading Moved To Constructor

It makes more sense to put the one time pattern load code into the constructor rather than the scan method.
This commit is contained in:
nichogenius
2017-08-16 01:39:44 -06:00
committed by GitHub
parent 575278613e
commit 1909eb0781

View File

@@ -44,7 +44,11 @@ class MalwareScanner
public function __construct()
{
$options = getopt('he:i:kwxd:lv', array('help', 'extension:', 'ignore:', 'hide-ok', 'hide-whitelist', 'extra-check', 'directory:', 'follow-symlink', 'verbose'));
$this->patterns_raw = $this->loadPatterns(dirname(__FILE__) . '/patterns_raw.txt');
$this->patterns_iraw = $this->loadPatterns(dirname(__FILE__) . '/patterns_iraw.txt');
$this->patterns_re = $this->loadPatterns(dirname(__FILE__) . '/patterns_re.txt');
$options = getopt('he:i:kwxd:lv', array('help', 'extension:', 'ignore:', 'hide-ok', 'hide-whitelist', 'extra-check', 'directory:', 'follow-symlink', 'verbose'));
if (isset($options['help']) || isset($options['h'])) {
$this->showHelp();
exit;
@@ -174,9 +178,6 @@ class MalwareScanner
$found = false;
$hash = '';
$toSearch = '';
$this->patterns_raw = $this->loadPatterns(dirname(__FILE__) . '/patterns_raw.txt');
$this->patterns_iraw = $this->loadPatterns(dirname(__FILE__) . '/patterns_iraw.txt');
$this->patterns_re = $this->loadPatterns(dirname(__FILE__) . '/patterns_re.txt');
if ($this->extraCheck) {
array_push($this->patterns_raw, "googleBot", "htaccess");