Bad Behavior - Version 2.2.17

Version Description

Download this release

Release Info

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

Code changes from version 2.2.16 to 2.2.17

README.txt CHANGED
@@ -2,9 +2,9 @@
2
  Tags: comment,trackback,referrer,spam,robot,antispam
3
  Contributors: error
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: 3.1
6
- Tested up to: 4.0.1
7
- Stable tag: 2.2.16
8
 
9
  Bad Behavior prevents spammers from ever delivering their junk, and in many
10
  cases, from ever reading your site in the first place.
2
  Tags: comment,trackback,referrer,spam,robot,antispam
3
  Contributors: error
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: 3.5
6
+ Tested up to: 4.4
7
+ Stable tag: 2.2.17
8
 
9
  Bad Behavior prevents spammers from ever delivering their junk, and in many
10
  cases, from ever reading your site in the first place.
bad-behavior-wordpress.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Bad Behavior
4
- Version: 2.2.16
5
  Description: Deny automated spambots access to your PHP-based Web site.
6
  Plugin URI: http://bad-behavior.ioerror.us/
7
  Author: Michael Hampton
@@ -76,7 +76,7 @@ function bb2_db_query($query) {
76
  $result = $wpdb->get_results($query, ARRAY_A);
77
  if ( defined('WP_DEBUG') and WP_DEBUG == true )
78
  $wpdb->show_errors();
79
- if (mysql_error()) {
80
  return FALSE;
81
  }
82
  return $result;
1
  <?php
2
  /*
3
  Plugin Name: Bad Behavior
4
+ Version: 2.2.17
5
  Description: Deny automated spambots access to your PHP-based Web site.
6
  Plugin URI: http://bad-behavior.ioerror.us/
7
  Author: Michael Hampton
76
  $result = $wpdb->get_results($query, ARRAY_A);
77
  if ( defined('WP_DEBUG') and WP_DEBUG == true )
78
  $wpdb->show_errors();
79
+ if ($wpdb->last_error) {
80
  return FALSE;
81
  }
82
  return $result;
bad-behavior/blacklist.inc.php CHANGED
@@ -6,6 +6,7 @@ function bb2_blacklist($package) {
6
  // These user agent strings occur at the beginning of the line.
7
  $bb2_spambots_0 = array(
8
  "8484 Boston Project", // video poker/porn spam
 
9
  "adwords", // referrer spam
10
  "autoemailspider", // spam harvester
11
  "blogsearchbot-martin", // from honeypot
@@ -77,6 +78,7 @@ function bb2_blacklist($package) {
77
  "<sc", // XSS exploit attempts
78
  "; Widows ", // misc comment/email spam
79
  "a href=", // referrer spam
 
80
  "Bad Behavior Test", // Add this to your user-agent to test BB
81
  "compatible ; MSIE", // misc comment/email spam
82
  "compatible-", // misc comment/email spam
6
  // These user agent strings occur at the beginning of the line.
7
  $bb2_spambots_0 = array(
8
  "8484 Boston Project", // video poker/porn spam
9
+ "ArchiveTeam", // ignores robots.txt and hammers server
10
  "adwords", // referrer spam
11
  "autoemailspider", // spam harvester
12
  "blogsearchbot-martin", // from honeypot
78
  "<sc", // XSS exploit attempts
79
  "; Widows ", // misc comment/email spam
80
  "a href=", // referrer spam
81
+ "ArchiveBot", // ignores robots.txt and hammers server
82
  "Bad Behavior Test", // Add this to your user-agent to test BB
83
  "compatible ; MSIE", // misc comment/email spam
84
  "compatible-", // misc comment/email spam
bad-behavior/core.inc.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php if (!defined('BB2_CWD')) die("I said no cheating!");
2
- define('BB2_VERSION', "2.2.16");
3
 
4
  // Bad Behavior entry point is bb2_start()
5
  // If you're reading this, you are probably lost.
@@ -68,6 +68,19 @@ function bb2_reverse_proxy($settings, $headers_mixed)
68
  return false;
69
  }
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  // Let God sort 'em out!
72
  function bb2_start($settings)
73
  {
@@ -87,6 +100,10 @@ function bb2_start($settings)
87
  $request_entity = array();
88
  if (!strcasecmp($_SERVER['REQUEST_METHOD'], "POST") || !strcasecmp($_SERVER['REQUEST_METHOD'], "PUT")) {
89
  foreach ($_POST as $h => $v) {
 
 
 
 
90
  $request_entity[$h] = $v;
91
  }
92
  }
1
  <?php if (!defined('BB2_CWD')) die("I said no cheating!");
2
+ define('BB2_VERSION', "2.2.17");
3
 
4
  // Bad Behavior entry point is bb2_start()
5
  // If you're reading this, you are probably lost.
68
  return false;
69
  }
70
 
71
+ # FIXME: Bug #12. But this code doesn't currently work.
72
+ function bb2_unpack_php_post_array($key, $value)
73
+ {
74
+ $unpacked = array();
75
+ foreach ($value as $k => $v) {
76
+ $i = $key. '[' . $k . ']';
77
+ if (is_array($v))
78
+ $v = bb2_unpack_php_post_array($i, $v);
79
+ $unpacked[$i] = $v;
80
+ }
81
+ return $unpacked;
82
+ }
83
+
84
  // Let God sort 'em out!
85
  function bb2_start($settings)
86
  {
100
  $request_entity = array();
101
  if (!strcasecmp($_SERVER['REQUEST_METHOD'], "POST") || !strcasecmp($_SERVER['REQUEST_METHOD'], "PUT")) {
102
  foreach ($_POST as $h => $v) {
103
+ if (is_array($v)) {
104
+ # Workaround, see Bug #12
105
+ $v = "Array";
106
+ }
107
  $request_entity[$h] = $v;
108
  }
109
  }
bad-behavior/post.inc.php CHANGED
@@ -58,6 +58,8 @@ function bb2_post($settings, $package)
58
  $url = parse_url($package['headers_mixed']['Referer']);
59
  $url['host'] = preg_replace('|^www\.|', '', $url['host']);
60
  $host = preg_replace('|^www\.|', '', $package['headers_mixed']['Host']);
 
 
61
  if (strcasecmp($host, $url['host'])) {
62
  return "cd361abb";
63
  }
58
  $url = parse_url($package['headers_mixed']['Referer']);
59
  $url['host'] = preg_replace('|^www\.|', '', $url['host']);
60
  $host = preg_replace('|^www\.|', '', $package['headers_mixed']['Host']);
61
+ # Strip port
62
+ $host = preg_replace('|:\d+$|', '', $host);
63
  if (strcasecmp($host, $url['host'])) {
64
  return "cd361abb";
65
  }