mirror of
https://github.com/scr34m/php-malware-scanner.git
synced 2026-06-16 12:30:35 +00:00
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:
9
scan.php
9
scan.php
@@ -44,7 +44,11 @@ class MalwareScanner
|
|||||||
|
|
||||||
public function __construct()
|
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'])) {
|
if (isset($options['help']) || isset($options['h'])) {
|
||||||
$this->showHelp();
|
$this->showHelp();
|
||||||
exit;
|
exit;
|
||||||
@@ -174,9 +178,6 @@ class MalwareScanner
|
|||||||
$found = false;
|
$found = false;
|
||||||
$hash = '';
|
$hash = '';
|
||||||
$toSearch = '';
|
$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) {
|
if ($this->extraCheck) {
|
||||||
array_push($this->patterns_raw, "googleBot", "htaccess");
|
array_push($this->patterns_raw, "googleBot", "htaccess");
|
||||||
|
|||||||
Reference in New Issue
Block a user