Bad Behavior - Version 2.0.29

Version Description

Download this release

Release Info

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

Code changes from version 2.0.28 to 2.0.29

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.8
7
- Stable tag: 2.0.28
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
@@ -87,11 +87,11 @@ wp-content/plugins/wp-super-cache/wp-cache-phase1.php file and find the
87
  following two lines at around line 34 (line 56 in WP-Super Cache):
88
 
89
  ` if (! ($meta = unserialize(@file_get_contents($meta_pathname))) )
90
- return;`
91
 
92
  Immediately after this, insert the following line:
93
 
94
- ` require_once( ABSPATH . 'wp-content/plugins/Bad-Behavior/bad-behavior-generic.php');`
95
 
96
  Then visit your site. Everything should work normally, but spammers will
97
  not be able to access your cached pages either.
@@ -100,3 +100,4 @@ not be able to access your cached pages either.
100
  warnings when Spam Karma 2 displays its internally generated CAPTCHA. This
101
  is a design problem in Spam Karma 2. Contact the author of Spam Karma 2 for
102
  a fix.
 
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.4
7
+ Stable tag: 2.0.29
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
87
  following two lines at around line 34 (line 56 in WP-Super Cache):
88
 
89
  ` if (! ($meta = unserialize(@file_get_contents($meta_pathname))) )
90
+ return true;`
91
 
92
  Immediately after this, insert the following line:
93
 
94
+ ` require_once( ABSPATH . 'wp-content/plugins/Bad-Behavior/bad-behavior-generic.php');`
95
 
96
  Then visit your site. Everything should work normally, but spammers will
97
  not be able to access your cached pages either.
100
  warnings when Spam Karma 2 displays its internally generated CAPTCHA. This
101
  is a design problem in Spam Karma 2. Contact the author of Spam Karma 2 for
102
  a fix.
103
+
bad-behavior-generic.php CHANGED
@@ -41,6 +41,7 @@ $bb2_settings_defaults = array(
41
  'httpbl_key' => '',
42
  'httpbl_threat' => '25',
43
  'httpbl_maxage' => '30',
 
44
  );
45
 
46
  // Bad Behavior callback functions.
41
  'httpbl_key' => '',
42
  'httpbl_threat' => '25',
43
  'httpbl_maxage' => '30',
44
+ 'offsite_forms' => false,
45
  );
46
 
47
  // Bad Behavior callback functions.
bad-behavior-lifetype.php CHANGED
@@ -105,6 +105,7 @@
105
  $httpbl_key = $config->getValue( 'bb2_httpbl_key', '' );
106
  $httpbl_threat = $config->getValue( 'bb2_httpbl_threat', '25' );
107
  $httpbl_maxage = $config->getValue( 'bb2_httpbl_maxage', '30' );
 
108
 
109
  return array('log_table' => $prefix . $logTable,
110
  'display_stats' => $displayStats,
@@ -114,6 +115,7 @@
114
  'httpbl_key' => $httpbl_key,
115
  'httpbl_threat' => $httpbl_threat,
116
  'httpbl_maxage' => $httpbl_maxage,
 
117
  'is_installed' => $isInstalled );
118
  }
119
 
@@ -128,6 +130,7 @@
128
  $config->setValue( 'bb2_httpbl_key', $settings['httpbl_key'] );
129
  $config->setValue( 'bb2_httpbl_threat', $settings['httpbl_threat'] );
130
  $config->setValue( 'bb2_httpbl_maxage', $settings['httpbl_maxage'] );
 
131
  $config->setValue( 'bb2_installed', $settings['is_installed'] );
132
  $config->save();
133
  }
105
  $httpbl_key = $config->getValue( 'bb2_httpbl_key', '' );
106
  $httpbl_threat = $config->getValue( 'bb2_httpbl_threat', '25' );
107
  $httpbl_maxage = $config->getValue( 'bb2_httpbl_maxage', '30' );
108
+ $offsite_forms = $config->getValue( 'offsite_forms', false );
109
 
110
  return array('log_table' => $prefix . $logTable,
111
  'display_stats' => $displayStats,
115
  'httpbl_key' => $httpbl_key,
116
  'httpbl_threat' => $httpbl_threat,
117
  'httpbl_maxage' => $httpbl_maxage,
118
+ 'offsite_forms' => $offsite_forms,
119
  'is_installed' => $isInstalled );
120
  }
121
 
130
  $config->setValue( 'bb2_httpbl_key', $settings['httpbl_key'] );
131
  $config->setValue( 'bb2_httpbl_threat', $settings['httpbl_threat'] );
