Version Description
Download this release
Release Info
Developer | error |
Plugin | Bad Behavior |
Version | 2.1.7 |
Comparing to | |
See all releases |
Code changes from version 2.1.6 to 2.1.7
bad-behavior-wordpress.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Bad Behavior
|
4 |
-
Version: 2.1.
|
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.1.7
|
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/cloudflare.inc.php
CHANGED
@@ -4,11 +4,9 @@
|
|
4 |
|
5 |
require_once(BB2_CORE . "/roundtripdns.inc.php");
|
6 |
|
7 |
-
function bb2_cloudflare(
|
8 |
{
|
9 |
-
if (bb2_roundtripdns($package['
|
10 |
-
$package['ip'] = preg_replace("/^::ffff:/", "", $package['headers_mixed']['Cf-Connecting-Ip']);
|
11 |
-
} else {
|
12 |
return '70e45496';
|
13 |
}
|
14 |
return false;
|
4 |
|
5 |
require_once(BB2_CORE . "/roundtripdns.inc.php");
|
6 |
|
7 |
+
function bb2_cloudflare($package)
|
8 |
{
|
9 |
+
if (!bb2_roundtripdns($package['cloudflare'], "cloudflare.com")) {
|
|
|
|
|
10 |
return '70e45496';
|
11 |
}
|
12 |
return false;
|
bad-behavior/core.inc.php
CHANGED
@@ -66,7 +66,12 @@ function bb2_start($settings)
|
|
66 |
|
67 |
$request_uri = $_SERVER["REQUEST_URI"];
|
68 |
if (!$request_uri) $request_uri = $_SERVER['SCRIPT_NAME']; # IIS
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
$result = bb2_screen($settings, $package);
|
72 |
if ($result && !defined('BB2_TEST')) bb2_banned($settings, $package, $result);
|
@@ -79,7 +84,7 @@ function bb2_screen($settings, $package)
|
|
79 |
// identification and boarding pass ready.
|
80 |
|
81 |
// Check for CloudFlare CDN since IP to be screened may be different
|
82 |
-
// Thanks to
|
83 |
if (array_key_exists('Cf-Connecting-Ip', $package['headers_mixed'])) {
|
84 |
require_once(BB2_CORE . "/cloudflare.inc.php");
|
85 |
$r = bb2_cloudflare($package);
|
66 |
|
67 |
$request_uri = $_SERVER["REQUEST_URI"];
|
68 |
if (!$request_uri) $request_uri = $_SERVER['SCRIPT_NAME']; # IIS
|
69 |
+
|
70 |
+
# Nasty CloudFlare hack provided by butchs at simplemachines
|
71 |
+
$ip_temp = preg_replace("/^::ffff:/", "", (array_key_exists('Cf-Connecting-Ip', $headers_mixed)) ? $_SERVER['HTTP_CF_CONNECTING_IP'] : $_SERVER['REMOTE_ADDR']);
|
72 |
+
$cloudflare_ip = preg_replace("/^::ffff:/", "", $_SERVER['REMOTE_ADDR']);
|
73 |
+
|
74 |
+
@$package = array('ip' => $ip_temp, 'headers' => $headers, 'headers_mixed' => $headers_mixed, 'request_method' => $_SERVER['REQUEST_METHOD'], 'request_uri' => $request_uri, 'server_protocol' => $_SERVER['SERVER_PROTOCOL'], 'request_entity' => $request_entity, 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'is_browser' => false, 'cloudflare' => $cloudflare_ip);
|
75 |
|
76 |
$result = bb2_screen($settings, $package);
|
77 |
if ($result && !defined('BB2_TEST')) bb2_banned($settings, $package, $result);
|
84 |
// identification and boarding pass ready.
|
85 |
|
86 |
// Check for CloudFlare CDN since IP to be screened may be different
|
87 |
+
// Thanks to butchs at Simple Machines
|
88 |
if (array_key_exists('Cf-Connecting-Ip', $package['headers_mixed'])) {
|
89 |
require_once(BB2_CORE . "/cloudflare.inc.php");
|
90 |
$r = bb2_cloudflare($package);
|
bad-behavior/msnbot.inc.php
CHANGED
@@ -9,7 +9,7 @@ function bb2_msnbot($package)
|
|
9 |
# if (match_cidr($package['ip'], "207.46.0.0/16") === FALSE && match_cidr($package['ip'], "65.52.0.0/14") === FALSE && match_cidr($package['ip'], "207.68.128.0/18") === FALSE && match_cidr($package['ip'], "207.68.192.0/20") === FALSE && match_cidr($package['ip'], "64.4.0.0/18") === FALSE) {
|
10 |
# return "e4de0453";
|
11 |
# }
|
12 |
-
if (!bb2_roundtripdns($package['ip'], "
|
13 |
return "e4de0453";
|
14 |
}
|
15 |
return false;
|
9 |
# if (match_cidr($package['ip'], "207.46.0.0/16") === FALSE && match_cidr($package['ip'], "65.52.0.0/14") === FALSE && match_cidr($package['ip'], "207.68.128.0/18") === FALSE && match_cidr($package['ip'], "207.68.192.0/20") === FALSE && match_cidr($package['ip'], "64.4.0.0/18") === FALSE) {
|
10 |
# return "e4de0453";
|
11 |
# }
|
12 |
+
if (!bb2_roundtripdns($package['ip'], "msn.com")) {
|
13 |
return "e4de0453";
|
14 |
}
|
15 |
return false;
|
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.1.
|
3 |
?>
|
1 |
<?php if (!defined('BB2_CWD')) die("I said no cheating!");
|
2 |
+
define('BB2_VERSION', "2.1.7");
|
3 |
?>
|