Skip to content

Commit

Permalink
fix: summary whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocesarato committed Oct 6, 2020
1 parent 2d85826 commit f2a7d67
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Application.php
Expand Up @@ -846,7 +846,7 @@ private function scan($iterator)
if (strpos($_FILE_PATH, $item['file']) !== false &&
$match === $item['match'] &&
$exploit === $item['exploit'] &&
(self::$settings['whitelist-only-path'] || (!self::$settings['whitelist-only-path'] && $lineNumber == $item['line']))) {
(self::isOnlyPathWhitelistMode() || (!self::isOnlyPathWhitelistMode() && $lineNumber == $item['line']))) {
$in_whitelist++;
}
}
Expand All @@ -859,7 +859,7 @@ private function scan($iterator)

if (realpath($_FILE_PATH) != realpath(__FILE__) && ($is_favicon || !empty($pattern_found)) && ($in_whitelist === 0 || $in_whitelist != count($pattern_found))) {
self::$report['detected']++;
if (self::$settings['report']) {
if (self::isReportMode()) {
// Scan mode only
self::$report['ignored'][] = 'File: ' . $_FILE_PATH . PHP_EOL .
'Exploits:' . PHP_EOL .
Expand Down Expand Up @@ -1060,7 +1060,7 @@ private function summary()
Console::displayTitle('SUMMARY', 'black', 'cyan');
Console::writeBreak();
Console::writeLine('Files scanned: ' . self::$report['scanned']);
if (!self::$settings['report']) {
if (!self::isReportMode()) {
self::$report['ignored'] = array_unique(self::$report['ignored']);
self::$report['edited'] = array_unique(self::$report['edited']);
Console::writeLine('Files edited: ' . count(self::$report['edited']));
Expand All @@ -1073,7 +1073,7 @@ private function summary()
Console::writeLine('Malware removed: ' . count(self::$report['removed']));
}

if (self::$settings['report']) {
if (self::isReportMode()) {
Console::writeLine(Console::eol(1) . "Files infected: '" . self::$pathLogsInfected . "'", 1, 'red');
file_put_contents(self::$pathLogsInfected, 'Log date: ' . date('d-m-Y H:i:s') . Console::eol(1) . implode(Console::eol(2), self::$report['ignored']));
Console::writeBreak(2);
Expand All @@ -1099,7 +1099,7 @@ private function summary()
Console::writeLine($un);
}
}
if (count(self::$report['quarantine']) > 0) {
if (count(self::$report['whitelist']) > 0) {
Console::writeBreak();
Console::writeLine('Files whitelisted:', 1, 'cyan');
foreach (self::$report['whitelist'] as $un) {
Expand Down

0 comments on commit f2a7d67

Please sign in to comment.