From: Roland Häder Date: Wed, 21 Oct 2020 08:27:37 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b166801619fef67c422fb9e8a43bfa5606e4050f;p=ctracker.git Continued: - ignore any console request Signed-off-by: Roland Häder --- 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'); +}