From 9a0c56a82fd90fb9c043655d1d0c51970846f5a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 4 Nov 2020 13:09:16 +0100 Subject: [PATCH] Continued: - tpzos fiexed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- libs/lib_detector.php | 2 +- libs/lib_updates.php | 28 ++++++++++++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/libs/lib_detector.php b/libs/lib_detector.php index 819adc6..400c05f 100644 --- a/libs/lib_detector.php +++ b/libs/lib_detector.php @@ -446,7 +446,7 @@ function ctrackerIncreaseAntiSpambotCount () { ]; // Update count - updateCrackerTrackerEntry($rowData, 'spam_bot_dectections'); + updateCrackerTrackerEntry($rowData, 'spam_bot_detections'); } // Alerts the current user about malicious/suspicious traffic diff --git a/libs/lib_updates.php b/libs/lib_updates.php index 3af0db8..bf84dca 100644 --- a/libs/lib_updates.php +++ b/libs/lib_updates.php @@ -64,13 +64,13 @@ FOREIGN KEY ( `ctracker_data_id` ) REFERENCES `' . $GLOBALS['ctracker_dbname'] . // Also store proxy address [ - 'ALTER TABLE `ctracker_data` ADD `proxy_addr` VARCHAR(15) NULL DEFAULT NULL AFTER `remote_addr`', - 'ALTER TABLE `ctracker_ticket` ADD `ctracker_ticket_proxy_addr` VARCHAR(15) NULL DEFAULT NULL', + "ALTER TABLE `ctracker_data` ADD `proxy_addr` VARCHAR(15) NULL DEFAULT NULL AFTER `remote_addr`", + "ALTER TABLE `ctracker_ticket` ADD `ctracker_ticket_proxy_addr` VARCHAR(15) NULL DEFAULT NULL", ], // Better key for always repeating query [ - 'ALTER TABLE `ctracker_data` ADD INDEX `remote_proxy_last` ( `remote_addr`, `proxy_addr`, `last_attempt` DESC )', + "ALTER TABLE `ctracker_data` ADD INDEX `remote_proxy_last` ( `remote_addr`, `proxy_addr`, `last_attempt` DESC )", ], // HTTP request method @@ -80,23 +80,22 @@ FOREIGN KEY ( `ctracker_data_id` ) REFERENCES `' . $GLOBALS['ctracker_dbname'] . // Index on count [ - 'ALTER TABLE `ctracker_data` ADD INDEX `count` (`count`)', + "ALTER TABLE `ctracker_data` ADD INDEX `count` (`count`)", ], // Log also UA after check [ - "ALTER TABLE `ctracker_data` - ADD `check_ua` tinytext COLLATE 'utf8_general_ci' NULL COMMENT 'User agent after check' AFTER `post_data`, - CHANGE `check_worm` `check_get` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'GET data after check' AFTER `check_ua`, - CHANGE `check_post` `check_post` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'POST data after check' AFTER `check_worm`", + "ALTER TABLE `ctracker_data` ADD `check_ua` tinytext COLLATE 'utf8_general_ci' NULL COMMENT 'User agent after check' AFTER `post_data`", + "ALTER TABLE `ctracker_data` CHANGE `check_worm` `check_get` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'GET data after check' AFTER `check_ua`", + "ALTER TABLE `ctracker_data` CHANGE `check_post` `check_post` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'POST data after check' AFTER `check_get`", ], // View for request methods [ - 'CREATE VIEW `view_most_request_methods` AS + "CREATE VIEW `view_most_request_methods` AS SELECT SQL_CALC_FOUND_ROWS COUNT(`id`) AS `total_rows`, `request_method` FROM `ctracker_data` - GROUP BY `request_method`' + GROUP BY `request_method`" ], // Anti-spambot field @@ -122,8 +121,8 @@ FOREIGN KEY ( `ctracker_data_id` ) REFERENCES `' . $GLOBALS['ctracker_dbname'] . "ALTER TABLE `ctracker_data` CHANGE `user_agent` `user_agent` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'User agent string' AFTER `remote_addr`", "ALTER TABLE `ctracker_data` CHANGE `get_data` `get_data` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'Serialized GET data' AFTER `user_agent`", "ALTER TABLE `ctracker_data` CHANGE `post_data` `post_data` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'Serialized POST data' AFTER `get_data`", - "ALTER TABLE `ctracker_data` CHANGE `check_worm` `check_worm` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'Manipulated GET data' AFTER `check_ua`", - "ALTER TABLE `ctracker_data` CHANGE `check_post` `check_post` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'Manipulated GET data' AFTER `check_worm`", + "ALTER TABLE `ctracker_data` CHANGE `check_get` `check_get` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'Manipulated GET data' AFTER `check_ua`", + "ALTER TABLE `ctracker_data` CHANGE `check_post` `check_post` tinytext COLLATE 'utf8_general_ci' NOT NULL COMMENT 'Manipulated GET data' AFTER `check_get`", "ALTER TABLE `ctracker_data` CHANGE `referer` `referer` varchar(255) COLLATE 'utf8_general_ci' NOT NULL COMMENT 'Referer' AFTER `script_name`", "ALTER TABLE `ctracker_data` CHANGE `request_method` `request_method` varchar(255) COLLATE 'utf8_general_ci' NULL COMMENT 'HTTP request method' AFTER `referer`", "ALTER TABLE `ctracker_data` CHANGE `proxy_used` `proxy_used` enum('Y','N') COLLATE 'utf8_general_ci' NOT NULL DEFAULT 'N' COMMENT 'Proxy used?' AFTER `request_method`", @@ -131,6 +130,11 @@ FOREIGN KEY ( `ctracker_data_id` ) REFERENCES `' . $GLOBALS['ctracker_dbname'] . "ALTER TABLE `ctracker_data` CHANGE `proxy_addr` `proxy_addr` varchar(15) COLLATE 'utf8_general_ci' NULL COMMENT 'Detected proxy address' AFTER `count`", "ALTER TABLE `ctracker_data` COLLATE 'utf8_general_ci'", ], + + // Tzop fixed + [ + "ALTER TABLE `ctracker_data` CHANGE `spam_bot_dectections` `spam_bot_detections` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'Spam-bot attempts'", + ], ]; } -- 2.39.5