Version Description
Download this release
Release Info
Developer | error |
Plugin | Bad Behavior |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.1
- bad-behavior-accept.php +3 -0
- bad-behavior-banned.php +4 -4
- bad-behavior-core.php +17 -0
- bad-behavior-database.php +23 -2
- bad-behavior-google.php +14 -0
- bad-behavior-http-headers.php +3 -0
- bad-behavior-konqueror.php +3 -0
- bad-behavior-lynx.php +3 -0
- bad-behavior-mediawiki.php +30 -2
- bad-behavior-movabletype.php +3 -2
- bad-behavior-mozilla.php +3 -0
- bad-behavior-msie.php +3 -0
- bad-behavior-msnbot.php +14 -0
- bad-behavior-opera.php +3 -0
- bad-behavior-referer.php +3 -0
- bad-behavior-safari.php +3 -0
- bad-behavior-user-agent.php +4 -1
- bad-behavior-wordpress.php +3 -2
- bad-behavior/COPYING +0 -339
- bad-behavior/README.txt +0 -41
- bad-behavior/bad-behavior-accept.php +0 -37
- bad-behavior/bad-behavior-banned.php +0 -71
- bad-behavior/bad-behavior-core.php +0 -102
- bad-behavior/bad-behavior-database.php +0 -67
- bad-behavior/bad-behavior-functions.php +0 -46
- bad-behavior/bad-behavior-generic.php +0 -76
- bad-behavior/bad-behavior-http-headers.php +0 -32
- bad-behavior/bad-behavior-konqueror.php +0 -20
- bad-behavior/bad-behavior-lynx.php +0 -10
- bad-behavior/bad-behavior-mediawiki.php +0 -76
- bad-behavior/bad-behavior-movabletype.php +0 -22
- bad-behavior/bad-behavior-mozilla.php +0 -20
- bad-behavior/bad-behavior-msie.php +0 -28
- bad-behavior/bad-behavior-opera.php +0 -10
- bad-behavior/bad-behavior-php4.php +0 -10
- bad-behavior/bad-behavior-referer.php +0 -22
- bad-behavior/bad-behavior-safari.php +0 -9
- bad-behavior/bad-behavior-user-agent.php +0 -56
- bad-behavior/bad-behavior-wordpress.php +0 -93
bad-behavior-accept.php
CHANGED
@@ -2,6 +2,9 @@
|
|
2 |
|
3 |
// Check for various Accept: headers
|
4 |
|
|
|
|
|
|
|
5 |
function wp_bb_check_accept() {
|
6 |
global $wp_bb_http_headers_mixed;
|
7 |
if (!array_key_exists('Accept', $wp_bb_http_headers_mixed)) {
|
2 |
|
3 |
// Check for various Accept: headers
|
4 |
|
5 |
+
if (!defined('WP_BB_CWD'))
|
6 |
+
die('');
|
7 |
+
|
8 |
function wp_bb_check_accept() {
|
9 |
global $wp_bb_http_headers_mixed;
|
10 |
if (!array_key_exists('Accept', $wp_bb_http_headers_mixed)) {
|
bad-behavior-banned.php
CHANGED
@@ -17,7 +17,7 @@ function wp_bb_banned() {
|
|
17 |
<body>
|
18 |
<h1>Precondition Failed</h1>
|
19 |
<p>We're sorry, but we could not fulfill your request for
|
20 |
-
<?php echo $wp_bb_request_uri ?> on this server.</p>
|
21 |
<p>We have established rules for access to this server, and any person or robot
|
22 |
that violates these rules will be unable to access this site.</p>
|
23 |
<p>To resolve this problem, please try the following steps:</p>
|
@@ -37,7 +37,7 @@ your downloads anyway; in most cases, they actually run slower!</li>
|
|
37 |
<li>If all else fails, try using a different Web browser, such as
|
38 |
<a href="http://www.spreadfirefox.com/?q=affiliates&id=32135&t=71">Firefox</a>.</li>
|
39 |
</ul>
|
40 |
-
<p>If you still need assistance, please contact <a href="mailto:<?php echo str_replace("@", "
|
41 |
<h2>More Information</h2>
|
42 |
<p>For your reference, the conditions for access to this server are:</p>
|
43 |
<h3>Robots:</h3>
|
@@ -60,9 +60,9 @@ malicious software.</li>
|
|
60 |
<li>MUST NOT use excessive amounts of bandwidth or other server resources.</li>
|
61 |
</ul>
|
62 |
<p>The precondition on the request for the URL
|
63 |
-
<?php echo $wp_bb_request_uri; ?> evaluated to false.</p>
|
64 |
<hr>
|
65 |
-
<?php echo $wp_bb_server_signature; ?>
|
66 |
</body>
|
67 |
</html>
|
68 |
<?php
|
17 |
<body>
|
18 |
<h1>Precondition Failed</h1>
|
19 |
<p>We're sorry, but we could not fulfill your request for
|
20 |
+
<?php echo htmlspecialchars($wp_bb_request_uri) ?> on this server.</p>
|
21 |
<p>We have established rules for access to this server, and any person or robot
|
22 |
that violates these rules will be unable to access this site.</p>
|
23 |
<p>To resolve this problem, please try the following steps:</p>
|
37 |
<li>If all else fails, try using a different Web browser, such as
|
38 |
<a href="http://www.spreadfirefox.com/?q=affiliates&id=32135&t=71">Firefox</a>.</li>
|
39 |
</ul>
|
40 |
+
<p>If you still need assistance, please contact <a href="mailto:<?php echo htmlspecialchars(str_replace("@", "+nospam@nospam.", $wp_bb_email)); ?>"><?php echo htmlspecialchars(str_replace("@", " at ", $wp_bb_email)); ?></a>.</p>
|
41 |
<h2>More Information</h2>
|
42 |
<p>For your reference, the conditions for access to this server are:</p>
|
43 |
<h3>Robots:</h3>
|
60 |
<li>MUST NOT use excessive amounts of bandwidth or other server resources.</li>
|
61 |
</ul>
|
62 |
<p>The precondition on the request for the URL
|
63 |
+
<?php echo htmlspecialchars($wp_bb_request_uri); ?> evaluated to false.</p>
|
64 |
<hr>
|
65 |
+
<?php echo htmlspecialchars($wp_bb_server_signature); ?>
|
66 |
</body>
|
67 |
</html>
|
68 |
<?php
|
bad-behavior-core.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
require_once(WP_BB_CWD . "/bad-behavior-functions.php");
|
4 |
|
5 |
// Write to the log file.
|
@@ -52,6 +55,13 @@ foreach ($wp_bb_http_headers as $wp_bb_header => $wp_bb_value) {
|
|
52 |
$wp_bb_headers .= "$wp_bb_header: $wp_bb_value\n";
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
// Postprocess the headers to mixed-case
|
56 |
// FIXME: get the world to stop using PHP as CGI
|
57 |
foreach ($wp_bb_http_headers as $h=>$v)
|
@@ -68,6 +78,13 @@ if (stripos($wp_bb_http_user_agent, "MSIE") !== FALSE) {
|
|
68 |
require_once(WP_BB_CWD . "/bad-behavior-opera.php");
|
69 |
}
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
// Now analyze requests coming from "Konqueror"
|
72 |
elseif (stripos($wp_bb_http_user_agent, "Konqueror") !== FALSE) {
|
73 |
require_once(WP_BB_CWD . "/bad-behavior-konqueror.php");
|
1 |
<?php
|
2 |
|
3 |
+
if (!defined('WP_BB_CWD'))
|
4 |
+
die('');
|
5 |
+
|
6 |
require_once(WP_BB_CWD . "/bad-behavior-functions.php");
|
7 |
|
8 |
// Write to the log file.
|
55 |
$wp_bb_headers .= "$wp_bb_header: $wp_bb_value\n";
|
56 |
}
|
57 |
|
58 |
+
// Reconstruct the HTTP entity, if present.
|
59 |
+
if (!strcasecmp($wp_bb_request_method, "POST")) {
|
60 |
+
foreach ($_POST as $wp_bb_header => $wp_bb_value) {
|
61 |
+
$wp_bb_request_entity .= "$wp_bb_header: $wp_bb_value\n";
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
// Postprocess the headers to mixed-case
|
66 |
// FIXME: get the world to stop using PHP as CGI
|
67 |
foreach ($wp_bb_http_headers as $h=>$v)
|
78 |
require_once(WP_BB_CWD . "/bad-behavior-opera.php");
|
79 |
}
|
80 |
}
|
81 |
+
elseif (stripos($wp_bb_http_user_agent, "msnbot") !== FALSE) {
|
82 |
+
require_once(WP_BB_CWD . "/bad-behavior-msnbot.php");
|
83 |
+
}
|
84 |
+
elseif (stripos($wp_bb_http_user_agent, "Googlebot") !== FALSE ||
|
85 |
+
stripos($wp_bb_http_user_agent, "Mediapartners-Google") !== FALSE) {
|
86 |
+
require_once(WP_BB_CWD . "/bad-behavior-googlebot.php");
|
87 |
+
}
|
88 |
// Now analyze requests coming from "Konqueror"
|
89 |
elseif (stripos($wp_bb_http_user_agent, "Konqueror") !== FALSE) {
|
90 |
require_once(WP_BB_CWD . "/bad-behavior-konqueror.php");
|
bad-behavior-database.php
CHANGED
@@ -3,11 +3,17 @@
|
|
3 |
// Database functions. This needs review to ensure it isn't MySQL specific;
|
4 |
// it certainly is right now.
|
5 |
|
|
|
|
|
|
|
6 |
$wp_bb_log = "bad_behavior_log";
|
7 |
|
8 |
function wp_bb_db_create_tables() {
|
9 |
global $wp_bb_log, $wp_bb_db_failure;
|
10 |
|
|
|
|
|
|
|
11 |
$query = "CREATE TABLE IF NOT EXISTS `$wp_bb_log` (
|
12 |
`id` int(11) NOT NULL auto_increment,
|
13 |
`ip` text NOT NULL,
|
@@ -24,6 +30,14 @@ function wp_bb_db_create_tables() {
|
|
24 |
if (wp_bb_db_query($query) === FALSE) {
|
25 |
$wp_bb_db_failure = TRUE;
|
26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
function wp_bb_db_clear_old_entries() {
|
@@ -46,17 +60,24 @@ function wp_bb_db_log($response) {
|
|
46 |
global $wp_bb_remote_addr, $wp_bb_request_method, $wp_bb_http_host;
|
47 |
global $wp_bb_request_uri, $wp_bb_server_protocol, $wp_bb_http_referer;
|
48 |
global $wp_bb_http_user_agent, $wp_bb_headers, $wp_bb_log;
|
|
|
49 |
|
50 |
// Sanitize input
|
|
|
|
|
|
|
51 |
$request_uri = wp_bb_db_sanitize($wp_bb_request_uri);
|
|
|
52 |
$referer = wp_bb_db_sanitize($wp_bb_http_referer);
|
53 |
$user_agent = wp_bb_db_sanitize($wp_bb_http_user_agent);
|
54 |
$headers = wp_bb_db_sanitize($wp_bb_headers);
|
|
|
|
|
55 |
|
56 |
$date = wp_bb_date();
|
57 |
$query = "INSERT INTO `$wp_bb_log`
|
58 |
-
(`ip`, `date`, `request_method`, `http_host`, `request_uri`, `server_protocol`, `http_referer`, `http_user_agent`, `http_headers`, `http_response`) VALUES
|
59 |
-
('$
|
60 |
if (wp_bb_db_query($query) === FALSE) {
|
61 |
$wp_bb_db_failure = TRUE;
|
62 |
}
|
3 |
// Database functions. This needs review to ensure it isn't MySQL specific;
|
4 |
// it certainly is right now.
|
5 |
|
6 |
+
if (!defined('WP_BB_CWD'))
|
7 |
+
die('');
|
8 |
+
|
9 |
$wp_bb_log = "bad_behavior_log";
|
10 |
|
11 |
function wp_bb_db_create_tables() {
|
12 |
global $wp_bb_log, $wp_bb_db_failure;
|
13 |
|
14 |
+
if (defined("WP_BB_NO_CREATE"))
|
15 |
+
return;
|
16 |
+
|
17 |
$query = "CREATE TABLE IF NOT EXISTS `$wp_bb_log` (
|
18 |
`id` int(11) NOT NULL auto_increment,
|
19 |
`ip` text NOT NULL,
|
30 |
if (wp_bb_db_query($query) === FALSE) {
|
31 |
$wp_bb_db_failure = TRUE;
|
32 |
}
|
33 |
+
// Upgrades from 1.0
|
34 |
+
$query = "DESCRIBE `bad_behavior_log` `request_entity`;";
|
35 |
+
if (wp_bb_db_query($query) == 0) {
|
36 |
+
$query = "ALTER TABLE `bad_behavior_log` ADD `request_entity` TEXT AFTER `http_headers`;";
|
37 |
+
if (wp_bb_db_query($query) === FALSE) {
|
38 |
+
$wp_bb_db_failure = TRUE;
|
39 |
+
}
|
40 |
+
}
|
41 |
}
|
42 |
|
43 |
function wp_bb_db_clear_old_entries() {
|
60 |
global $wp_bb_remote_addr, $wp_bb_request_method, $wp_bb_http_host;
|
61 |
global $wp_bb_request_uri, $wp_bb_server_protocol, $wp_bb_http_referer;
|
62 |
global $wp_bb_http_user_agent, $wp_bb_headers, $wp_bb_log;
|
63 |
+
global $wp_bb_request_entity;
|
64 |
|
65 |
// Sanitize input
|
66 |
+
$remote_addr = wp_bb_db_sanitize($wp_bb_remote_addr);
|
67 |
+
$request_method = wp_bb_db_sanitize($wp_bb_request_method);
|
68 |
+
$host = wp_bb_db_sanitize($wp_bb_http_host);
|
69 |
$request_uri = wp_bb_db_sanitize($wp_bb_request_uri);
|
70 |
+
$server_protocol = wp_bb_db_sanitize($wp_bb_server_protocol);
|
71 |
$referer = wp_bb_db_sanitize($wp_bb_http_referer);
|
72 |
$user_agent = wp_bb_db_sanitize($wp_bb_http_user_agent);
|
73 |
$headers = wp_bb_db_sanitize($wp_bb_headers);
|
74 |
+
$request_entity = wp_bb_db_sanitize($wp_bb_request_entity);
|
75 |
+
$response = intval($response);
|
76 |
|
77 |
$date = wp_bb_date();
|
78 |
$query = "INSERT INTO `$wp_bb_log`
|
79 |
+
(`ip`, `date`, `request_method`, `http_host`, `request_uri`, `server_protocol`, `http_referer`, `http_user_agent`, `http_headers`, `request_entity`, `http_response`) VALUES
|
80 |
+
('$remote_addr', '$date', '$request_method', '$host', '$request_uri', '$server_protocol', '$referer', '$user_agent', '$headers', '$request_entity', '$response')";
|
81 |
if (wp_bb_db_query($query) === FALSE) {
|
82 |
$wp_bb_db_failure = TRUE;
|
83 |
}
|
bad-behavior-google.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// This file is included only when the user-agent is claiming to be Google
|
4 |
+
|
5 |
+
if (!defined('WP_BB_CWD'))
|
6 |
+
die('');
|
7 |
+
|
8 |
+
// require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
9 |
+
|
10 |
+
if (matchCIDR($wp_bb_remote_addr, "66.249.64.0/19") === FALSE) {
|
11 |
+
wp_bb_spammer();
|
12 |
+
}
|
13 |
+
|
14 |
+
?>
|
bad-behavior-http-headers.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
// Analyze the headers of all user-agents
|
4 |
// These checks apply to any user-agent regardless of identification
|
5 |
|
1 |
<?php
|
2 |
|
3 |
+
if (!defined('WP_BB_CWD'))
|
4 |
+
die('');
|
5 |
+
|
6 |
// Analyze the headers of all user-agents
|
7 |
// These checks apply to any user-agent regardless of identification
|
8 |
|
bad-behavior-konqueror.php
CHANGED
@@ -4,6 +4,9 @@
|
|
4 |
// (or some variant thereof). We check the HTTP headers to see if it really
|
5 |
// is Konqueror.
|
6 |
|
|
|
|
|
|
|
7 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
8 |
|
9 |
// CafeKelsa is a dev project at Yahoo which indexes job listings for
|
4 |
// (or some variant thereof). We check the HTTP headers to see if it really
|
5 |
// is Konqueror.
|
6 |
|
7 |
+
if (!defined('WP_BB_CWD'))
|
8 |
+
die('');
|
9 |
+
|
10 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
11 |
|
12 |
// CafeKelsa is a dev project at Yahoo which indexes job listings for
|
bad-behavior-lynx.php
CHANGED
@@ -2,6 +2,9 @@
|
|
2 |
|
3 |
// Analyze user agents claiming to be Lynx
|
4 |
|
|
|
|
|
|
|
5 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
6 |
|
7 |
wp_bb_check_accept();
|
2 |
|
3 |
// Analyze user agents claiming to be Lynx
|
4 |
|
5 |
+
if (!defined('WP_BB_CWD'))
|
6 |
+
die('');
|
7 |
+
|
8 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
9 |
|
10 |
wp_bb_check_accept();
|
bad-behavior-mediawiki.php
CHANGED
@@ -26,11 +26,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
26 |
// be initialized, but no output sent to the browser. If output has been
|
27 |
// sent, Bad Behavior will fail.
|
28 |
|
|
|
|
|
|
|
29 |
###############################################################################
|
30 |
###############################################################################
|
31 |
|
32 |
// Configuration
|
33 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
// Log failed requests to the database.
|
36 |
$wp_bb_logging = TRUE;
|
@@ -71,6 +81,24 @@ function wp_bb_db_query($query) {
|
|
71 |
}
|
72 |
|
73 |
// Load core functions and do initial checks
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
?>
|
26 |
// be initialized, but no output sent to the browser. If output has been
|
27 |
// sent, Bad Behavior will fail.
|
28 |
|
29 |
+
if (!defined('MEDIAWIKI'))
|
30 |
+
die('');
|
31 |
+
|
32 |
###############################################################################
|
33 |
###############################################################################
|
34 |
|
35 |
// Configuration
|
36 |
+
// To change the following settings, override them in MediaWiki's
|
37 |
+
// LocalSettings.php after including this file.
|
38 |
+
|
39 |
+
// In some configurations the automatic table creation may fail.
|
40 |
+
// You can create the table manually (see query in bad-behavior-database.php)
|
41 |
+
// and add this line to your LocalSettings.php:
|
42 |
+
//
|
43 |
+
// define('WP_BB_NO_CREATE', true);
|
44 |
|
45 |
// Log failed requests to the database.
|
46 |
$wp_bb_logging = TRUE;
|
81 |
}
|
82 |
|
83 |
// Load core functions and do initial checks
|
84 |
+
// This will be run during extension initialization at the end of Setup.php
|
85 |
+
function wp_bb_mediawiki_run() {
|
86 |
+
// globals defined here
|
87 |
+
global $wp_bb_logging, $wp_bb_verbose_logging, $wp_bb_logging_duration, $wp_bb_email;
|
88 |
+
|
89 |
+
// globals defined in core
|
90 |
+
global $wp_bb_approved, $wp_bb_db_failure, $wp_bb_log;
|
91 |
+
global $wp_bb_remote_addr, $wp_bb_request_method, $wp_bb_http_host;
|
92 |
+
global $wp_bb_request_uri, $wp_bb_server_protocol, $wp_bb_http_referer;
|
93 |
+
global $wp_bb_http_user_agent, $wp_bb_server_signature;
|
94 |
+
global $wp_bb_headers, $wp_bb_http_headers, $wp_bb_http_headers_mixed;
|
95 |
+
global $wp_bb_request_entity;
|
96 |
+
|
97 |
+
// Don't try to run for command-line maintenance scripts.
|
98 |
+
if (php_sapi_name() != 'cli')
|
99 |
+
require_once(WP_BB_CWD . "/bad-behavior-core.php");
|
100 |
+
}
|
101 |
+
|
102 |
+
$wgExtensionFunctions[] = 'wp_bb_mediawiki_run';
|
103 |
|
104 |
?>
|
bad-behavior-movabletype.php
CHANGED
@@ -2,11 +2,12 @@
|
|
2 |
|
3 |
// Analyze user agents claiming to be MovableType
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
// Is it a trackback? If so, do a quick check on the URI
|
8 |
// It must resolve to the same IP as the blog sending it.
|
9 |
-
// TODO: DNS lookups take too long
|
10 |
if (strcasecmp($wp_bb_request_method, "POST")) {
|
11 |
if (strcmp($wp_bb_http_headers_mixed['Range'], "bytes=0-99999")) {
|
12 |
wp_bb_spammer();
|
2 |
|
3 |
// Analyze user agents claiming to be MovableType
|
4 |
|
5 |
+
if (!defined('WP_BB_CWD'))
|
6 |
+
die('');
|
7 |
|
8 |
// Is it a trackback? If so, do a quick check on the URI
|
9 |
// It must resolve to the same IP as the blog sending it.
|
10 |
+
// TODO: DNS lookups take too long; skip the check for now :(
|
11 |
if (strcasecmp($wp_bb_request_method, "POST")) {
|
12 |
if (strcmp($wp_bb_http_headers_mixed['Range'], "bytes=0-99999")) {
|
13 |
wp_bb_spammer();
|
bad-behavior-mozilla.php
CHANGED
@@ -5,6 +5,9 @@
|
|
5 |
// Bots:
|
6 |
// Yahoo! Slurp passes these checks
|
7 |
|
|
|
|
|
|
|
8 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
9 |
|
10 |
wp_bb_check_accept();
|
5 |
// Bots:
|
6 |
// Yahoo! Slurp passes these checks
|
7 |
|
8 |
+
if (!defined('WP_BB_CWD'))
|
9 |
+
die('');
|
10 |
+
|
11 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
12 |
|
13 |
wp_bb_check_accept();
|
bad-behavior-msie.php
CHANGED
@@ -4,6 +4,9 @@
|
|
4 |
// (or some variant thereof). We check the HTTP headers to see if it really
|
5 |
// is MSIE.
|
6 |
|
|
|
|
|
|
|
7 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
8 |
|
9 |
// MSIE always sends the Accept: header.
|
4 |
// (or some variant thereof). We check the HTTP headers to see if it really
|
5 |
// is MSIE.
|
6 |
|
7 |
+
if (!defined('WP_BB_CWD'))
|
8 |
+
die('');
|
9 |
+
|
10 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
11 |
|
12 |
// MSIE always sends the Accept: header.
|
bad-behavior-msnbot.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// This file is included only when the user-agent is claiming to be msnbot
|
4 |
+
|
5 |
+
if (!defined('WP_BB_CWD'))
|
6 |
+
die('');
|
7 |
+
|
8 |
+
// require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
9 |
+
|
10 |
+
if (matchCIDR($wp_bb_remote_addr, "207.46.0.0/16") === FALSE) {
|
11 |
+
wp_bb_spammer();
|
12 |
+
}
|
13 |
+
|
14 |
+
?>
|
bad-behavior-opera.php
CHANGED
@@ -2,6 +2,9 @@
|
|
2 |
|
3 |
// Analyze user agents claiming to be Opera
|
4 |
|
|
|
|
|
|
|
5 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
6 |
|
7 |
wp_bb_check_accept();
|
2 |
|
3 |
// Analyze user agents claiming to be Opera
|
4 |
|
5 |
+
if (!defined('WP_BB_CWD'))
|
6 |
+
die('');
|
7 |
+
|
8 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
9 |
|
10 |
wp_bb_check_accept();
|
bad-behavior-referer.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
// Analyze the Referer: field
|
4 |
|
5 |
function wp_bb_referer() {
|
1 |
<?php
|
2 |
|
3 |
+
if (!defined('WP_BB_CWD'))
|
4 |
+
die('');
|
5 |
+
|
6 |
// Analyze the Referer: field
|
7 |
|
8 |
function wp_bb_referer() {
|
bad-behavior-safari.php
CHANGED
@@ -2,6 +2,9 @@
|
|
2 |
|
3 |
// Analyze user agents claiming to be Safari
|
4 |
|
|
|
|
|
|
|
5 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
6 |
|
7 |
wp_bb_check_accept();
|
2 |
|
3 |
// Analyze user agents claiming to be Safari
|
4 |
|
5 |
+
if (!defined('WP_BB_CWD'))
|
6 |
+
die('');
|
7 |
+
|
8 |
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
9 |
|
10 |
wp_bb_check_accept();
|
bad-behavior-user-agent.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
// Is the user-agent a known spambot?
|
4 |
// Occurs at the beginning of the string
|
5 |
$wp_bb_spambots_str0 = array(
|
@@ -23,7 +26,7 @@ $wp_bb_spambots_str0 = array(
|
|
23 |
$wp_bb_spambots_str = array(
|
24 |
"compatible ; MSIE", // misc comment/email spam
|
25 |
"DTS Agent", // misc comment/email spam
|
26 |
-
"grub-client", //
|
27 |
"Indy Library", // misc comment/email spam
|
28 |
"POE-Component-Client", // free poker, etc.
|
29 |
"WISEbot", // spam harvester
|
1 |
<?php
|
2 |
|
3 |
+
if (!defined('WP_BB_CWD'))
|
4 |
+
die('');
|
5 |
+
|
6 |
// Is the user-agent a known spambot?
|
7 |
// Occurs at the beginning of the string
|
8 |
$wp_bb_spambots_str0 = array(
|
26 |
$wp_bb_spambots_str = array(
|
27 |
"compatible ; MSIE", // misc comment/email spam
|
28 |
"DTS Agent", // misc comment/email spam
|
29 |
+
"grub-client", // search engine ignores robots.txt
|
30 |
"Indy Library", // misc comment/email spam
|
31 |
"POE-Component-Client", // free poker, etc.
|
32 |
"WISEbot", // spam harvester
|
bad-behavior-wordpress.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Bad Behavior
|
4 |
-
Version: 1.0.
|
5 |
Plugin URI: http://www.ioerror.us/software/bad-behavior/
|
6 |
Description: Stop comment spam before it starts by trapping and blocking spambots before they have a chance to post comments.
|
7 |
Author: Michael Hampton
|
@@ -48,7 +48,8 @@ $wp_bb_logging_duration = 7;
|
|
48 |
// This will be shown to users on the error page, which means it will
|
49 |
// be exposed to spammers! Bad Behavior will munge it automatically; you
|
50 |
// should NOT munge it here!
|
51 |
-
$wp_bb_email =
|
|
|
52 |
|
53 |
###############################################################################
|
54 |
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Bad Behavior
|
4 |
+
Version: 1.0.1
|
5 |
Plugin URI: http://www.ioerror.us/software/bad-behavior/
|
6 |
Description: Stop comment spam before it starts by trapping and blocking spambots before they have a chance to post comments.
|
7 |
Author: Michael Hampton
|
48 |
// This will be shown to users on the error page, which means it will
|
49 |
// be exposed to spammers! Bad Behavior will munge it automatically; you
|
50 |
// should NOT munge it here!
|
51 |
+
$wp_bb_email = get_bloginfo('admin_email');
|
52 |
+
//$wp_bb_email = "badbots@ioerror.us";
|
53 |
|
54 |
###############################################################################
|
55 |
|
bad-behavior/COPYING
DELETED
@@ -1,339 +0,0 @@
|
|
1 |
-
GNU GENERAL PUBLIC LICENSE
|
2 |
-
Version 2, June 1991
|
3 |
-
|
4 |
-
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
5 |
-
675 Mass Ave, Cambridge, MA 02139, USA
|
6 |
-
Everyone is permitted to copy and distribute verbatim copies
|
7 |
-
of this license document, but changing it is not allowed.
|
8 |
-
|
9 |
-
Preamble
|
10 |
-
|
11 |
-
The licenses for most software are designed to take away your
|
12 |
-
freedom to share and change it. By contrast, the GNU General Public
|
13 |
-
License is intended to guarantee your freedom to share and change free
|
14 |
-
software--to make sure the software is free for all its users. This
|
15 |
-
General Public License applies to most of the Free Software
|
16 |
-
Foundation's software and to any other program whose authors commit to
|
17 |
-
using it. (Some other Free Software Foundation software is covered by
|
18 |
-
the GNU Library General Public License instead.) You can apply it to
|
19 |
-
your programs, too.
|
20 |
-
|
21 |
-
When we speak of free software, we are referring to freedom, not
|
22 |
-
price. Our General Public Licenses are designed to make sure that you
|
23 |
-
have the freedom to distribute copies of free software (and charge for
|
24 |
-
this service if you wish), that you receive source code or can get it
|
25 |
-
if you want it, that you can change the software or use pieces of it
|
26 |
-
in new free programs; and that you know you can do these things.
|
27 |
-
|
28 |
-
To protect your rights, we need to make restrictions that forbid
|
29 |
-
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
-
These restrictions translate to certain responsibilities for you if you
|
31 |
-
distribute copies of the software, or if you modify it.
|
32 |
-
|
33 |
-
For example, if you distribute copies of such a program, whether
|
34 |
-
gratis or for a fee, you must give the recipients all the rights that
|
35 |
-
you have. You must make sure that they, too, receive or can get the
|
36 |
-
source code. And you must show them these terms so they know their
|
37 |
-
rights.
|
38 |
-
|
39 |
-
We protect your rights with two steps: (1) copyright the software, and
|
40 |
-
(2) offer you this license which gives you legal permission to copy,
|
41 |
-
distribute and/or modify the software.
|
42 |
-
|
43 |
-
Also, for each author's protection and ours, we want to make certain
|
44 |
-
that everyone understands that there is no warranty for this free
|
45 |
-
software. If the software is modified by someone else and passed on, we
|
46 |
-
want its recipients to know that what they have is not the original, so
|
47 |
-
that any problems introduced by others will not reflect on the original
|
48 |
-
authors' reputations.
|
49 |
-
|
50 |
-
Finally, any free program is threatened constantly by software
|
51 |
-
patents. We wish to avoid the danger that redistributors of a free
|
52 |
-
program will individually obtain patent licenses, in effect making the
|
53 |
-
program proprietary. To prevent this, we have made it clear that any
|
54 |
-
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
-
|
56 |
-
The precise terms and conditions for copying, distribution and
|
57 |
-
modification follow.
|
58 |
-
|
59 |
-
GNU GENERAL PUBLIC LICENSE
|
60 |
-
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
-
|
62 |
-
0. This License applies to any program or other work which contains
|
63 |
-
a notice placed by the copyright holder saying it may be distributed
|
64 |
-
under the terms of this General Public License. The "Program", below,
|
65 |
-
refers to any such program or work, and a "work based on the Program"
|
66 |
-
means either the Program or any derivative work under copyright law:
|
67 |
-
that is to say, a work containing the Program or a portion of it,
|
68 |
-
either verbatim or with modifications and/or translated into another
|
69 |
-
language. (Hereinafter, translation is included without limitation in
|
70 |
-
the term "modification".) Each licensee is addressed as "you".
|
71 |
-
|
72 |
-
Activities other than copying, distribution and modification are not
|
73 |
-
covered by this License; they are outside its scope. The act of
|
74 |
-
running the Program is not restricted, and the output from the Program
|
75 |
-
is covered only if its contents constitute a work based on the
|
76 |
-
Program (independent of having been made by running the Program).
|
77 |
-
Whether that is true depends on what the Program does.
|
78 |
-
|
79 |
-
1. You may copy and distribute verbatim copies of the Program's
|
80 |
-
source code as you receive it, in any medium, provided that you
|
81 |
-
conspicuously and appropriately publish on each copy an appropriate
|
82 |
-
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
-
notices that refer to this License and to the absence of any warranty;
|
84 |
-
and give any other recipients of the Program a copy of this License
|
85 |
-
along with the Program.
|
86 |
-
|
87 |
-
You may charge a fee for the physical act of transferring a copy, and
|
88 |
-
you may at your option offer warranty protection in exchange for a fee.
|
89 |
-
|
90 |
-
2. You may modify your copy or copies of the Program or any portion
|
91 |
-
of it, thus forming a work based on the Program, and copy and
|
92 |
-
distribute such modifications or work under the terms of Section 1
|
93 |
-
above, provided that you also meet all of these conditions:
|
94 |
-
|
95 |
-
a) You must cause the modified files to carry prominent notices
|
96 |
-
stating that you changed the files and the date of any change.
|
97 |
-
|
98 |
-
b) You must cause any work that you distribute or publish, that in
|
99 |
-
whole or in part contains or is derived from the Program or any
|
100 |
-
part thereof, to be licensed as a whole at no charge to all third
|
101 |
-
parties under the terms of this License.
|
102 |
-
|
103 |
-
c) If the modified program normally reads commands interactively
|
104 |
-
when run, you must cause it, when started running for such
|
105 |
-
interactive use in the most ordinary way, to print or display an
|
106 |
-
announcement including an appropriate copyright notice and a
|
107 |
-
notice that there is no warranty (or else, saying that you provide
|
108 |
-
a warranty) and that users may redistribute the program under
|
109 |
-
these conditions, and telling the user how to view a copy of this
|
110 |
-
License. (Exception: if the Program itself is interactive but
|
111 |
-
does not normally print such an announcement, your work based on
|
112 |
-
the Program is not required to print an announcement.)
|
113 |
-
|
114 |
-
These requirements apply to the modified work as a whole. If
|
115 |
-
identifiable sections of that work are not derived from the Program,
|
116 |
-
and can be reasonably considered independent and separate works in
|
117 |
-
themselves, then this License, and its terms, do not apply to those
|
118 |
-
sections when you distribute them as separate works. But when you
|
119 |
-
distribute the same sections as part of a whole which is a work based
|
120 |
-
on the Program, the distribution of the whole must be on the terms of
|
121 |
-
this License, whose permissions for other licensees extend to the
|
122 |
-
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
-
|
124 |
-
Thus, it is not the intent of this section to claim rights or contest
|
125 |
-
your rights to work written entirely by you; rather, the intent is to
|
126 |
-
exercise the right to control the distribution of derivative or
|
127 |
-
collective works based on the Program.
|
128 |
-
|
129 |
-
In addition, mere aggregation of another work not based on the Program
|
130 |
-
with the Program (or with a work based on the Program) on a volume of
|
131 |
-
a storage or distribution medium does not bring the other work under
|
132 |
-
the scope of this License.
|
133 |
-
|
134 |
-
3. You may copy and distribute the Program (or a work based on it,
|
135 |
-
under Section 2) in object code or executable form under the terms of
|
136 |
-
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
-
|
138 |
-
a) Accompany it with the complete corresponding machine-readable
|
139 |
-
source code, which must be distributed under the terms of Sections
|
140 |
-
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
-
|
142 |
-
b) Accompany it with a written offer, valid for at least three
|
143 |
-
years, to give any third party, for a charge no more than your
|
144 |
-
cost of physically performing source distribution, a complete
|
145 |
-
machine-readable copy of the corresponding source code, to be
|
146 |
-
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
-
customarily used for software interchange; or,
|
148 |
-
|
149 |
-
c) Accompany it with the information you received as to the offer
|
150 |
-
to distribute corresponding source code. (This alternative is
|
151 |
-
allowed only for noncommercial distribution and only if you
|
152 |
-
received the program in object code or executable form with such
|
153 |
-
an offer, in accord with Subsection b above.)
|
154 |
-
|
155 |
-
The source code for a work means the preferred form of the work for
|
156 |
-
making modifications to it. For an executable work, complete source
|
157 |
-
code means all the source code for all modules it contains, plus any
|
158 |
-
associated interface definition files, plus the scripts used to
|
159 |
-
control compilation and installation of the executable. However, as a
|
160 |
-
special exception, the source code distributed need not include
|
161 |
-
anything that is normally distributed (in either source or binary
|
162 |
-
form) with the major components (compiler, kernel, and so on) of the
|
163 |
-
operating system on which the executable runs, unless that component
|
164 |
-
itself accompanies the executable.
|
165 |
-
|
166 |
-
If distribution of executable or object code is made by offering
|
167 |
-
access to copy from a designated place, then offering equivalent
|
168 |
-
access to copy the source code from the same place counts as
|
169 |
-
distribution of the source code, even though third parties are not
|
170 |
-
compelled to copy the source along with the object code.
|
171 |
-
|
172 |
-
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
-
except as expressly provided under this License. Any attempt
|
174 |
-
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
-
void, and will automatically terminate your rights under this License.
|
176 |
-
However, parties who have received copies, or rights, from you under
|
177 |
-
this License will not have their licenses terminated so long as such
|
178 |
-
parties remain in full compliance.
|
179 |
-
|
180 |
-
5. You are not required to accept this License, since you have not
|
181 |
-
signed it. However, nothing else grants you permission to modify or
|
182 |
-
distribute the Program or its derivative works. These actions are
|
183 |
-
prohibited by law if you do not accept this License. Therefore, by
|
184 |
-
modifying or distributing the Program (or any work based on the
|
185 |
-
Program), you indicate your acceptance of this License to do so, and
|
186 |
-
all its terms and conditions for copying, distributing or modifying
|
187 |
-
the Program or works based on it.
|
188 |
-
|
189 |
-
6. Each time you redistribute the Program (or any work based on the
|
190 |
-
Program), the recipient automatically receives a license from the
|
191 |
-
original licensor to copy, distribute or modify the Program subject to
|
192 |
-
these terms and conditions. You may not impose any further
|
193 |
-
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
-
You are not responsible for enforcing compliance by third parties to
|
195 |
-
this License.
|
196 |
-
|
197 |
-
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
-
infringement or for any other reason (not limited to patent issues),
|
199 |
-
conditions are imposed on you (whether by court order, agreement or
|
200 |
-
otherwise) that contradict the conditions of this License, they do not
|
201 |
-
excuse you from the conditions of this License. If you cannot
|
202 |
-
distribute so as to satisfy simultaneously your obligations under this
|
203 |
-
License and any other pertinent obligations, then as a consequence you
|
204 |
-
may not distribute the Program at all. For example, if a patent
|
205 |
-
license would not permit royalty-free redistribution of the Program by
|
206 |
-
all those who receive copies directly or indirectly through you, then
|
207 |
-
the only way you could satisfy both it and this License would be to
|
208 |
-
refrain entirely from distribution of the Program.
|
209 |
-
|
210 |
-
If any portion of this section is held invalid or unenforceable under
|
211 |
-
any particular circumstance, the balance of the section is intended to
|
212 |
-
apply and the section as a whole is intended to apply in other
|
213 |
-
circumstances.
|
214 |
-
|
215 |
-
It is not the purpose of this section to induce you to infringe any
|
216 |
-
patents or other property right claims or to contest validity of any
|
217 |
-
such claims; this section has the sole purpose of protecting the
|
218 |
-
integrity of the free software distribution system, which is
|
219 |
-
implemented by public license practices. Many people have made
|
220 |
-
generous contributions to the wide range of software distributed
|
221 |
-
through that system in reliance on consistent application of that
|
222 |
-
system; it is up to the author/donor to decide if he or she is willing
|
223 |
-
to distribute software through any other system and a licensee cannot
|
224 |
-
impose that choice.
|
225 |
-
|
226 |
-
This section is intended to make thoroughly clear what is believed to
|
227 |
-
be a consequence of the rest of this License.
|
228 |
-
|
229 |
-
8. If the distribution and/or use of the Program is restricted in
|
230 |
-
certain countries either by patents or by copyrighted interfaces, the
|
231 |
-
original copyright holder who places the Program under this License
|
232 |
-
may add an explicit geographical distribution limitation excluding
|
233 |
-
those countries, so that distribution is permitted only in or among
|
234 |
-
countries not thus excluded. In such case, this License incorporates
|
235 |
-
the limitation as if written in the body of this License.
|
236 |
-
|
237 |
-
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
-
of the General Public License from time to time. Such new versions will
|
239 |
-
be similar in spirit to the present version, but may differ in detail to
|
240 |
-
address new problems or concerns.
|
241 |
-
|
242 |
-
Each version is given a distinguishing version number. If the Program
|
243 |
-
specifies a version number of this License which applies to it and "any
|
244 |
-
later version", you have the option of following the terms and conditions
|
245 |
-
either of that version or of any later version published by the Free
|
246 |
-
Software Foundation. If the Program does not specify a version number of
|
247 |
-
this License, you may choose any version ever published by the Free Software
|
248 |
-
Foundation.
|
249 |
-
|
250 |
-
10. If you wish to incorporate parts of the Program into other free
|
251 |
-
programs whose distribution conditions are different, write to the author
|
252 |
-
to ask for permission. For software which is copyrighted by the Free
|
253 |
-
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
-
make exceptions for this. Our decision will be guided by the two goals
|
255 |
-
of preserving the free status of all derivatives of our free software and
|
256 |
-
of promoting the sharing and reuse of software generally.
|
257 |
-
|
258 |
-
NO WARRANTY
|
259 |
-
|
260 |
-
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
-
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
-
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
-
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
-
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
-
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
-
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
-
REPAIR OR CORRECTION.
|
269 |
-
|
270 |
-
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
-
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
-
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
-
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
-
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
-
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
-
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
-
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
-
POSSIBILITY OF SUCH DAMAGES.
|
279 |
-
|
280 |
-
END OF TERMS AND CONDITIONS
|
281 |
-
|
282 |
-
Appendix: How to Apply These Terms to Your New Programs
|
283 |
-
|
284 |
-
If you develop a new program, and you want it to be of the greatest
|
285 |
-
possible use to the public, the best way to achieve this is to make it
|
286 |
-
free software which everyone can redistribute and change under these terms.
|
287 |
-
|
288 |
-
To do so, attach the following notices to the program. It is safest
|
289 |
-
to attach them to the start of each source file to most effectively
|
290 |
-
convey the exclusion of warranty; and each file should have at least
|
291 |
-
the "copyright" line and a pointer to where the full notice is found.
|
292 |
-
|
293 |
-
<one line to give the program's name and a brief idea of what it does.>
|
294 |
-
Copyright (C) 19yy <name of author>
|
295 |
-
|
296 |
-
This program is free software; you can redistribute it and/or modify
|
297 |
-
it under the terms of the GNU General Public License as published by
|
298 |
-
the Free Software Foundation; either version 2 of the License, or
|
299 |
-
(at your option) any later version.
|
300 |
-
|
301 |
-
This program is distributed in the hope that it will be useful,
|
302 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
-
GNU General Public License for more details.
|
305 |
-
|
306 |
-
You should have received a copy of the GNU General Public License
|
307 |
-
along with this program; if not, write to the Free Software
|
308 |
-
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
309 |
-
|
310 |
-
Also add information on how to contact you by electronic and paper mail.
|
311 |
-
|
312 |
-
If the program is interactive, make it output a short notice like this
|
313 |
-
when it starts in an interactive mode:
|
314 |
-
|
315 |
-
Gnomovision version 69, Copyright (C) 19yy name of author
|
316 |
-
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
-
This is free software, and you are welcome to redistribute it
|
318 |
-
under certain conditions; type `show c' for details.
|
319 |
-
|
320 |
-
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
-
parts of the General Public License. Of course, the commands you use may
|
322 |
-
be called something other than `show w' and `show c'; they could even be
|
323 |
-
mouse-clicks or menu items--whatever suits your program.
|
324 |
-
|
325 |
-
You should also get your employer (if you work as a programmer) or your
|
326 |
-
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
-
necessary. Here is a sample; alter the names:
|
328 |
-
|
329 |
-
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
-
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
-
|
332 |
-
<signature of Ty Coon>, 1 April 1989
|
333 |
-
Ty Coon, President of Vice
|
334 |
-
|
335 |
-
This General Public License does not permit incorporating your program into
|
336 |
-
proprietary programs. If your program is a subroutine library, you may
|
337 |
-
consider it more useful to permit linking proprietary applications with the
|
338 |
-
library. If this is what you want to do, use the GNU Library General
|
339 |
-
Public License instead of this License.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/README.txt
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
=== Bad Behavior ===
|
2 |
-
Tags: comment,trackback,referrer,spam,robot,antispam
|
3 |
-
Contributors: MichaelHampton,MarkJaquith,FirasDurri
|
4 |
-
SeeAlso: http://www.ioerror.us/software/bad-behavior/
|
5 |
-
|
6 |
-
This README.txt file applies to WordPress installations. For other types of
|
7 |
-
installations, please see the documentation at
|
8 |
-
http://www.ioerror.us/software/bad-behavior/installing-and-using-bad-behavior/
|
9 |
-
.
|
10 |
-
|
11 |
-
Bad Behavior is a set of PHP scripts which prevents spambots from accessing your site by analyzing their actual HTTP requests and comparing them to profiles from known spambots. It goes far beyond User-Agent and Referer, however.
|
12 |
-
|
13 |
-
The problem: Spammers run automated scripts which read everything on your web site, harvest email addresses, and if you have a blog, forum or wiki, will post spam directly to your site. They also put false referrers in your server log trying to get their links posted through your stats page.
|
14 |
-
|
15 |
-
As the operator of a Web site, this can cause you several problems. First, the spammers are wasting your bandwidth, which you may well be paying for. Second, they are posting comments to any form they can find, filling your web site with unwanted (and unpaid!) ads for their products. Last but not least, they harvest any email addresses they can find and sell those to other spammers, who fill your inbox with more unwanted ads.
|
16 |
-
|
17 |
-
Bad Behavior intends to target any malicious software directed at a Web site, whether it be a spambot, ill-designed search engine bot, or system crackers. In that spirit, it is not limited to WordPress users; a generic interface has been provided whereby it can be integrated into virtually any PHP-based software.
|
18 |
-
|
19 |
-
== Installation ==
|
20 |
-
SeeAlso: http://www.ioerror.us/software/bad-behavior/installing-and-using-bad-behavior/
|
21 |
-
|
22 |
-
1. Bad Behavior installs like any other multi-file WordPress plugin. Unzip the bad-behavior.zip file, and you will have a bad-behavior folder containing all the Bad Behavior files.
|
23 |
-
|
24 |
-
2. Before uploading, edit the bad-behavior/bad-behavior-wordpress-plugin.php file and customize the configuration variables there. When logging is on, all blocked requests will be logged. When verbose logging is on, all requests - successful or not - will be logged. And the logging duration specifies how many days worth of logs will be stored in the database. I recommend not using verbose logging without a really good reason, as your database will fill up fast.
|
25 |
-
|
26 |
-
3. Upload the folder and its contents to your wp-content/plugins directory, taking care to use ASCII mode. Once on the server, activate the plugin from your admin page.
|
27 |
-
|
28 |
-
== Frequently Asked Questions ==
|
29 |
-
SeeAlso: http://www.ioerror.us/software/bad-behavior/bad-behavior-faq/
|
30 |
-
|
31 |
-
= I have been blocked by Bad Behavior! What do I do? =
|
32 |
-
|
33 |
-
In extremely rare circumstances, Bad Behavior may block actual human visitors. Bad Behavior was designed to target robots, not people. If this happens, the profile presented by your browser matched that seen from actual malicious robots. In most cases, this is caused by over-aggressive personal firewall/browser privacy software. In some cases, this is caused by improperly configured Web proxy server software.
|
34 |
-
|
35 |
-
Try disabling the browser privacy settings in your personal firewall/browser privacy software, and/or bypassing the Web proxy and making a direct connection. Disable any download accelerators in use, especially if you are on dialup and your ISP provided you one. (These so-called accelerators rarely speed up anything; our analysis of these accelerators indicate they usually slow things down!) If all else fails, try a different Web browser with a new user profile.
|
36 |
-
|
37 |
-
If you continue to have trouble, contact me and provide a copy of the logs which Bad Behavior stores in the database showing where your IP address was blocked. I will provide further assistance until the trouble is resolved.
|
38 |
-
|
39 |
-
= How can I view Bad Behavior's log files? =
|
40 |
-
|
41 |
-
To view the Bad Behavior log, you will need a copy of phpMyAdmin installed, or some other way to view the database. Bad Behavior stores its log in the bad_behavior_log table in your WordPress database. Browse or search through it with phpMyAdmin, the MySQL command line, or another tool. At this time Bad Behavior does not come with a built-in log viewer, though this feature is planned.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-accept.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Check for various Accept: headers
|
4 |
-
|
5 |
-
function wp_bb_check_accept() {
|
6 |
-
global $wp_bb_http_headers_mixed;
|
7 |
-
if (!array_key_exists('Accept', $wp_bb_http_headers_mixed)) {
|
8 |
-
wp_bb_spammer();
|
9 |
-
}
|
10 |
-
}
|
11 |
-
|
12 |
-
function wp_bb_check_accept_encoding() {
|
13 |
-
global $wp_bb_http_headers, $wp_bb_http_headers_mixed;
|
14 |
-
|
15 |
-
// FIXME: skip this check; too many examples of legit user agents
|
16 |
-
// are omitting Accept-Encoding; come back to it later when more
|
17 |
-
// data is available
|
18 |
-
return;
|
19 |
-
|
20 |
-
// In some cases we can skip this check
|
21 |
-
// HTTP proxies munch the Accept-Encoding header
|
22 |
-
if (array_key_exists('X-BlueCoat-Via', $wp_bb_http_headers_mixed) ||
|
23 |
-
array_key_exists('X-Forwarded-For', $wp_bb_http_headers) ||
|
24 |
-
array_key_exists('Via', $wp_bb_http_headers)) {
|
25 |
-
return;
|
26 |
-
}
|
27 |
-
|
28 |
-
// Check for Accept-Encoding
|
29 |
-
if (!array_key_exists('Accept-Encoding', $wp_bb_http_headers_mixed) &&
|
30 |
-
!array_key_exists('~~~~~~~~~~~~~~~', $wp_bb_http_headers) &&
|
31 |
-
!array_key_exists('---------------', $wp_bb_http_headers) &&
|
32 |
-
!array_key_exists('XXXXXXXXXXXXXXX', $wp_bb_http_headers)) {
|
33 |
-
wp_bb_spammer();
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-banned.php
DELETED
@@ -1,71 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// This function is called when there is absolutely no hope for redemption for
|
3 |
-
// the offending spammer.
|
4 |
-
function wp_bb_banned() {
|
5 |
-
global $wp_bb_request_uri, $wp_bb_remote_addr, $wp_bb_server_signature;
|
6 |
-
global $wp_bb_email;
|
7 |
-
|
8 |
-
wp_bb_log(403);
|
9 |
-
header("HTTP/1.0 412 Precondition Failed");
|
10 |
-
header("Status: 412 Precondition Failed");
|
11 |
-
?>
|
12 |
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
13 |
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
14 |
-
<head>
|
15 |
-
<title>412 Precondition Failed</title>
|
16 |
-
</head>
|
17 |
-
<body>
|
18 |
-
<h1>Precondition Failed</h1>
|
19 |
-
<p>We're sorry, but we could not fulfill your request for
|
20 |
-
<?php echo $wp_bb_request_uri ?> on this server.</p>
|
21 |
-
<p>We have established rules for access to this server, and any person or robot
|
22 |
-
that violates these rules will be unable to access this site.</p>
|
23 |
-
<p>To resolve this problem, please try the following steps:</p>
|
24 |
-
<ul>
|
25 |
-
<li>Ensure that your computer is free of viruses, Trojan horses, spyware or
|
26 |
-
any other sort of malicious software.</li>
|
27 |
-
<li>If you are using any sort of personal firewall or browser privacy
|
28 |
-
software, check to ensure that its settings do not cause your web browser to
|
29 |
-
inadvertently violate any of the rules listed below.</li>
|
30 |
-
<li>If you are behind a Web proxy or corporate firewall, the proxy must
|
31 |
-
conform to the <a href="http://www.isi.edu/in-notes/rfc2616.txt">HTTP
|
32 |
-
specification</a> with respect to proxy servers. Contact your network
|
33 |
-
administrator if the trouble persists, or bypass the proxy and connect
|
34 |
-
directly if possible.</li>
|
35 |
-
<li>Disable any download accelerators you may be using. They don't speed up
|
36 |
-
your downloads anyway; in most cases, they actually run slower!</li>
|
37 |
-
<li>If all else fails, try using a different Web browser, such as
|
38 |
-
<a href="http://www.spreadfirefox.com/?q=affiliates&id=32135&t=71">Firefox</a>.</li>
|
39 |
-
</ul>
|
40 |
-
<p>If you still need assistance, please contact <a href="mailto:<?php echo str_replace("@", "%40", $wp_bb_email); ?>"><?php echo str_replace("@", " at ", $wp_bb_email); ?></a>.</p>
|
41 |
-
<h2>More Information</h2>
|
42 |
-
<p>For your reference, the conditions for access to this server are:</p>
|
43 |
-
<h3>Robots:</h3>
|
44 |
-
<ul>
|
45 |
-
<li>MUST read and obey <a href="http://www.robotstxt.org/">robots.txt</a>.</li>
|
46 |
-
<li>MUST identify themselves properly; for example MUST NOT identify as Mozilla.</li>
|
47 |
-
<li>MUST NOT pretend to be a human.</li>
|
48 |
-
</ul>
|
49 |
-
<h3>Humans:</h3>
|
50 |
-
<ul>
|
51 |
-
<li>MUST NOT pretend to be a robot.</li>
|
52 |
-
<li>MUST NOT use a computer infected with viruses, Trojan horses or other
|
53 |
-
malicious software.</li>
|
54 |
-
</ul>
|
55 |
-
<h3>Both:</h3>
|
56 |
-
<ul>
|
57 |
-
<li>MUST NOT harvest email addresses.</li>
|
58 |
-
<li>MUST NOT attempt to send spam.</li>
|
59 |
-
<li>MUST NOT attempt to compromise server security.</li>
|
60 |
-
<li>MUST NOT use excessive amounts of bandwidth or other server resources.</li>
|
61 |
-
</ul>
|
62 |
-
<p>The precondition on the request for the URL
|
63 |
-
<?php echo $wp_bb_request_uri; ?> evaluated to false.</p>
|
64 |
-
<hr>
|
65 |
-
<?php echo $wp_bb_server_signature; ?>
|
66 |
-
</body>
|
67 |
-
</html>
|
68 |
-
<?php
|
69 |
-
die('');
|
70 |
-
}
|
71 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-core.php
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
require_once(WP_BB_CWD . "/bad-behavior-functions.php");
|
4 |
-
|
5 |
-
// Write to the log file.
|
6 |
-
function wp_bb_log($response) {
|
7 |
-
global $wp_bb_logging, $wp_bb_verbose_logging;
|
8 |
-
|
9 |
-
if (($wp_bb_verbose_logging) || ($wp_bb_logging && $response == 403)) {
|
10 |
-
require_once(WP_BB_CWD . "/bad-behavior-database.php");
|
11 |
-
wp_bb_db_log($response);
|
12 |
-
}
|
13 |
-
}
|
14 |
-
|
15 |
-
// This function is called when there is absolutely no hope for redemption for
|
16 |
-
// the offending spammer.
|
17 |
-
function wp_bb_spammer() {
|
18 |
-
require_once(WP_BB_CWD . "/bad-behavior-banned.php");
|
19 |
-
wp_bb_banned();
|
20 |
-
}
|
21 |
-
|
22 |
-
// Load up PHP4 specific stuff if needed
|
23 |
-
if (version_compare(phpversion(), "5.0.0") < 0) {
|
24 |
-
require_once(WP_BB_CWD . "/bad-behavior-php4.php");
|
25 |
-
}
|
26 |
-
|
27 |
-
// Load up database stuff only if requested
|
28 |
-
if ($wp_bb_verbose_logging || $wp_bb_logging) {
|
29 |
-
require_once(WP_BB_CWD . "/bad-behavior-database.php");
|
30 |
-
}
|
31 |
-
|
32 |
-
// Set up some initial variables.
|
33 |
-
$wp_bb_approved = 2;
|
34 |
-
$wp_bb_db_failure = FALSE;
|
35 |
-
$wp_bb_log = 'bad_behavior_log';
|
36 |
-
$wp_bb_remote_addr = $_SERVER['REMOTE_ADDR'];
|
37 |
-
$wp_bb_request_method = $_SERVER['REQUEST_METHOD'];
|
38 |
-
$wp_bb_http_host = $_SERVER['HTTP_HOST'];
|
39 |
-
$wp_bb_request_uri = $_SERVER['REQUEST_URI'];
|
40 |
-
$wp_bb_server_protocol = $_SERVER['SERVER_PROTOCOL'];
|
41 |
-
if (array_key_exists('HTTP_REFERER', $_SERVER))
|
42 |
-
$wp_bb_http_referer = $_SERVER['HTTP_REFERER'];
|
43 |
-
else
|
44 |
-
$wp_bb_http_referer = '';
|
45 |
-
$wp_bb_http_user_agent = $_SERVER['HTTP_USER_AGENT'];
|
46 |
-
$wp_bb_server_signature = $_SERVER['SERVER_SIGNATURE'];
|
47 |
-
|
48 |
-
// Reconstruct the entire HTTP headers as received.
|
49 |
-
$wp_bb_headers = "$wp_bb_request_method $wp_bb_request_uri $wp_bb_server_protocol\n";
|
50 |
-
$wp_bb_http_headers = getheaders();
|
51 |
-
foreach ($wp_bb_http_headers as $wp_bb_header => $wp_bb_value) {
|
52 |
-
$wp_bb_headers .= "$wp_bb_header: $wp_bb_value\n";
|
53 |
-
}
|
54 |
-
|
55 |
-
// Postprocess the headers to mixed-case
|
56 |
-
// FIXME: get the world to stop using PHP as CGI
|
57 |
-
foreach ($wp_bb_http_headers as $h=>$v)
|
58 |
-
$wp_bb_http_headers_mixed[uc_all($h)]=$v;
|
59 |
-
|
60 |
-
// Easy stuff: Ban known bad user-agents
|
61 |
-
require_once(WP_BB_CWD . "/bad-behavior-user-agent.php");
|
62 |
-
|
63 |
-
// Now analyze requests coming from "MSIE"
|
64 |
-
if (stripos($wp_bb_http_user_agent, "MSIE") !== FALSE) {
|
65 |
-
if (stripos($wp_bb_http_user_agent, "Opera") === FALSE) {
|
66 |
-
require_once(WP_BB_CWD . "/bad-behavior-msie.php");
|
67 |
-
} else {
|
68 |
-
require_once(WP_BB_CWD . "/bad-behavior-opera.php");
|
69 |
-
}
|
70 |
-
}
|
71 |
-
// Now analyze requests coming from "Konqueror"
|
72 |
-
elseif (stripos($wp_bb_http_user_agent, "Konqueror") !== FALSE) {
|
73 |
-
require_once(WP_BB_CWD . "/bad-behavior-konqueror.php");
|
74 |
-
}
|
75 |
-
elseif (stripos($wp_bb_http_user_agent, "Opera") !== FALSE) {
|
76 |
-
require_once(WP_BB_CWD . "/bad-behavior-opera.php");
|
77 |
-
}
|
78 |
-
elseif (stripos($wp_bb_http_user_agent, "Safari") !== FALSE) {
|
79 |
-
require_once(WP_BB_CWD . "/bad-behavior-safari.php");
|
80 |
-
}
|
81 |
-
elseif (stripos($wp_bb_http_user_agent, "Lynx") !== FALSE) {
|
82 |
-
require_once(WP_BB_CWD . "/bad-behavior-lynx.php");
|
83 |
-
}
|
84 |
-
elseif (stripos($wp_bb_http_user_agent, "MovableType") !== FALSE) {
|
85 |
-
require_once(WP_BB_CWD . "/bad-behavior-movabletype.php");
|
86 |
-
}
|
87 |
-
elseif (stripos($wp_bb_http_user_agent, "Mozilla") !== FALSE) {
|
88 |
-
require_once(WP_BB_CWD . "/bad-behavior-mozilla.php");
|
89 |
-
}
|
90 |
-
|
91 |
-
// Analyze the Referer, if present
|
92 |
-
if (array_key_exists('Referer', $wp_bb_http_headers_mixed)) {
|
93 |
-
require_once(WP_BB_CWD . "/bad-behavior-referer.php");
|
94 |
-
}
|
95 |
-
|
96 |
-
// Now analyze all other requests
|
97 |
-
require_once(WP_BB_CWD . "/bad-behavior-http-headers.php");
|
98 |
-
|
99 |
-
// If we get this far, the client is probably OK
|
100 |
-
wp_bb_log(200);
|
101 |
-
|
102 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-database.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Database functions. This needs review to ensure it isn't MySQL specific;
|
4 |
-
// it certainly is right now.
|
5 |
-
|
6 |
-
$wp_bb_log = "bad_behavior_log";
|
7 |
-
|
8 |
-
function wp_bb_db_create_tables() {
|
9 |
-
global $wp_bb_log, $wp_bb_db_failure;
|
10 |
-
|
11 |
-
$query = "CREATE TABLE IF NOT EXISTS `$wp_bb_log` (
|
12 |
-
`id` int(11) NOT NULL auto_increment,
|
13 |
-
`ip` text NOT NULL,
|
14 |
-
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
15 |
-
`request_method` text NOT NULL,
|
16 |
-
`http_host` text,
|
17 |
-
`request_uri` text NOT NULL,
|
18 |
-
`server_protocol` text NOT NULL,
|
19 |
-
`http_referer` text,
|
20 |
-
`http_user_agent` text,
|
21 |
-
`http_headers` text NOT NULL,
|
22 |
-
`http_response` int(3) NOT NULL,
|
23 |
-
PRIMARY KEY (`id`) );";
|
24 |
-
if (wp_bb_db_query($query) === FALSE) {
|
25 |
-
$wp_bb_db_failure = TRUE;
|
26 |
-
}
|
27 |
-
}
|
28 |
-
|
29 |
-
function wp_bb_db_clear_old_entries() {
|
30 |
-
global $wp_bb_log, $wp_bb_logging_duration;
|
31 |
-
|
32 |
-
$query = "DELETE FROM `$wp_bb_log` WHERE
|
33 |
-
`date` < DATE_SUB('" . gmstrftime("%Y-%m-%d %H:%M:%S") .
|
34 |
-
"', INTERVAL $wp_bb_logging_duration DAY)";
|
35 |
-
if (wp_bb_db_query($query) === FALSE) {
|
36 |
-
$wp_bb_db_failure = TRUE;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
// This sanitizes input for SQL! not necessarily for anything else
|
41 |
-
function wp_bb_db_sanitize($untrusted_input) {
|
42 |
-
return addslashes($untrusted_input);
|
43 |
-
}
|
44 |
-
|
45 |
-
function wp_bb_db_log($response) {
|
46 |
-
global $wp_bb_remote_addr, $wp_bb_request_method, $wp_bb_http_host;
|
47 |
-
global $wp_bb_request_uri, $wp_bb_server_protocol, $wp_bb_http_referer;
|
48 |
-
global $wp_bb_http_user_agent, $wp_bb_headers, $wp_bb_log;
|
49 |
-
|
50 |
-
// Sanitize input
|
51 |
-
$request_uri = wp_bb_db_sanitize($wp_bb_request_uri);
|
52 |
-
$referer = wp_bb_db_sanitize($wp_bb_http_referer);
|
53 |
-
$user_agent = wp_bb_db_sanitize($wp_bb_http_user_agent);
|
54 |
-
$headers = wp_bb_db_sanitize($wp_bb_headers);
|
55 |
-
|
56 |
-
$date = wp_bb_date();
|
57 |
-
$query = "INSERT INTO `$wp_bb_log`
|
58 |
-
(`ip`, `date`, `request_method`, `http_host`, `request_uri`, `server_protocol`, `http_referer`, `http_user_agent`, `http_headers`, `http_response`) VALUES
|
59 |
-
('$wp_bb_remote_addr', '$date', '$wp_bb_request_method', '$wp_bb_http_host', '$request_uri', '$wp_bb_server_protocol', '$referer', '$user_agent', '$headers', '$response')";
|
60 |
-
if (wp_bb_db_query($query) === FALSE) {
|
61 |
-
$wp_bb_db_failure = TRUE;
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
wp_bb_db_create_tables();
|
66 |
-
wp_bb_db_clear_old_entries();
|
67 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-functions.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Convert a string to mixed-case on word boundaries
|
4 |
-
function uc_all($string) {
|
5 |
-
$temp = preg_split('/(\W)/', str_replace("_", "-", $string), -1, PREG_SPLIT_DELIM_CAPTURE );
|
6 |
-
foreach ($temp as $key=>$word) {
|
7 |
-
$temp[$key] = ucfirst(strtolower($word));
|
8 |
-
}
|
9 |
-
return join ('', $temp);
|
10 |
-
}
|
11 |
-
|
12 |
-
// Obtain all the HTTP headers.
|
13 |
-
// NB: on PHP-CGI we hve to fake it out a bit, since we can't get the raw
|
14 |
-
// headers
|
15 |
-
function getheaders() {
|
16 |
-
if (!is_callable('getallheaders')) {
|
17 |
-
foreach($_SERVER as $h=>$v)
|
18 |
-
if(ereg('HTTP_(.+)',$h,$hp))
|
19 |
-
$headers[str_replace("_", "-", uc_all($hp[1]))]=$v;
|
20 |
-
return $headers;
|
21 |
-
} else {
|
22 |
-
return getallheaders();
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
// $addr should be an ip address in the format '0.0.0.0'
|
27 |
-
// $cidr should be a string in the format '100/8'
|
28 |
-
// or an array where each element is in the above format
|
29 |
-
function matchCIDR($addr, $cidr) {
|
30 |
-
$output = false;
|
31 |
-
|
32 |
-
if ( is_array($cidr) ) {
|
33 |
-
foreach ( $cidr as $cidrlet ) {
|
34 |
-
if ( matchCIDR( $addr, $cidrlet) ) {
|
35 |
-
$output = true;
|
36 |
-
}
|
37 |
-
}
|
38 |
-
} else {
|
39 |
-
list($ip, $mask) = explode('/', $cidr);
|
40 |
-
$mask = 0xffffffff << (32 - $mask);
|
41 |
-
$output = ((ip2long($addr) & $mask) == (ip2long($ip) & $mask));
|
42 |
-
}
|
43 |
-
return $output;
|
44 |
-
}
|
45 |
-
|
46 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-generic.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
http://www.ioerror.us/software/bad-behavior/
|
4 |
-
|
5 |
-
Bad Behavior - detects and blocks unwanted Web accesses
|
6 |
-
Copyright (C) 2005 Michael Hampton
|
7 |
-
|
8 |
-
This program is free software; you can redistribute it and/or modify
|
9 |
-
it under the terms of the GNU General Public License as published by
|
10 |
-
the Free Software Foundation; either version 2 of the License, or
|
11 |
-
(at your option) any later version.
|
12 |
-
|
13 |
-
This program is distributed in the hope that it will be useful,
|
14 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
-
GNU General Public License for more details.
|
17 |
-
|
18 |
-
You should have received a copy of the GNU General Public License
|
19 |
-
along with this program; if not, write to the Free Software
|
20 |
-
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
21 |
-
*/
|
22 |
-
|
23 |
-
// This file is the entry point for Bad Behavior.
|
24 |
-
// See below to customize it for your particular CMS or PHP application.
|
25 |
-
// Preferably by the time this file is loaded, everything in your app will
|
26 |
-
// be initialized, but no output sent to the browser. If output has been
|
27 |
-
// sent, Bad Behavior will fail.
|
28 |
-
|
29 |
-
###############################################################################
|
30 |
-
###############################################################################
|
31 |
-
|
32 |
-
// Configuration
|
33 |
-
// Nothing will be written to a DB unless you implement DB queries below
|
34 |
-
|
35 |
-
// Log failed requests to the database.
|
36 |
-
$wp_bb_logging = TRUE;
|
37 |
-
|
38 |
-
// Log all requests to the database, not just failed requests.
|
39 |
-
$wp_bb_verbose_logging = FALSE;
|
40 |
-
|
41 |
-
// How long to keep the logs around (in days).
|
42 |
-
$wp_bb_logging_duration = 7;
|
43 |
-
|
44 |
-
// Email address to contact you in case of problems
|
45 |
-
// This will be shown to users on the error page, which means it will
|
46 |
-
// be exposed to spammers! Bad Behavior will munge it automatically; you
|
47 |
-
// should NOT munge it here!
|
48 |
-
$wp_bb_email = "badbots@ioerror.us";
|
49 |
-
|
50 |
-
###############################################################################
|
51 |
-
|
52 |
-
# DO NOT EDIT BELOW THIS LINE
|
53 |
-
|
54 |
-
###############################################################################
|
55 |
-
|
56 |
-
define('WP_BB_CWD', dirname(__FILE__));
|
57 |
-
|
58 |
-
// Callbacks
|
59 |
-
|
60 |
-
// generic code; you should reimplement these if you want logging and
|
61 |
-
// database functions
|
62 |
-
|
63 |
-
// return a UTC date in the format preferred by your database
|
64 |
-
function wp_bb_date() {
|
65 |
-
return gmdate('Y-m-d H:i:s');
|
66 |
-
}
|
67 |
-
|
68 |
-
// run a SQL query and return # of rows affected, or FALSE if query failed
|
69 |
-
function wp_bb_db_query($query) {
|
70 |
-
return FALSE;
|
71 |
-
}
|
72 |
-
|
73 |
-
// Load core functions and do initial checks
|
74 |
-
require_once(WP_BB_CWD . "/bad-behavior-core.php");
|
75 |
-
|
76 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-http-headers.php
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Analyze the headers of all user-agents
|
4 |
-
// These checks apply to any user-agent regardless of identification
|
5 |
-
|
6 |
-
// Range: field exists and begins with 0
|
7 |
-
// Real user-agents do not start ranges at 0
|
8 |
-
// NOTE: this blocks the whois.sc bot. No big loss.
|
9 |
-
// FIXME: whitelist whois.sc netblocks when rwhoisd.ccom.net becomes available
|
10 |
-
if (array_key_exists('Range', $wp_bb_http_headers_mixed) &&
|
11 |
-
strpos($wp_bb_http_headers_mixed['Range'], "=0-") !== FALSE) {
|
12 |
-
if (strncmp($wp_bb_http_user_agent, "MovableType"))
|
13 |
-
wp_bb_spammer();
|
14 |
-
}
|
15 |
-
|
16 |
-
// Lowercase via is used by open proxies/referrer spammers
|
17 |
-
if (array_key_exists('via', $wp_bb_http_headers)) {
|
18 |
-
wp_bb_spammer();
|
19 |
-
}
|
20 |
-
// pinappleproxy is used by referrer spammers
|
21 |
-
if (array_key_exists('Via', $wp_bb_http_headers_mixed) &&
|
22 |
-
stripos($wp_bb_http_headers['Via'], "pinappleproxy") !== FALSE) {
|
23 |
-
wp_bb_spammer();
|
24 |
-
}
|
25 |
-
|
26 |
-
// Headers which are not seen from normal user agents; only malicious bots
|
27 |
-
if (array_key_exists('X-Aaaaaaaaaaaa', $wp_bb_http_headers_mixed) ||
|
28 |
-
array_key_exists('X-Aaaaaaaaaa', $wp_bb_http_headers_mixed)) {
|
29 |
-
wp_bb_spammer();
|
30 |
-
}
|
31 |
-
|
32 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-konqueror.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// This file is included only when the user-agent is claiming to be Konqueror
|
4 |
-
// (or some variant thereof). We check the HTTP headers to see if it really
|
5 |
-
// is Konqueror.
|
6 |
-
|
7 |
-
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
8 |
-
|
9 |
-
// CafeKelsa is a dev project at Yahoo which indexes job listings for
|
10 |
-
// Yahoo! HotJobs. It identifies as Konqueror so we skip these checks.
|
11 |
-
if (stripos($wp_bb_http_user_agent, "YahooSeeker/CafeKelsa") === FALSE ||
|
12 |
-
matchCIDR($wp_bb_remote_addr, "209.73.160.0/19") === FALSE) {
|
13 |
-
// Konqueror always sends the Accept: header.
|
14 |
-
wp_bb_check_accept();
|
15 |
-
|
16 |
-
// Konqueror always sends the Accept-Encoding: header.
|
17 |
-
wp_bb_check_accept_encoding();
|
18 |
-
}
|
19 |
-
|
20 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-lynx.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Analyze user agents claiming to be Lynx
|
4 |
-
|
5 |
-
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
6 |
-
|
7 |
-
wp_bb_check_accept();
|
8 |
-
wp_bb_check_accept_encoding();
|
9 |
-
|
10 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-mediawiki.php
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
http://www.ioerror.us/software/bad-behavior/
|
4 |
-
|
5 |
-
Bad Behavior - detects and blocks unwanted Web accesses
|
6 |
-
Copyright (C) 2005 Michael Hampton
|
7 |
-
|
8 |
-
This program is free software; you can redistribute it and/or modify
|
9 |
-
it under the terms of the GNU General Public License as published by
|
10 |
-
the Free Software Foundation; either version 2 of the License, or
|
11 |
-
(at your option) any later version.
|
12 |
-
|
13 |
-
This program is distributed in the hope that it will be useful,
|
14 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
-
GNU General Public License for more details.
|
17 |
-
|
18 |
-
You should have received a copy of the GNU General Public License
|
19 |
-
along with this program; if not, write to the Free Software
|
20 |
-
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
21 |
-
*/
|
22 |
-
|
23 |
-
// This file is the entry point for Bad Behavior.
|
24 |
-
// See below to customize it for your particular CMS or PHP application.
|
25 |
-
// Preferably by the time this file is loaded, everything in your app will
|
26 |
-
// be initialized, but no output sent to the browser. If output has been
|
27 |
-
// sent, Bad Behavior will fail.
|
28 |
-
|
29 |
-
###############################################################################
|
30 |
-
###############################################################################
|
31 |
-
|
32 |
-
// Configuration
|
33 |
-
// Nothing will be written to a DB unless you implement DB queries below
|
34 |
-
|
35 |
-
// Log failed requests to the database.
|
36 |
-
$wp_bb_logging = TRUE;
|
37 |
-
|
38 |
-
// Log all requests to the database, not just failed requests.
|
39 |
-
$wp_bb_verbose_logging = FALSE;
|
40 |
-
|
41 |
-
// How long to keep the logs around (in days).
|
42 |
-
$wp_bb_logging_duration = 7;
|
43 |
-
|
44 |
-
// Email address to contact you in case of problems
|
45 |
-
// This will be shown to users on the error page, which means it will
|
46 |
-
// be exposed to spammers! Bad Behavior will munge it automatically; you
|
47 |
-
// should NOT munge it here!
|
48 |
-
$wp_bb_email = $wgEmergencyContact;
|
49 |
-
|
50 |
-
###############################################################################
|
51 |
-
|
52 |
-
# DO NOT EDIT BELOW THIS LINE
|
53 |
-
|
54 |
-
###############################################################################
|
55 |
-
|
56 |
-
define('WP_BB_CWD', dirname(__FILE__));
|
57 |
-
|
58 |
-
// Callbacks
|
59 |
-
|
60 |
-
// generic code; you should reimplement these if you want logging and
|
61 |
-
// database functions
|
62 |
-
|
63 |
-
// return a UTC date in the format preferred by your database
|
64 |
-
function wp_bb_date() {
|
65 |
-
return gmdate('Y-m-d H:i:s');
|
66 |
-
}
|
67 |
-
|
68 |
-
// run a SQL query and return # of rows affected, or FALSE if query failed
|
69 |
-
function wp_bb_db_query($query) {
|
70 |
-
return wfQuery($query, DB_WRITE);
|
71 |
-
}
|
72 |
-
|
73 |
-
// Load core functions and do initial checks
|
74 |
-
require_once(WP_BB_CWD . "/bad-behavior-core.php");
|
75 |
-
|
76 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-movabletype.php
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Analyze user agents claiming to be MovableType
|
4 |
-
|
5 |
-
// TODO: Allow trackback auto-discovery :(
|
6 |
-
|
7 |
-
// Is it a trackback? If so, do a quick check on the URI
|
8 |
-
// It must resolve to the same IP as the blog sending it.
|
9 |
-
// TODO: DNS lookups take too long
|
10 |
-
if (strcasecmp($wp_bb_request_method, "POST")) {
|
11 |
-
if (strcmp($wp_bb_http_headers_mixed['Range'], "bytes=0-99999")) {
|
12 |
-
wp_bb_spammer();
|
13 |
-
}
|
14 |
-
// $uri = parse_url($_POST['url']);
|
15 |
-
// $host = $uri['host'];
|
16 |
-
// $ip = gethostbyname($host);
|
17 |
-
// if ($ip != $host && $ip != $wp_bb_remote_addr) {
|
18 |
-
// wp_bb_spammer();
|
19 |
-
// }
|
20 |
-
}
|
21 |
-
|
22 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-mozilla.php
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Analyze user agents claiming to be Mozilla
|
4 |
-
|
5 |
-
// Bots:
|
6 |
-
// Yahoo! Slurp passes these checks
|
7 |
-
|
8 |
-
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
9 |
-
|
10 |
-
wp_bb_check_accept();
|
11 |
-
// AvantGo mobile browser needs a different check
|
12 |
-
if (strpos($wp_bb_http_user_agent, "AvantGo") !== FALSE) {
|
13 |
-
if (!array_key_exists('X-Avantgo-Screensize', $wp_bb_http_headers_mixed)) {
|
14 |
-
wp_bb_spammer();
|
15 |
-
}
|
16 |
-
} else {
|
17 |
-
wp_bb_check_accept_encoding();
|
18 |
-
}
|
19 |
-
|
20 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-msie.php
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// This file is included only when the user-agent is claiming to be MSIE
|
4 |
-
// (or some variant thereof). We check the HTTP headers to see if it really
|
5 |
-
// is MSIE.
|
6 |
-
|
7 |
-
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
8 |
-
|
9 |
-
// MSIE always sends the Accept: header.
|
10 |
-
wp_bb_check_accept();
|
11 |
-
|
12 |
-
// MSIE 6.0+ always sends the Accept-Encoding: header.
|
13 |
-
// BecomeBot does not.
|
14 |
-
if (strpos($wp_bb_http_user_agent, "MSIE 6") !== FALSE) {
|
15 |
-
if (stripos($wp_bb_http_user_agent, "BecomeBot") === FALSE ||
|
16 |
-
matchCIDR($wp_bb_remote_addr, "64.124.85.0/24") === FALSE) {
|
17 |
-
wp_bb_check_accept_encoding();
|
18 |
-
}
|
19 |
-
}
|
20 |
-
|
21 |
-
// MSIE does NOT send "Windows ME" or "Windows XP" in the user agent
|
22 |
-
if (strpos($wp_bb_http_user_agent, "Windows ME") !== FALSE ||
|
23 |
-
strpos($wp_bb_http_user_agent, "Windows XP") !== FALSE ||
|
24 |
-
strpos($wp_bb_http_user_agent, "Windows 2000") !== FALSE) {
|
25 |
-
wp_bb_spammer();
|
26 |
-
}
|
27 |
-
|
28 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-opera.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Analyze user agents claiming to be Opera
|
4 |
-
|
5 |
-
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
6 |
-
|
7 |
-
wp_bb_check_accept();
|
8 |
-
wp_bb_check_accept_encoding();
|
9 |
-
|
10 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-php4.php
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Contains
|
3 |
-
|
4 |
-
// Helper functions
|
5 |
-
// stripos() needed because stripos is only present on PHP 5
|
6 |
-
function stripos($haystack,$needle,$offset = 0) {
|
7 |
-
return(strpos(strtolower($haystack),strtolower($needle),$offset));
|
8 |
-
}
|
9 |
-
|
10 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-referer.php
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Analyze the Referer: field
|
4 |
-
|
5 |
-
function wp_bb_referer() {
|
6 |
-
global $wp_bb_http_headers_mixed;
|
7 |
-
|
8 |
-
// Referer, if it exists, must not be blank
|
9 |
-
if (empty($wp_bb_http_headers_mixed['Referer'])) {
|
10 |
-
wp_bb_spammer();
|
11 |
-
}
|
12 |
-
|
13 |
-
// Referer, if it exists, must contain a :
|
14 |
-
// While a relative URL is technically valid in Referer, all known
|
15 |
-
// legit user-agents send an absolute URL
|
16 |
-
if (strpos($wp_bb_http_headers_mixed['Referer'], ":") === FALSE) {
|
17 |
-
wp_bb_spammer();
|
18 |
-
}
|
19 |
-
return;
|
20 |
-
}
|
21 |
-
|
22 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-safari.php
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Analyze user agents claiming to be Safari
|
4 |
-
|
5 |
-
require_once(WP_BB_CWD . "/bad-behavior-accept.php");
|
6 |
-
|
7 |
-
wp_bb_check_accept();
|
8 |
-
|
9 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-user-agent.php
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Is the user-agent a known spambot?
|
4 |
-
// Occurs at the beginning of the string
|
5 |
-
$wp_bb_spambots_str0 = array(
|
6 |
-
"8484 Boston Project", // video poker/porn spam
|
7 |
-
"autoemailspider", // spam harvester
|
8 |
-
"Digger", // spam harvester
|
9 |
-
"ecollector", // spam harvester
|
10 |
-
"EmailCollector", // spam harvester
|
11 |
-
"Email Extractor", // spam harvester
|
12 |
-
"Email Siphon", // spam harvester
|
13 |
-
"grub crawler", // misc comment/email spam
|
14 |
-
// "Java 1.", // Some doubt about this one
|
15 |
-
"libwww-perl", // exploited boxes
|
16 |
-
"LWP", // exploited boxes
|
17 |
-
"Microsoft URL", // spam harvester
|
18 |
-
"Missigua", // spam harvester
|
19 |
-
"Mozilla ", // forum exploits
|
20 |
-
"www.weblogs.com", // referrer spam (not the real www.weblogs.com)
|
21 |
-
);
|
22 |
-
// Occurs anywhere in the string
|
23 |
-
$wp_bb_spambots_str = array(
|
24 |
-
"compatible ; MSIE", // misc comment/email spam
|
25 |
-
"DTS Agent", // misc comment/email spam
|
26 |
-
"grub-client", // spam harvester
|
27 |
-
"Indy Library", // misc comment/email spam
|
28 |
-
"POE-Component-Client", // free poker, etc.
|
29 |
-
"WISEbot", // spam harvester
|
30 |
-
"WISEnutbot", // spam harvester
|
31 |
-
);
|
32 |
-
// Regex matching
|
33 |
-
$wp_bb_spambots_reg = array(
|
34 |
-
"/^[A-Z]{10}$/", // misc email spam
|
35 |
-
"/^Mozilla...0$/i", // fake user agent/email spam
|
36 |
-
// "/MSIE.*Windows XP/", // misc comment spam
|
37 |
-
);
|
38 |
-
|
39 |
-
foreach ($wp_bb_spambots_str0 as $wp_bb_spambot) {
|
40 |
-
$pos = stripos($wp_bb_http_user_agent, $wp_bb_spambot);
|
41 |
-
if ($pos !== FALSE && $pos == 0) {
|
42 |
-
wp_bb_spammer(); // does not return
|
43 |
-
}
|
44 |
-
}
|
45 |
-
foreach ($wp_bb_spambots_str as $wp_bb_spambot) {
|
46 |
-
if (stripos($wp_bb_http_user_agent, $wp_bb_spambot) !== FALSE) {
|
47 |
-
wp_bb_spammer(); // does not return
|
48 |
-
}
|
49 |
-
}
|
50 |
-
foreach ($wp_bb_spambots_reg as $wp_bb_spambot) {
|
51 |
-
if (preg_match($wp_bb_spambot, $wp_bb_http_user_agent)) {
|
52 |
-
wp_bb_spammer(); // does not return
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bad-behavior/bad-behavior-wordpress.php
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Bad Behavior
|
4 |
-
Version: 1.0.1
|
5 |
-
Plugin URI: http://www.ioerror.us/software/bad-behavior/
|
6 |
-
Description: Stop comment spam before it starts by trapping and blocking spambots before they have a chance to post comments.
|
7 |
-
Author: Michael Hampton
|
8 |
-
Author URI: http://www.ioerror.us/
|
9 |
-
License: GPL
|
10 |
-
|
11 |
-
Bad Behavior - detects and blocks unwanted Web accesses
|
12 |
-
Copyright (C) 2005 Michael Hampton
|
13 |
-
|
14 |
-
This program is free software; you can redistribute it and/or modify
|
15 |
-
it under the terms of the GNU General Public License as published by
|
16 |
-
the Free Software Foundation; either version 2 of the License, or
|
17 |
-
(at your option) any later version.
|
18 |
-
|
19 |
-
This program is distributed in the hope that it will be useful,
|
20 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
-
GNU General Public License for more details.
|
23 |
-
|
24 |
-
You should have received a copy of the GNU General Public License
|
25 |
-
along with this program; if not, write to the Free Software
|
26 |
-
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
27 |
-
|
28 |
-
|
29 |
-
This is beta software so please report any problems to
|
30 |
-
badbots AT ioerror DOT us
|
31 |
-
*/
|
32 |
-
|
33 |
-
###############################################################################
|
34 |
-
###############################################################################
|
35 |
-
|
36 |
-
// Configuration
|
37 |
-
|
38 |
-
// Log failed requests to the database.
|
39 |
-
$wp_bb_logging = TRUE;
|
40 |
-
|
41 |
-
// Log all requests to the database, not just failed requests.
|
42 |
-
$wp_bb_verbose_logging = FALSE;
|
43 |
-
|
44 |
-
// How long to keep the logs around (in days).
|
45 |
-
$wp_bb_logging_duration = 7;
|
46 |
-
|
47 |
-
// Email address to contact you in case of problems
|
48 |
-
// This will be shown to users on the error page, which means it will
|
49 |
-
// be exposed to spammers! Bad Behavior will munge it automatically; you
|
50 |
-
// should NOT munge it here!
|
51 |
-
$wp_bb_email = "badbots@ioerror.us";
|
52 |
-
|
53 |
-
###############################################################################
|
54 |
-
|
55 |
-
# DO NOT EDIT BELOW THIS LINE
|
56 |
-
|
57 |
-
###############################################################################
|
58 |
-
|
59 |
-
$wp_bb_mtime = explode(' ', microtime());
|
60 |
-
$wp_bb_timer_start = $wp_bb_mtime[1] + $wp_bb_mtime[0];
|
61 |
-
define('WP_BB_CWD', dirname(__FILE__));
|
62 |
-
|
63 |
-
// WordPress-specific code
|
64 |
-
|
65 |
-
function wp_bb_date() {
|
66 |
-
return get_gmt_from_date(current_time('mysql'));
|
67 |
-
}
|
68 |
-
|
69 |
-
function wp_bb_db_query($query) {
|
70 |
-
global $wpdb;
|
71 |
-
|
72 |
-
$result = $wpdb->query($query);
|
73 |
-
if (mysql_error()) {
|
74 |
-
return FALSE;
|
75 |
-
}
|
76 |
-
return $result;
|
77 |
-
}
|
78 |
-
|
79 |
-
// Load core functions and do initial checks
|
80 |
-
require_once(WP_BB_CWD . "/bad-behavior-core.php");
|
81 |
-
|
82 |
-
$wp_bb_mtime = explode(' ', microtime());
|
83 |
-
$wp_bb_timer_stop = $wp_bb_mtime[1] + $wp_bb_mtime[0];
|
84 |
-
$wp_bb_timer_total = $wp_bb_timer_stop - $wp_bb_timer_start;
|
85 |
-
|
86 |
-
function wp_bb_timer_display() {
|
87 |
-
global $wp_bb_timer_total;
|
88 |
-
echo "\n<!-- Bad Behavior run time: " . number_format($wp_bb_timer_total, 3) . " seconds -->\n";
|
89 |
-
}
|
90 |
-
|
91 |
-
add_action('wp_head', 'wp_bb_timer_display');
|
92 |
-
|
93 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|