132
  $config->setValue( 'bb2_httpbl_maxage', $settings['httpbl_maxage'] );
133
+ $config->setValue( 'bb2_offsite_forms', $settings['offsite_forms'] );
134
  $config->setValue( 'bb2_installed', $settings['is_installed'] );
135
  $config->save();
136
  }
bad-behavior-mediawiki.php CHANGED
@@ -34,6 +34,7 @@ $bb2_settings_defaults = array(
34
  'httpbl_key' => '',
35
  'httpbl_threat' => '25',
36
  'httpbl_maxage' => '30',
 
37
  );
38
 
39
  define('BB2_CWD', dirname(__FILE__));
34
  'httpbl_key' => '',
35
  'httpbl_threat' => '25',
36
  'httpbl_maxage' => '30',
37
+ 'offsite_forms' => false,
38
  );
39
 
40
  define('BB2_CWD', dirname(__FILE__));
bad-behavior-wordpress-admin.php CHANGED
@@ -238,6 +238,11 @@ function bb2_options()
238
  } else {
239
  $settings['httpbl_maxage'] = '30';
240
  }
 
 
 
 
 
241
  bb2_write_settings($settings);
242
  ?>
243
  <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div>
@@ -263,9 +268,10 @@ function bb2_options()
263
  <tr><td><label><input type="radio" name="logging" value="false" <?php if (!$settings['logging']) { ?>checked="checked" <?php } ?>/> <?php _e('Do not log HTTP requests (not recommended)'); ?></label></td></tr>
264
  </table>
265
 
266
- <h3><?php _e('Strict Mode'); ?></h3>
267
  <table class="form-table">
268
  <tr><td><label><input type="checkbox" name="strict" value="true" <?php if ($settings['strict']) { ?>checked="checked" <?php } ?>/> <?php _e('Strict checking (blocks more spam but may block some people)'); ?></label></td></tr>
 
269
  </table>
270
 
271
  <h3><?php _e('http:BL'); ?></h3>
238
  } else {
239
  $settings['httpbl_maxage'] = '30';
240
  }
241
+ if ($_POST['offsite_forms']) {
242
+ $settings['offsite_forms'] = true;
243
+ } else {
244
+ $settings['offsite_forms'] = false;
245
+ }
246
  bb2_write_settings($settings);
247
  ?>
248
  <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div>
268
  <tr><td><label><input type="radio" name="logging" value="false" <?php if (!$settings['logging']) { ?>checked="checked" <?php } ?>/> <?php _e('Do not log HTTP requests (not recommended)'); ?></label></td></tr>
269
  </table>
270
 
271
+ <h3><?php _e('Security'); ?></h3>
272
  <table class="form-table">
273
  <tr><td><label><input type="checkbox" name="strict" value="true" <?php if ($settings['strict']) { ?>checked="checked" <?php } ?>/> <?php _e('Strict checking (blocks more spam but may block some people)'); ?></label></td></tr>
274
+ <tr><td><label><input type="checkbox" name="offsite_forms" value="true" <?php if ($settings['offsite_forms']) { ?>checked="checked" <?php } ?>/> <?php _e('Allow form postings from other web sites (required for OpenID; increases spam received)'); ?></label></td></tr>
275
  </table>
276
 
277
  <h3><?php _e('http:BL'); ?></h3>
bad-behavior-wordpress.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Bad Behavior
4
- Version: 2.0.28
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
@@ -106,7 +106,7 @@ function bb2_read_settings() {
106
  // Add in default settings when they aren't yet present in WP
107
  $settings = get_settings('bad_behavior_settings');
108
  if (!$settings) $settings = array();
109
- return array_merge(array('log_table' => $wpdb->prefix . 'bad_behavior', 'display_stats' => true, 'strict' => false, 'verbose' => false, 'logging' => true, 'httpbl_key' => '', 'httpbl_threat' => '25', 'httpbl_maxage' => '30',), $settings);
110
  }
111
 
112
  // write settings to database
1
  <?php
