From b166801619fef67c422fb9e8a43bfa5606e4050f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 21 Oct 2020 10:27:37 +0200 Subject: [PATCH] Continued: - ignore any console request MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- ctracker.php | 6 +++--- libs/lib_general.php | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ctracker.php b/ctracker.php index 132cd52..736c336 100644 --- a/ctracker.php +++ b/ctracker.php @@ -52,13 +52,13 @@ crackerTrackerUpdateDatabaseScheme(); // If it differs to original and the *whole* request string is not in whitelist // then block the attempt -if (isCrackerTrackerWormDetected()) { +if (!crackerTrackerIsConsole() && isCrackerTrackerWormDetected()) { // Send the email, this must be the last line in this if() block because it contains a exit() sendCrackerTrackerMail(); -} elseif (isCrackerTrackerPostAttackDetected()) { +} elseif (!crackerTrackerIsConsole() && isCrackerTrackerPostAttackDetected()) { // Send the email, this must be the last line in this if() block because it contains a exit() sendCrackerTrackerPostMail(); -} elseif ((getCrackerTrackerConfig('ctracker_alert_user') == 'Y') && (isCrackerTrackerIpSuspicious())) { +} elseif (!crackerTrackerIsConsole() && getCrackerTrackerConfig('ctracker_alert_user') == 'Y' && isCrackerTrackerIpSuspicious()) { // This IP is suspicious, so we alert him/her crackerTrackerAlertCurrentUser(); } // END - if diff --git a/libs/lib_general.php b/libs/lib_general.php index fa4643d..e20fa23 100644 --- a/libs/lib_general.php +++ b/libs/lib_general.php @@ -592,3 +592,7 @@ function unsetCtrackerData () { function crackerTrackerSanitize ($str) { return str_replace(array('//', '/./'), array('/', '/'), $str); } + +function crackerTrackerIsConsole () { + return (php_sapi_name() == 'cli'); +} -- 2.39.5