Changeset 1256638
- Timestamp:
- 09/30/2015 02:21:39 PM (11 years ago)
- Location:
- botnet-blocker/trunk
- Files:
-
- 3 edited
-
botnet-blocker.php (modified) (2 diffs)
-
class.bnblocker-config.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
botnet-blocker/trunk/botnet-blocker.php
r1256133 r1256638 5 5 Description: Free botnet IP blocker according to public DNSBL bases. Based on public DNSBL class. 6 6 Author: Dennis Wallace 7 Version: 1.2. 07 Version: 1.2.1 8 8 License: GPLv2 or later 9 9 */ … … 317 317 */ 318 318 public function dnsmatch( $dns, $name ) { 319 if ( empty( $name ) ) {319 if ( empty( $name ) || empty( $dns ) ) { 320 320 return false; 321 321 } 322 322 323 $regex = ''; 324 if ( substr( $name, 0, 1 ) == '/' ) { 325 if ( substr( $name, -1 ) == '/' ) { 326 // Regex format already. Make sure it's not a completely empty match. 327 $n = str_replace( array( '/','$','.','^' ), '', $name ); 328 if ( empty( $n ) ) { 329 return false; 330 } 331 332 $regex = $name; 333 } 334 } 335 336 if ( empty( $regex ) ) { 337 $regex = '/' . str_replace( array( '.', '$', '^', '/' ) , array( '\.', '\$', '\^', '\/'), $name ) . '$/'; 338 } 339 340 $r = preg_match( $regex, $dns ); 341 return ( $r == 1 ); 323 $match = strtolower( $dns ); 324 $len = strlen( $name ); 325 $match = substr( $match, -$len ); 326 return ( $match == $name ); 342 327 } 343 328 -
botnet-blocker/trunk/class.bnblocker-config.php
r1256133 r1256638 135 135 public function preplist( $list, $ip = true ) { 136 136 $a = $list; 137 $a = str_replace( array("\r","\n","\t"," "), ";", $a ); 137 138 if ( $ip ) { 138 139 $a = preg_replace( '/[^.0-9\/]+/', ";", $list ); 140 } else { 141 $a = strtolower( $a ); 139 142 } 140 143 $a = trim( $a ); … … 143 146 $b = array(); 144 147 foreach ( $a as $i ) { 145 $b[$i] = true; 146 } 147 return array_keys( $b ); 148 if ( ! empty ( $i ) ) { 149 $b[$i] = true; 150 } 151 } 152 $array = array_keys( $b ); 153 if ( empty( $array ) ) { 154 $array = array(); 155 } 156 return $array; 148 157 } 149 158 -
botnet-blocker/trunk/readme.txt
r1256133 r1256638 4 4 Requires at least: 4.0.0 5 5 Tested up to: 4.3.1 6 Stable tag: 1.2. 06 Stable tag: 1.2.1 7 7 License: GPLv2 8 8 … … 39 39 == Upgrade Notice == 40 40 41 = 1.2.1 = 42 Fixed preg_match errors in DNS matching 43 41 44 = 1.2.0 = 42 45 Allows ignoring all RBLs … … 50 53 51 54 == Changelog == 55 56 57 = 1.2.1 = 58 * Fixed preg_match errors in DNS matching 52 59 53 60 = 1.2.0 =
Note: See TracChangeset
for help on using the changeset viewer.