Security Dashboard


Security Overview

Total Checkers

Rate Limited

CAPTCHA Protected

reCAPTCHA: | Turnstile:
Unprotected

Security Status Distribution

Recent Rate Limit Blocks

IP Address Checker Time Reason
Loading...

Individual Checker Security Status

Checker Rate Limit reCAPTCHA Turnstile Honeypot Status Actions
ID); ?> ID, 'checker', true)['security']['rate_limit']['enabled'] ?? 'no'; if ($rate_limit === 'yes') { $max_attempts = get_post_meta($checker->ID, 'checker', true)['security']['rate_limit']['max_attempts'] ?? 5; echo ' ' . $max_attempts . ' per '; echo get_post_meta($checker->ID, 'checker', true)['security']['rate_limit']['time_window'] ?? 15 . ' min'; } else { echo ' Disabled'; } ?> ID, 'checker', true)['security']['recaptcha']['enabled'] ?? 'no'; if ($recaptcha === 'yes') { $min_score = get_post_meta($checker->ID, 'checker', true)['security']['recaptcha']['min_score'] ?? 0.5; echo ' Score ' . $min_score; } else { echo ' Disabled'; } ?> ID, 'checker', true); $turnstile = isset($checker_data['security']['turnstile']['enabled']) ? $checker_data['security']['turnstile']['enabled'] : 'no'; // Debug: Check if turnstile data exists if (!isset($checker_data['security'])) { echo 'No security data'; } elseif (!isset($checker_data['security']['turnstile'])) { echo 'No turnstile data'; } else { if ($turnstile === 'yes') { echo ' Enabled'; } else { echo ' Disabled'; } } ?> Enabled'; } else { echo ' Disabled'; } ?> Protected'; } else { echo 'Unprotected'; } ?>
'checker', 'post_status' => 'publish', 'numberposts' => -1 ]); } /** * Get security overview */ private static function get_security_overview($checkers) { $rate_limited = 0; $captcha_protected = 0; $honeypot_enabled = 0; $unprotected = 0; $recaptcha_count = 0; $turnstile_count = 0; foreach ($checkers as $checker) { $checker_data = get_post_meta($checker->ID, 'checker', true); $has_rate_limit = isset($checker_data['security']['rate_limit']['enabled']) && $checker_data['security']['rate_limit']['enabled'] === 'yes'; $has_recaptcha = isset($checker_data['security']['recaptcha']['enabled']) && $checker_data['security']['recaptcha']['enabled'] === 'yes'; $has_turnstile = isset($checker_data['security']['turnstile']['enabled']) && $checker_data['security']['turnstile']['enabled'] === 'yes'; $has_honeypot = isset($checker_data['security']['honeypot']['enabled']) && $checker_data['security']['honeypot']['enabled'] === 'yes'; if ($has_rate_limit) { $rate_limited++; } if ($has_recaptcha) { $recaptcha_count++; } if ($has_turnstile) { $turnstile_count++; } if ($has_honeypot) { $honeypot_enabled++; } if ($has_recaptcha || $has_turnstile) { $captcha_protected++; } if (!$has_rate_limit && !$has_recaptcha && !$has_turnstile && !$has_honeypot) { $unprotected++; } } return [ 'rate_limited' => $rate_limited, 'captcha_protected' => $captcha_protected, 'honeypot_enabled' => $honeypot_enabled, 'unprotected' => $unprotected, 'recaptcha_count' => $recaptcha_count, 'turnstile_count' => $turnstile_count ]; } /** * AJAX handler for dashboard actions */ public static function ajax_handler() { if (!current_user_can('manage_options')) { wp_die('Unauthorized'); } $security_action = $_POST['security_action'] ?? ''; switch ($security_action) { case 'get_rate_limit_logs': self::get_rate_limit_logs(); break; } wp_die(); } /** * Get rate limit logs */ private static function get_rate_limit_logs() { global $wpdb; // This is a simplified version - in a real implementation, // you might want to store rate limit blocks in a custom table $logs = []; // Get recent transients that indicate rate limit blocks $transients = $wpdb->get_results( "SELECT option_name, option_value FROM {$wpdb->options} WHERE option_name LIKE '%_transient_checker_block_%' ORDER BY option_name DESC LIMIT 10" ); foreach ($transients as $transient) { // Extract checker ID from transient name if (preg_match('/_transient_checker_block_(\d+)_/', $transient->option_name, $matches)) { $checker_id = $matches[1]; $checker = get_post($checker_id); $ip_hash = substr($transient->option_name, strrpos($transient->option_name, '_') + 1); $blocked_until = $transient->option_value; $logs[] = [ 'ip' => self::mask_ip(self::decode_ip_from_hash($ip_hash)), 'checker' => $checker ? $checker->post_title : 'Unknown', 'time' => date('Y-m-d H:i:s', $blocked_until), 'reason' => 'Rate limit exceeded' ]; } } wp_send_json_success(['logs' => $logs]); } /** * Mask IP address for privacy */ private static function mask_ip($ip) { if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { $parts = explode('.', $ip); return $parts[0] . '.' . $parts[1] . '.***.***'; } elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { $parts = explode(':', $ip); return $parts[0] . ':' . $parts[1] . '::***'; } return $ip; } /** * Decode IP from hash (simplified version) */ private static function decode_ip_from_hash($hash) { // This is a simplified version - in reality, you can't easily reverse a hash // For demonstration purposes, we'll return a placeholder return '192.168.1.***'; } } // Initialize the dashboard CHECKER_SECURITY_DASHBOARD::init();