Welcome to Geeklog Thursday, December 14 2017 @ 01:09 am EST


Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/2002
Posts: 13073
Location:Stuttgart, Germany
There's a plugin for Wordpress that does what I'm doing a lot with .htaccess: Blocking unwanted requests from spammers and certain bots.

Now, some people can't use a .htaccess or don't want to mess with it. "Bad Behavior" is a plugin for Wordpress, "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." (quote from the homepage).

Since Bad Behavior isn't much more than a set of scripts, I made a quick'n'dirty integration for Geeklog. This is more of an experiment, not quite a usable solution yet (although it works). It completely ignores the option to log anything to the database for now.

  1. Download Bad Behavior
  2. Unzip it into Geeklog's public_html directory (so that you have a "bad-behavior" directory there)
  3. In lib-common.php, right after the require_once line that includes the config.php, add this:
PHP Formatted Code
$wp_bb_logging = FALSE;
$wp_bb_verbose_logging = FALSE;
$wp_bb_logging_duration = 7;    
$wp_bb_cwd = $_CONF['path_html'] . 'bad-behavior';
require_once($wp_bb_cwd . '/bad-behavior-core.php');
 

And that's it. Your site should still work as normal.

To try it out, you could use a browser that allows you to modify the User-Agent header, e.g. with Lynx, try
PHP Formatted Code
lynx -useragent=Digger http://www.example.com/
 

(where example.com is the URL of your site, of course). "Digger" is the name of one of the bots that the plugin blocks.

As I said, this is an experiment. If you think this is useful, I may look into getting the logging to work. I also assume that the original author would like to hear your feedback, e.g. if it causes any problems (or proves a success).

bye, Dirk

IO ERROR

Anonymous
Hey, thanks! I'm excited to see Bad Behavior ported to other PHP-based systems. If you don't mind my asking, why didn't you use the included bad-behavior-generic.php file? It was designed to give a good start to porting efforts such as this.

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/2002
Posts: 13073
Location:Stuttgart, Germany
Quote by IO ERROR: If you don't mind my asking, why didn't you use the included bad-behavior-generic.php file? It was designed to give a good start to porting efforts such as this.

Mainly because I didn't notice it It was a very quick hack ...

bye, Dirk

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/2002
Posts: 13073
Location:Stuttgart, Germany
This is now available as a proper plugin for Geeklog.

bye, Dirk

Status: offline

SmackDaddy

Forum User
Chatty
Registered: 04/05/2005
Posts: 35
Location:Ohio
I have installed it, but on testing it, it's not working for me....I test it and it tells me "if you see this text, Bad Behavior is NOT installed correctly"....?

The instructions do not say where to put the template files and the buttons, so I am not sure if that's my problem or not....

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/2002
Posts: 13073
Location:Stuttgart, Germany
The buttons are just a gimmick. The template files should be in /path/to/geeklog/plugins/bad_behavior/templates/

But I guess the actual problem is that you forgot to add the line in lib-common.php

bye, Dirk

Status: offline

ronack

Forum User
Full Member
Registered: 27/05/2003
Posts: 612
Now this is interesting, I installed this plugin on one of my sites. Right after installing I went to do a test and saw that there was already and entry. The thing caught something before I even had a chance to do a test, within seconds of installing it.

Now that's good, or coincidential.

Status: offline

SmackDaddy

Forum User
Chatty
Registered: 04/05/2005
Posts: 35
Location:Ohio
Quote by Dirk: The buttons are just a gimmick. The template files should be in /path/to/geeklog/plugins/bad_behavior/templates/

But I guess the actual problem is that you forgot to add the line in lib-common.php

bye, Dirk


Nope, the line had been added...and is still there.

I've also uninstalled and reinstalled twice now with no success. I've got several plug-ins installed successfully and had a co-admin go over my steps to ensure I've done it correctly as well, and he cannot find the issue either.

So.....currently it's unintsalled as all I can think is that it may be having an issue with another plugin I have.... **shrugs**

ironmax

Anonymous
Any plans on updating this plugin to look at referrer proxies? Starting to get alot of proxy hits from the vary IPs that have been banned.

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/2002
Posts: 13073
Location:Stuttgart, Germany
Quote by: ironmax

Any plans on updating this plugin to look at referrer proxies?


You would have to ask Michael Hampton about this - I've only wrapped his code into Geeklog.

Btw, there already is a Bad Behavior version 2, but I haven't had the time to look into it. So if someone wants to have a go - feel free.

bye, Dirk

All times are EST. The time is now 01:09 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content