admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('aegis_run_scan') ]); } }); add_action('wp_ajax_aegis_run_scan', function () { check_ajax_referer('aegis_run_scan'); $results = aegis_shield_run_scan(); ob_start(); echo '

' . esc_html__('Scan Results', 'aegis-shield') . '

'; echo '

' . sprintf( /* translators: %d is the number of PHP files scanned. */ esc_html__('%d PHP files scanned.', 'aegis-shield'), esc_html($results['scanned_files']) ) . '

'; if (!empty($results['suspicious_matches'])) { echo '

' . esc_html__('Suspicious Code Found:', 'aegis-shield') . '

'; } else { echo '

' . esc_html__('No suspicious code found.', 'aegis-shield') . '

'; } if (!empty($results['integrity_issues'])) { echo '

' . esc_html__('Integrity Issues:', 'aegis-shield') . '

'; } wp_send_json_success(['html' => ob_get_clean()]); }); function aegis_shield_render_admin_page() { $tabs = [ 'scan' => __('Scan', 'aegis-shield'), 'ips' => __('IP Blocking', 'aegis-shield'), 'cron' => __('Automation Settings', 'aegis-shield'), ]; if (!defined('AEGIS_SHIELD_PRO')) { $tabs['get-pro'] = __('Get Pro', 'aegis-shield'); } if (defined('AEGIS_SHIELD_PRO') && AEGIS_SHIELD_PRO === true) { $tabs['scan-history'] = __('Scan History', 'aegis-shield'); $tabs['license'] = __('License', 'aegis-shield'); $tabs['support'] = __('Support', 'aegis-shield'); } $current_tab = isset($_GET['tab']) ? sanitize_key(wp_unslash($_GET['tab'])) : 'scan'; $current_tab = array_key_exists($current_tab, $tabs) ? $current_tab : 'scan'; ?>

Aegis Shield Logo

Your journey to a more secure WordPress site starts here. By clicking the scan button below, Aegis Shield will perform an initial baseline scan of your entire site. This scan helps us understand the current state of your files, and it forms the foundation for all future integrity checks.

Let’s lock things down and keep the bad guys out β€” one scan at a time. Welcome back! You're just one click away from making sure your site is still clean and secure. This scan checks your site for any file changes or suspicious activity by comparing against your most recent scan. Stay proactive β€” run scans regularly for maximum peace of mind.

' . esc_html__('Blocked IP list updated successfully.', 'aegis-shield') . '

'; } // Block a single IP from GET if (isset($_GET['block_ip']) && check_admin_referer('aegis_shield_block_ip')) { $ip_to_block = sanitize_text_field(wp_unslash($_GET['block_ip'])); if (filter_var($ip_to_block, FILTER_VALIDATE_IP)) { aegis_shield_block_ip($ip_to_block); // Handles saving to fallback echo '

' . esc_html__('IP blocked successfully.', 'aegis-shield') . '

'; } } // Remove (unblock) a single IP from GET if (isset($_GET['remove_ip']) && check_admin_referer('aegis_shield_remove_ip')) { $ip_to_remove = sanitize_text_field(wp_unslash($_GET['remove_ip'])); if (filter_var($ip_to_remove, FILTER_VALIDATE_IP)) { $blocked = aegis_shield_get_blocked_ips_fallback(); $updated = array_diff($blocked, [$ip_to_remove]); aegis_shield_save_blocked_ips_fallback($updated); echo '

' . esc_html__('IP unblocked successfully.', 'aegis-shield') . '

'; } } // Delete a single failed login log entry if (isset($_GET['delete_log']) && check_admin_referer('aegis_shield_delete_log')) { $index = (int) sanitize_text_field(wp_unslash($_GET['delete_log'])); $logs = get_option('aegis_shield_failed_logins', []); if (isset($logs[$index])) { unset($logs[$index]); $logs = array_values($logs); update_option('aegis_shield_failed_logins', $logs); echo '

' . esc_html__('Log entry deleted.', 'aegis-shield') . '

'; } } echo '

' . esc_html__('Blocked IP Addresses', 'aegis-shield') . '

'; $blocked_ips = aegis_shield_get_blocked_ips_fallback(); if (!empty($blocked_ips)) { echo ''; foreach ($blocked_ips as $ip) { $remove_url = wp_nonce_url(admin_url('admin.php?page=aegis-shield&tab=ips&remove_ip=' . urlencode($ip)), 'aegis_shield_remove_ip'); echo ''; } echo '
' . esc_html__('IP Address', 'aegis-shield') . '' . esc_html__('Action', 'aegis-shield') . '
' . esc_html($ip) . '' . esc_html__('Unblock', 'aegis-shield') . '
'; } else { echo '

' . esc_html__('No IP addresses are currently blocked.', 'aegis-shield') . '

'; } echo '

' . esc_html__('Recent Failed Login Attempts', 'aegis-shield') . '

'; $failed_logins = get_option('aegis_shield_failed_logins', []); $blocked = aegis_shield_get_blocked_ips_fallback(); if (!empty($failed_logins)) { echo ''; foreach (array_reverse($failed_logins, true) as $index => $log) { echo ''; echo ''; echo ''; echo ''; echo ''; } echo '
' . esc_html__('Time', 'aegis-shield') . '' . esc_html__('Username', 'aegis-shield') . '' . esc_html__('IP Address', 'aegis-shield') . '' . esc_html__('Action', 'aegis-shield') . '
' . esc_html($log['time']) . '' . esc_html($log['username']) . '' . esc_html($log['ip']) . ''; if (!in_array($log['ip'], $blocked, true)) { $block_url = wp_nonce_url(admin_url('admin.php?page=aegis-shield&tab=ips&block_ip=' . urlencode($log['ip'])), 'aegis_shield_block_ip'); echo '' . esc_html__('Block', 'aegis-shield') . ' '; } else { echo '' . esc_html__('Blocked', 'aegis-shield') . ' '; } $delete_url = wp_nonce_url(admin_url('admin.php?page=aegis-shield&tab=ips&delete_log=' . $index), 'aegis_shield_delete_log'); echo '' . esc_html__('Delete', 'aegis-shield') . ''; echo '
'; } else { echo '

' . esc_html__('No failed login attempts recorded yet.', 'aegis-shield') . '

'; } break; case 'cron': if (isset($_POST['save_cron_settings']) && check_admin_referer('aegis_shield_cron_settings')) { $enabled = isset($_POST['enable_cron']) ? '1' : '0'; $frequency = 'weekly'; // Default if (isset($_POST['cron_frequency'])) { $raw_frequency = sanitize_text_field(wp_unslash($_POST['cron_frequency'])); $allowed_frequencies = ['daily', 'weekly', 'monthly', 'manual']; if (in_array($raw_frequency, $allowed_frequencies, true)) { $frequency = $raw_frequency; } } update_option('aegis_shield_cron_enabled', $enabled); update_option('aegis_shield_cron_frequency', $frequency); wp_clear_scheduled_hook('aegis_shield_cron_scan'); if ($enabled === '1') { wp_schedule_event(time(), $frequency, 'aegis_shield_cron_scan'); } echo '

' . esc_html__('Cron settings saved.', 'aegis-shield') . '

'; } $cron_enabled = get_option('aegis_shield_cron_enabled', '0'); $cron_frequency = get_option('aegis_shield_cron_frequency', 'daily'); $last_run = get_option('aegis_shield_last_cron_scan'); ?>



πŸš€ Unlock Pro Security Tools

Get access to advanced scan history, suspicious code insights, premium support, and more β€” all backed by our expert security team.

Upgrade to Aegis Shield Pro