Version: 1.0.0
Authors: Rajan, Manish, Mohan
License: GPL-2.0-or-later
Requires: WordPress 5.0+, PHP 7.4+
Smart Shield is a comprehensive WordPress security plugin that provides AI-powered spam protection across multiple vectors including login attempts, comments, and emails. It features intelligent IP blocking, detailed logging, and an intuitive admin dashboard for monitoring and managing security threats.
- Brute Force Protection: Automatically blocks IP addresses after failed login attempts
- Configurable Thresholds: Set custom maximum login attempts before blocking
- Temporary Blocking: Uses transient-based storage for automatic cleanup
- AI-Powered Detection: Leverages Gemini AI API for intelligent spam detection
- Flexible Handling: Choose to block spam comments or save them for review
- Real-time Processing: Analyzes comments before they're published
- AI Analysis: Uses advanced AI to detect spam in email submissions
- Configurable Actions: Block spam emails or add warning labels
- Form Protection: Protects contact forms and email submissions
- Manual IP Management: Add/remove IP addresses from block list
- Automatic Blocking: AI and login protection automatically block suspicious IPs
- Flexible Duration: Configure block duration (1 hour to permanent)
- Whitelist Support: Protect trusted IP addresses from blocking
- Detailed Event Tracking: Log all security events with timestamps
- Visual Dashboard: Real-time statistics and recent activity monitoring
- Filterable Logs: Search and filter logs by event type, IP, status, and date
- Configurable Retention: Set maximum log entries to control database size
- Gemini AI API: Uses Google's Gemini AI for accurate spam detection
- Intelligent Prompting: Specialized prompts for different spam types
- Modular Architecture: Easy to extend with additional AI providers
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Composer (for development)
-
Download and Extract
cd /path/to/wordpress/wp-content/plugins/ # Extract the plugin files to smartshield/ directory
-
Install Dependencies
cd smartshield/ composer install --no-dev -
Activate Plugin
- Go to WordPress Admin β Plugins
- Find "Smart Shield" and click "Activate"
-
Configure Settings
- Navigate to Smart Shield β Dashboard
- Configure your desired protection settings
- Add your Gemini AI API key for AI features
- Get your Gemini AI API key from Google Cloud Console
- Go to Smart Shield β Other Settings
- Enter your API key in the "AI API Key" field
- Enable Protection: Toggle login spam protection on/off
- Max Attempts: Set maximum failed login attempts (default: 5)
- Block Duration: Configure how long IPs are blocked (set in Other Settings)
- Enable Protection: Toggle comment spam protection on/off
- Save for Review: Choose to save spam comments for manual review or block them entirely
- Enable Protection: Toggle email spam protection on/off
- Spam Warning: Add "SPAM" to subject line or block entirely
- Default Block Duration: Set default duration for automatic blocks
- IP Whitelist: Add trusted IP addresses that will never be blocked
- IP Block List: Manually add IP addresses to block
- Notification Settings: Configure email notifications for admin
- Max Log Entries: Set maximum number of log entries to store
- Auto-cleanup: Automatic cleanup of old logs when limit reached
Access the main dashboard at WordPress Admin β Smart Shield β Dashboard
Statistics Overview:
- Total Events: All security events tracked
- Last 24 Hours: Recent activity count
- Unique IPs: Number of unique IP addresses in logs
- Blocked Today: IPs blocked in the current day
Protection Status:
- Real-time status of all protection modules
- Quick enable/disable toggles
- Configuration status indicators
Recent Activity:
- Latest 5 security events
- Event types: login, comment, email, IP block
- Status indicators: blocked, allowed, pending
-
Go to Smart Shield β IP Blocker
-
Add New Block:
- Enter IP address
- Set block duration
- Add optional reason
- Click "Block IP Address"
-
Manage Existing Blocks:
- View all blocked IPs with status
- Filter by active/expired/removed
- Manually remove or extend blocks
- Clean up expired blocks
-
Go to Smart Shield β Logs
-
Filter Options:
- Event Type: login, comment, email, ip_block
- Status: blocked, allowed, pending
- Date Range: Custom date filtering
- IP Address: Search by specific IP
-
Log Details:
- Timestamp and event type
- IP address and user agent
- Status and AI confidence score
- Detailed event information
smartshield/
βββ src/
β βββ Admin/ # Admin interface classes
β βββ Front/ # Frontend integration
β βββ Helper/ # Helper functions
β βββ Modules/ # Core functionality modules
βββ vendor/ # Composer dependencies
βββ composer.json # Dependency management
βββ smartshield.php # Main plugin file
Core Modules:
SmartShield\Modules\LoginHandler\LoginHandler- Login protectionSmartShield\Modules\SpamHandler\SpamHandler- Comment spam detectionSmartShield\Modules\EmailHandler\EmailHandler- Email spam protectionSmartShield\Modules\IPBlocker\IPBlocker- IP blocking system
Admin Interface:
SmartShield\Admin\SettingsPage- Main admin dashboardSmartShield\Admin\Logger- Logging systemSmartShield\Admin\*Settings- Individual settings pages
Frontend Integration:
SmartShield\Front\*Frontend- Frontend handlers for each module
Actions:
smart_shield_ip_blocked- Triggered when IP is blockedsmart_shield_spam_detected- Triggered when spam is detectedsmart_shield_login_blocked- Triggered when login is blocked
Filters:
smart_shield_ip_whitelist- Modify IP whitelistsmart_shield_spam_threshold- Modify spam detection thresholdsmart_shield_block_duration- Modify block duration
wp_smart_shield_logs:
id- Primary keyip_address- IP address of the eventevent_type- Type of event (login, comment, email, ip_block)status- Event status (blocked, allowed, pending)user_agent- User agent stringdetails- JSON encoded event detailscreated_at- Timestamp
wp_smart_shield_ip_blocks:
id- Primary keyip_address- Blocked IP addressreason- Block reasonduration- Block duration in secondsstatus- Block status (active, expired, manually_removed)created_at- Block creation timestampexpires_at- Block expiration timestamp
1. AI Features Not Working
- Ensure you have a valid Gemini AI API key
- Check API key permissions in Google Cloud Console
- Verify internet connectivity from your server
2. IP Blocking Not Working
- Check if IP is in whitelist
- Verify block duration settings
- Ensure database tables are created properly
3. High False Positives
- Adjust AI confidence threshold
- Review and update IP whitelist
- Check spam detection prompts
4. Performance Issues
- Reduce maximum log entries
- Enable log cleanup
- Check database table indexes
Enable WordPress debug mode to see detailed error messages:
// In wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);- Initial release
- Login protection with IP blocking
- AI-powered comment spam detection
- Email spam protection
- Comprehensive admin dashboard
- IP blocking management
- Detailed logging system
- Gemini AI integration
This plugin is licensed under the GPL-2.0-or-later license. See the LICENSE file for details.
We welcome contributions to Smart Shield! Please feel free to submit issues, feature requests, or pull requests.
- Clone the repository
- Run
composer install - Set up WordPress development environment
- Activate the plugin in development mode
For support, please:
- Check the troubleshooting section above
- Review the WordPress debug logs
- Create an issue in the repository
- Contact the development team
Made with β€οΈ by the WordPress Hosting Team