Bad Behavior - Version 2.0.26

Version Description

Download this release

Release Info

Developer error
Plugin Icon wp plugin Bad Behavior
Version 2.0.26
Comparing to
See all releases

Code changes from version 2.0.25 to 2.0.26

README.txt CHANGED
@@ -3,8 +3,8 @@ Tags: comment,trackback,referrer,spam,robot,antispam
3
  Contributors: error, MarkJaquith, Firas, skeltoac
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=error%40ioerror%2eus&item_name=Bad%20Behavior%20%28From%20WordPress%20Page%29&no_shipping=1&cn=Comments%20about%20Bad%20Behavior&tax=0&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8
5
  Requires at least: 1.2
6
- Tested up to: 2.7
7
- Stable tag: 2.0.25
8
 
9
  Welcome to a whole new way of keeping your blog, forum, guestbook, wiki or
10
  content management system free of link spam. Bad Behavior is a PHP-based
3
  Contributors: error, MarkJaquith, Firas, skeltoac
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=error%40ioerror%2eus&item_name=Bad%20Behavior%20%28From%20WordPress%20Page%29&no_shipping=1&cn=Comments%20about%20Bad%20Behavior&tax=0&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8
5
  Requires at least: 1.2
6
+ Tested up to: 2.8
7
+ Stable tag: 2.0.26
8
 
9
  Welcome to a whole new way of keeping your blog, forum, guestbook, wiki or
10
  content management system free of link spam. Bad Behavior is a PHP-based
bad-behavior-wordpress-admin.php CHANGED
@@ -167,7 +167,7 @@ Displaying all <strong><?php echo $totalcount; ?></strong> records<br/>
167
  echo "</td>\n";
168
  $headers = str_replace("\n", "<br/>\n", htmlspecialchars($result['http_headers']));
169
  if (@strpos($headers, $result['user_agent']) !== FALSE) $headers = substr_replace($headers, "<a href=\"" . add_query_arg("user_agent", rawurlencode($result["user_agent"]), remove_query_arg("paged", $request_uri)) . "\">" . $result['user_agent'] . "</a>", strpos($headers, $result['user_agent']), strlen($result['user_agent']));
170
- if (strpos($headers, $result['request_method']) !== FALSE) $headers = substr_replace($headers, "<a href=\"" . add_query_arg("request_method", rawurlencode($result["request_method"]), remove_query_arg("paged", $request_uri)) . "\">" . $result['request_method'] . "</a>", strpos($headers, $result['request_method']), strlen($result['request_method']));
171
  echo "<td>$headers</td>\n";
172
  echo "<td>" . str_replace("\n", "<br/>\n", htmlspecialchars($result["request_entity"])) . "</td>\n";
173
  echo "</tr>\n";
167
  echo "</td>\n";
168
  $headers = str_replace("\n", "<br/>\n", htmlspecialchars($result['http_headers']));
169
  if (@strpos($headers, $result['user_agent']) !== FALSE) $headers = substr_replace($headers, "<a href=\"" . add_query_arg("user_agent", rawurlencode($result["user_agent"]), remove_query_arg("paged", $request_uri)) . "\">" . $result['user_agent'] . "</a>", strpos($headers, $result['user_agent']), strlen($result['user_agent']));
170
+ if (@strpos($headers, $result['request_method']) !== FALSE) $headers = substr_replace($headers, "<a href=\"" . add_query_arg("request_method", rawurlencode($result["request_method"]), remove_query_arg("paged", $request_uri)) . "\">" . $result['request_method'] . "</a>", strpos($headers, $result['request_method']), strlen($result['request_method']));
171
  echo "<td>$headers</td>\n";
172
  echo "<td>" . str_replace("\n", "<br/>\n", htmlspecialchars($result["request_entity"])) . "</td>\n";
173
  echo "</tr>\n";
bad-behavior-wordpress.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Bad Behavior
4
- Version: 2.0.25
5
  Description: Deny automated spambots access to your PHP-based Web site.
6
  Plugin URI: http://www.bad-behavior.ioerror.us/
7
  Author: Michael Hampton
1
  <?php
2
  /*
3
  Plugin Name: Bad Behavior
4
+ Version: 2.0.26
5
  Description: Deny automated spambots access to your PHP-based Web site.
6
  Plugin URI: http://www.bad-behavior.ioerror.us/
7
  Author: Michael Hampton
bad-behavior/blackhole.inc.php CHANGED
@@ -1,8 +1,16 @@
1
  <?php if (!defined('BB2_CORE')) die('I said no cheating!');
2
 
 
 
 
 
 
3
  // Look up address on various blackhole lists.
4
  // These cannot be used for GET requests under any circumstances!
5
  function bb2_blackhole($package) {
 
 
 
6
  // Only conservative lists
7
  $bb2_blackhole_lists = array(
8
  "sbl-xbl.spamhaus.org", // All around nasties
@@ -36,6 +44,9 @@ function bb2_blackhole($package) {
36
  }
37
 
38
  function bb2_httpbl($settings, $package) {
 
 
 
39
  if (!$settings['httpbl_key']) return false;
40
 
41
  $find = implode('.', array_reverse(explode('.', $package['ip'])));
1
  <?php if (!defined('BB2_CORE')) die('I said no cheating!');
2
 
3
+ // Quick and dirty check for an IPv6 address
4
+ function is_ipv6($address) {
5
+ return (strpos($address, ":")) ? TRUE : FALSE;
6
+ }
7
+
8
  // Look up address on various blackhole lists.
9
  // These cannot be used for GET requests under any circumstances!
10
  function bb2_blackhole($package) {
11
+ // Can't use IPv6 addresses yet
12
+ if (is_ipv6($package['REMOTE_ADDR'])) return;
13
+
14
  // Only conservative lists
15
  $bb2_blackhole_lists = array(
16
  "sbl-xbl.spamhaus.org", // All around nasties
44
  }
45
 
46
  function bb2_httpbl($settings, $package) {
47
+ // Can't use IPv6 addresses yet
48
+ if (is_ipv6($package['REMOTE_ADDR'])) return;
49
+
50
  if (!$settings['httpbl_key']) return false;
51
 
52
  $find = implode('.', array_reverse(explode('.', $package['ip'])));
bad-behavior/msie.inc.php CHANGED
@@ -15,7 +15,8 @@ function bb2_msie($package)
15
 
16
  // MSIE does NOT send Connection: TE but Akamai does
17
  // Bypass this test when Akamai detected
18
- if (!array_key_exists('Akamai-Origin-Hop', $package['headers_mixed']) && @preg_match('/\bTE\b/i', $package['headers_mixed']['Connection'])) {
 
19
  return "2b90f772";
20
  }
21
 
15
 
16
  // MSIE does NOT send Connection: TE but Akamai does
17
  // Bypass this test when Akamai detected
18
+ // The latest version of IE for Windows CE also uses Connection: TE
19
+ if (!array_key_exists('Akamai-Origin-Hop', $package['headers_mixed']) && strpos($package['headers_mixed']['User-Agent'], "IEMobile") === FALSE && @preg_match('/\bTE\b/i', $package['headers_mixed']['Connection'])) {
20
  return "2b90f772";
21
  }
22
 
bad-behavior/version.inc.php CHANGED
@@ -1,3 +1,3 @@
1
  <?php if (!defined('BB2_CWD')) die("I said no cheating!");
2
- define('BB2_VERSION', "2.0.25");
3
  ?>
1
  <?php if (!defined('BB2_CWD')) die("I said no cheating!");
2
+ define('BB2_VERSION', "2.0.26");
3
  ?>