PluginProbe
Patchstack – WordPress & Plugins Security / 2.1.6
Patchstack – WordPress & Plugins Security v2.1.6
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
← All changes | includes/login.php +10 -1 2.1.32.1.6 View file →
@@ -147,12 +147,21 @@
147 147 if ( $this->plugin->ban->is_ip_whitelisted( $ip ) ) {
148 148 return;
149 149 }
150 150
151 + // Calculate block time.
152 + $minutes = (int) $this->get_option( 'patchstack_anti_bruteforce_minutes', 30 );
153 + $timeout = (int) $this->get_option( 'patchstack_anti_bruteforce_blocktime', 60 );
154 + if ( empty( $minutes ) || empty( $timeout ) ) {
155 + $time = 30 + 60;
156 + } else {
157 + $time = $minutes + $timeout;
158 + }
159 +
151 160 // Check if X failed login attempts were made.
152 161 global $wpdb;
153 162 $results = $wpdb->get_results(
154 - $wpdb->prepare( 'SELECT COUNT(*) AS numIps FROM ' . $wpdb->prefix . "patchstack_event_log WHERE ip = '%s' AND action = 'failed login' AND date >= ('" . current_time( 'mysql' ) . "' - INTERVAL %d MINUTE)", array( $ip, ( $this->get_option( 'patchstack_anti_bruteforce_blocktime', 60 ) + $this->get_option( 'patchstack_anti_bruteforce_minutes', 5 ) ) ) ),
163 + $wpdb->prepare( 'SELECT COUNT(*) AS numIps FROM ' . $wpdb->prefix . "patchstack_event_log WHERE ip = '%s' AND action = 'failed login' AND date >= ('" . current_time( 'mysql' ) . "' - INTERVAL %d MINUTE)", array( $ip, $time ) ),
155 164 OBJECT
156 165 );
157 166
158 167 // Determine the number of attempts.