Drupal badbehavior module:
--------------------------

(2007-09-02 by Juerg Rohrer) I am not the maintainer of this module, I am just trying to help :-)

The attached module was created using
- The original badbehaviour module version 4.7.x-1.7-dev from http://drupal.org/node/30501
- The patch created by eaton see http://drupal.org/node/81577#comment-170144

The result is a version of badbehavior for Drupal 5.2x working with Bad Behavior version 2.0.10

Please note that you still have to download Bad-Behaviour from http://www.bad-behavior.ioerror.us/download/

Installing instructions:

1) Download Bad-Behavior version 2.0.10 from http://www.bad-behavior.ioerror.us/download/
2) Unpack bad-behaviour-2.0.10.zip in sites/all/modules ( unzip -a bad-behavior-2.0.10.zip ).
This will create a folder sites/all/modules/Bad-Behavior
3) Rename the attached file to badbehaviour-5.tar.gz (it was not possible to upload it with this extension)
4) Untar this Drupal module in sites/all/modules. This will add badbehavior.info , badbehavior.module,
LICENSE.txt as well as README-Drupal.txt to the folder /Bad-Behaviour

Enable the module as usual from the Drupal admin>>modules page.

If you can't get the directory structure right, I have also created one complete archive, which includes both the
Drupal module and badbehavior 2.0.10. It is available at http://timeforchange.org/badbehavior-drupal-5

For questions, please see the FAQ at http://www.bad-behavior.ioerror.us/faq/

Configuration and logs, see in the "old" README.txt

Comments

Anonymous’s picture

Status: Fixed » Closed (fixed)
juerg’s picture

Make sure to download the newest version of badbehavior from http://www.bad-behavior.ioerror.us/2007/12/06/bad-behavior-2011/ otherwise you get blocked out of your own site.

Version 2.0.10 is NOT working any more, you need version 2.0.11

Juerg

westbywest’s picture

This module package still appears to be missing the file badbehavior.install, and the function badbehavior_install() containing necessary code to create DB tables.

Here is relevant code from bad-behavior/core.inc.php:

// Our log table structure
function bb2_table_structure($name)
{
        // It's not paranoia if they really are out to get you.
        $name_escaped = bb2_db_escape($name);
        return "CREATE TABLE IF NOT EXISTS `$name_escaped` (
                `id` INT(11) NOT NULL auto_increment,
                `ip` TEXT NOT NULL,
                `date` DATETIME NOT NULL default '0000-00-00 00:00:00',
                `request_method` TEXT NOT NULL,
                `request_uri` TEXT NOT NULL,
                `server_protocol` TEXT NOT NULL,
                `http_headers` TEXT NOT NULL,
                `user_agent` TEXT NOT NULL,
                `request_entity` TEXT NOT NULL,
                `key` TEXT NOT NULL,
                INDEX (`ip`(15)),
                INDEX (`user_agent`(10)),
                PRIMARY KEY (`id`) );"; // TODO: INDEX might need tuning
}

How difficult would it be to wrap this inside the file badbehavior.install correctly? (I.e. by "correctly" I mean so that it handles MySQL vs. PostgreSQL, unisntallation, etc.)

westbywest’s picture

StatusFileSize
new2.55 KB

I've manged to fix this. The bad-behavior scripts (and not the associated Drupal module) did indeed create the necessary database table, but it didn't include the db_prefix in the table name, meaning the module couldn't find it.

I fixed this by replacing all instances of 'bad_behavior_log' with db_prefix_tables('{bad_behavior_log}') in the file badbehavior.module. Note that the single quotes should be *included* in those strings. Also note that I also had to delete the row named "badbehavior_db_installed" from the {variable} table to get the BB2 scripts to reinstall their log table.

This is really another reason why the file badbehavior.install is necessary, since you can define the function badbehavior_uninstall() to do these tasks for you.

I include my patched module file. Beware this is for Drupal 5.x and BB2, not Drupal v4.7!

rhouse’s picture

Re #3 and #4: Inside badbehavior.module, there is a bb2_install function that indirectly calls bb2_table_structure. Doesn't this do what you ask for in #3? If not, what am I missing?

Thanks, Ron.

wilco’s picture

Version: 5.x-1.2-beta1 » 7.x-1.x-dev
Assigned: wilco » Unassigned
Status: Fixed » Needs review

Hello Folks!

With all the brilliant work done so far on this Drupal 5 module and the Drupal 6 version. I thought it would be appropriate to roll up a new version of the module with some install/uninstall hooks. Much of what pobster did has helped to clean up this edition of the module.

I hope it meets everyones needs and expectations.

wilco’s picture

Version: 4.7.x-1.x-dev » 5.x-1.2-beta1
Status: Closed (fixed) » Fixed

I've taken the patch and reworked the module with some of the work done on the Drupal 6 version. I'm closing this ticket as I've released a BETA version of the module with all these points taken into consideration.

wilco’s picture

Assigned: Unassigned » wilco
wilco’s picture

StatusFileSize
new4.97 KB

Apparently I did something wrong with my uploading tarballs -- instructions were lost in translation. So, I'm including the file here.

Anonymous’s picture

Version: 7.x-1.x-dev » 5.x-1.2-beta1
Assigned: Unassigned » wilco
Status: Needs review » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.