2
  /*
3
  Plugin Name: Bad Behavior
4
+ Version: 2.0.29
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
106
  // Add in default settings when they aren't yet present in WP
107
  $settings = get_settings('bad_behavior_settings');
108
  if (!$settings) $settings = array();
109
+ return array_merge(array('log_table' => $wpdb->prefix . 'bad_behavior', 'display_stats' => true, 'strict' => false, 'verbose' => false, 'logging' => true, 'httpbl_key' => '', 'httpbl_threat' => '25', 'httpbl_maxage' => '30', 'offsite_forms' => false), $settings);
110
  }
111
 
112
  // write settings to database
bad-behavior/common_tests.inc.php CHANGED
@@ -51,7 +51,7 @@ function bb2_misc_headers($settings, $package)
51
  // NOTE: this blocks the whois.sc bot. No big loss.
52
  // Exceptions: MT (not fixable); LJ (refuses to fix; may be
53
  // blocked again in the future)
54
- if (array_key_exists('Range', $package['headers_mixed']) && strpos($package['headers_mixed']['Range'], "=0-") !== FALSE) {
55
  if (strncmp($ua, "MovableType", 11) && strncmp($ua, "URI::Fetch", 10) && strncmp($ua, "php-openid/", 11)) {
56
  return "7ad04a8a";
57
  }
51
  // NOTE: this blocks the whois.sc bot. No big loss.
52
  // Exceptions: MT (not fixable); LJ (refuses to fix; may be
53
  // blocked again in the future)
54
+ if ($settings['strict'] && array_key_exists('Range', $package['headers_mixed']) && strpos($package['headers_mixed']['Range'], "=0-") !== FALSE) {
55
  if (strncmp($ua, "MovableType", 11) && strncmp($ua, "URI::Fetch", 10) && strncmp($ua, "php-openid/", 11)) {
56
  return "7ad04a8a";
57
  }
bad-behavior/post.inc.php CHANGED
@@ -30,7 +30,7 @@ function bb2_post($settings, $package)
30
  }
31
 
32
  // If Referer exists, it should refer to a page on our site
33
- if (array_key_exists('Referer', $package['headers_mixed']) && stripos($package['headers_mixed']['Referer'], $package['headers_mixed']['Host']) === FALSE) {
34
  return "cd361abb";
35
  }
36
 
30
  }
31
 
32
  // If Referer exists, it should refer to a page on our site
33
+ if ($settings['offsite_forms'] && array_key_exists('Referer', $package['headers_mixed']) && stripos($package['headers_mixed']['Referer'], $package['headers_mixed']['Host']) === FALSE) {
34
  return "cd361abb";
35
  }
36
 
bad-behavior/responses.inc.php CHANGED
@@ -17,7 +17,7 @@ function bb2_get_response($key) {
17
  '45b35e30' => array('response' => 403, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Header \'Referer\' is corrupt'),
18
  '57796684' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. Before trying again, run anti-virus and anti-spyware software and remove any viruses and spyware from your computer.', 'log' => 'Prohibited header \'X-Aaaaaaaaaa\' or \'X-Aaaaaaaaaaaa\' present'),
19
  '582ec5e4' => array('response' => 400, 'explanation' => 'An invalid request was received. If you are using a proxy server, bypass the proxy server or contact your proxy server administrator. This may also be caused by a bug in the Opera web browser.', 'log' => '"Header \'TE\' present but TE not specified in \'Connection\' header'),
20
- '69920ee5' => array('response' => 403, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Header \'Referer\' present but blank'),
21
  '6c502ff1' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'Bot not fully compliant with RFC 2965'),
22
  '799165c2' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'Rotating user-agents detected'),
23
  '7a06532b' => array('response' => 400, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Required header \'Accept-Encoding\' missing'),
17
  '45b35e30' => array('response' => 403, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Header \'Referer\' is corrupt'),
18
  '57796684' => array('response' => 403, 'explanation' => 'You do not have permission to access this server. Before trying again, run anti-virus and anti-spyware software and remove any viruses and spyware from your computer.', 'log' => 'Prohibited header \'X-Aaaaaaaaaa\' or \'X-Aaaaaaaaaaaa\' present'),
19
  '582ec5e4' => array('response' => 400, 'explanation' => 'An invalid request was received. If you are using a proxy server, bypass the proxy server or contact your proxy server administrator. This may also be caused by a bug in the Opera web browser.', 'log' => '"Header \'TE\' present but TE not specified in \'Connection\' header'),
20
+ '69920ee5' => array('response' => 400, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Header \'Referer\' present but blank'),
21
  '6c502ff1' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'Bot not fully compliant with RFC 2965'),
22
  '799165c2' => array('response' => 403, 'explanation' => 'You do not have permission to access this server.', 'log' => 'Rotating user-agents detected'),
23
  '7a06532b' => array('response' => 400, 'explanation' => 'An invalid request was received from your browser. This may be caused by a malfunctioning proxy server or browser privacy software.', 'log' => 'Required header \'Accept-Encoding\' missing'),
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.28");
3
  ?>
1
  <?php if (!defined('BB2_CWD')) die("I said no cheating!");
2
+ define('BB2_VERSION', "2.0.29");
3
  ?>