Plugin Directory

Changeset 1256133


Ignore:
Timestamp:
09/29/2015 10:04:16 PM (11 years ago)
Author:
achbed
Message:
  • Added "none" option for the RBLs (so you can use white/black lists but ignore the RBLs)
  • Added checks to improve performance where possible
  • Fixed the readme, added screenshot
Location:
botnet-blocker
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • botnet-blocker/trunk/botnet-blocker.php

    r1256105 r1256133  
    55Description: Free botnet IP blocker according to public DNSBL bases. Based on public DNSBL class.
    66Author: Dennis Wallace
    7 Version: 1.1.0
     7Version: 1.2.0
    88License: GPLv2 or later
    99*/
     
    137137            }
    138138           
     139            // If we have nothing to do, skip the expensive checks.
     140            $all_lists = array_merge( $whitelist, $blacklist, $whitelist_dns, $blacklist_dns );
     141            if ( empty( $all_lists ) && ( $this->config->rbl == 'none' ) ) {
     142                return $result;
     143            }
     144           
    139145            foreach ( $ips as $ip ) {
    140146                if ( empty( $ip ) ) {
     
    142148                }
    143149               
    144                 if ( $this->netmatch_array( $ip, $skiplist ) ) {
    145                     continue;
     150                if ( ! empty( $skiplist ) ) {
     151                    if ( $this->netmatch_array( $ip, $skiplist ) ) {
     152                        continue;
     153                    }
    146154                }
    147155               
    148                 if ( $this->netmatch_array( $ip, $whitelist ) ) {
    149                     $whitelisted = true;
    150                     continue;
     156                if ( ! empty( $whitelist ) ) {
     157                    if ( $this->netmatch_array( $ip, $whitelist ) ) {
     158                        $whitelisted = true;
     159                        continue;
     160                    }
    151161                }
    152162                       
    153                 if ( $this->netmatch_array( $ip, $blacklist ) ) {
    154                     $blacklisted = true;
    155                     continue;
     163                if ( ! empty( $blacklist ) ) {
     164                    if ( $this->netmatch_array( $ip, $blacklist ) ) {
     165                        $blacklisted = true;
     166                        continue;
     167                    }
    156168                }
    157169               
     
    160172                    $dns = gethostbyaddr( $ip );
    161173                    if ( $this->config->debug == 'on' ) {
    162                         // $dns = 'ec2-54-151-46-163.us-west-1.compute.amazonaws.com';  // for testing only.
    163174                        header( 'X-BotnetBlocker-Debug-DNSLookup: ' . $dns );
    164175                    }
    165176                    if ( ( $dns !== false ) && ( $dns != $ip ) ) {
    166177                        // We have a DNS address for the IP.  Check it!
    167                         if ( $this->dnsmatch_array( $dns, $whitelist_dns ) ) {
    168                             $whitelisted = true;
    169                             continue;
     178                        if ( ! empty( $whitelist_dns ) ) {
     179                            if ( $this->dnsmatch_array( $dns, $whitelist_dns ) ) {
     180                                $whitelisted = true;
     181                                continue;
     182                            }
    170183                        }
    171184                       
    172                         if ( $this->dnsmatch_array( $dns, $blacklist_dns ) ) {
    173                             $blacklisted = true;
    174                             continue;
     185                        if ( ! empty( $blacklist_dns ) ) {
     186                            if ( $this->dnsmatch_array( $dns, $blacklist_dns ) ) {
     187                                $blacklisted = true;
     188                                continue;
     189                            }
    175190                        }
    176191                    }
     
    179194                if ( ( $whitelisted || $blacklisted || $result ) == false ) {
    180195                    // Only check for botnet membership if we've not already decided
    181                     if ( $this->config->dnsbl->CheckSpamIP( $ip ) ) {
    182                         $result = true;
     196                    if ( $this->config->rbl != 'none' ) {
     197                        if ( $this->config->dnsbl->CheckSpamIP( $ip ) ) {
     198                            $result = true;
     199                        }
    183200                    }
    184201                }
  • botnet-blocker/trunk/class.bnblocker-admin.php

    r1256105 r1256133  
    7272                        'type'              => 'select',
    7373                        'options'           => $this->config->get_rbl_list(),
    74                         'default'           => $this->config->dnsbl->GetDefaultChecker()
     74                        'default'           => 'none'
    7575                    ),
    7676                    array(
  • botnet-blocker/trunk/class.bnblocker-config.php

    r1256105 r1256133  
    164164           
    165165            $this->dnsbl = new DNSBL();
    166             $default_checker = $this->dnsbl->GetDefaultChecker();
    167            
    168             $this->rbl = $this->get_option( 'bnblocker_rbl', 'bnblocker_core', $default_checker );
    169             if( $this->rbl != $default_checker ) {
     166            $this->rbl = $this->get_option( 'bnblocker_rbl', 'bnblocker_core', 'none' );
     167            if( $this->rbl != 'none' ) {
    170168                $this->dnsbl->SetDefaultChecker( $this->rbl );
    171169            }
     
    176174         */
    177175        public function get_rbl_list() {
    178             $array = array( 'all' => __( 'All valid blacklists', 'botnet-blocker' ) );
     176            $array = array(
     177                'none' => __( 'Ignore all RBLs', 'botnet-blocker' ),
     178                'all' => __( 'All valid blacklists', 'botnet-blocker' ),
     179            );
    179180            foreach ( $this->dnsbl->GetCheckers() as $b ) {
    180181                $array[$b] =  __( $b, 'botnet-blocker' );
  • botnet-blocker/trunk/languages/botnet-blocker-en_US.po

    r1256105 r1256133  
    9090msgstr "Choose File"
    9191
     92msgid "Ignore all RBLs"
     93msgstr "Ignore all RBLs"
     94
     95msgid "All valid blacklists"
     96msgstr "All valid blacklists"
     97
    9298#: class.settings-api.php:352
    9399msgid "spamhaus_xbl"
  • botnet-blocker/trunk/readme.txt

    r1256105 r1256133  
    11=== Botnet Blocker ===
    2 Contributors: znaeff, achbed
     2Contributors: achbed, znaeff
    33Tags: comments, spam, blocking, DNSBL, spamhaus, spamcop, free
     4Requires at least: 4.0.0
    45Tested up to: 4.3.1
    5 Stable tag: 1.1.0
     6Stable tag: 1.2.0
     7License: GPLv2
    68
    7 Botnet IP checker using public DNSBL bases and a hardcoded whitelist/blacklist.
     9Botnet identifier using public DNSBL bases and a hardcoded whitelist/blacklist.
    810
    911== Description ==
     
    17191. Activate the plugin through the 'Plugins' menu in WordPress
    18201. In your template, theme, or plugin, do something similar to the following:
    19 ```
    20 <?php
     21
     22`<?php
    2123  global $wp_plugin_bnblocker;
    2224    if ( method_exists( $wp_plugin_bnblocker, 'is_botnet' ) ) {
     
    2527    }
    2628  }
    27 ?>
    28 ```
     29?>`
    2930
    3031== Frequently Asked Questions ==
     
    3435Because I haven't found any decent free plugins that uses spam blocking lists that present a decent API.
    3536This plugin is designed to give you a quick and easy way to check the spam lists and do something creative
    36 without locking you into a "block all" scheme.
     37without locking you into a "block all" scheme.  It's there if you want it, but it's not required.
     38
     39== Upgrade Notice ==
     40
     41= 1.2.0 =
     42Allows ignoring all RBLs
     43
     44= 1.1.0 =
     45Adds DNS-based lists and an early-load blocking option
    3746
    3847== Screenshots ==
    3948
    40 There are no screenshots yet.
     491. The admin interface.
    4150
    4251== Changelog ==
    4352
     53= 1.2.0 =
     54* Added "none" option for the RBLs (so you can use white/black lists but ignore the RBLs)
     55* Added checks to improve performance where possible
     56* Fixed the readme, added screenshot
     57
    4458= 1.1.0 =
    45 Added DNS-based white and blacklists as an option
    46 Added option to block bots during the plugins_loaded timeframe
    47 Corrected the main blocked() function to use 404 instead of 406
    48 Reversed order of changelog in the readme
     59* Added DNS-based white and blacklists as an option
     60* Added option to block bots during the plugins_loaded timeframe
     61* Corrected the main blocked() function to use 404 instead of 406
     62* Reversed order of changelog in the readme
    4963
    5064= 1.0.1 =
    51 Refactored to allow for support for language packs
     65* Refactored to allow for support for language packs
    5266
    5367= 1.0.0 =
    54 Complete refactor of the Plugin
    55 Now has an admin section for modifying white/black/skip lists within the UI
    56 Allows choosing which RBL in the UI
    57 Revised logic to improve speed
    58 Now uses CIDR-formatted netmasks for better maintenance
    59 BREAKING CHANGE: Global object has been renamed from $BOTNETBLOCKER_OBJ to $wp_plugin_bnblocker
     68* Complete refactor of the Plugin
     69* Now has an admin section for modifying white/black/skip lists within the UI
     70* Allows choosing which RBL in the UI
     71* Revised logic to improve speed
     72* Now uses CIDR-formatted netmasks for better maintenance
     73* Removed hard-coded proxy network lists - use the whitelist instead
     74* BREAKING CHANGE: Global object has been renamed from $BOTNETBLOCKER_OBJ to $wp_plugin_bnblocker
    6075
    6176= 0.2.0 =
    62 Added extensive URL-based debugging and reply headers when in debug mode
    63 Added a hard coded white/black/skip list system
    64 Added timing checks for debugging speed issues
    65 Added Sucuri network addresses to skip list
     77* Added extensive URL-based debugging and reply headers when in debug mode
     78* Added a hard coded white/black/skip list system
     79* Added timing checks for debugging speed issues
     80* Added Sucuri network addresses to skip list
    6681
    6782= 0.1.1 =
    68 Fixed issue where DNSBL class used a short opening tag (broke some installations)
     83* Fixed issue where DNSBL class used a short opening tag (broke some installations)
    6984
    7085= 0.1.0 =
    71 First version.
     86* First version.
    7287
Note: See TracChangeset for help on using the changeset viewer.