Tarpit for bad bots

I recently built a tarpit for bad bots.

The primary function is to automatically trap and block bots that don't obey robots.txt rules

download is available at the googlecode repo

Yii Setup

How to set up php-labrea for use with the yii framework Details

Unzip to the root dir.
Edit your protected/views/layout/main.php add


<?php $pitdir = "http://" . $_SERVER['HTTP_HOST'] . "/php-labrea/"; ?>
    <a href="<?php echo $pitdir; ?>"><img src="images/pixel.gif" border="0" 
    alt=" " width="1" height="1" style="display:none;"></a>
Edit your index.php bootstrap adding to the top of the file


include($_SERVER['DOCUMENT_ROOT'] . "/php-labrea/classes/tarpit.php"); 
    // change the following paths if necessary
    $tarpit=new tarpit;

    if($tarpit->isBot()){
            $location="http://" . $_SERVER['HTTP_HOST'] ."/php-labrea";
            header('location:'.$location);
            exit;
    }else 

1 0
9 followers
Viewed: 10 330 times
Version: 1.1
Category: How-tos
Tags: bots, tarpit
Written by: mithereal
Last updated by: mithereal
Created on: Jan 11, 2012
Last updated: 12 years ago
Update Article

Revisions

View all history