Location: PHPKode > scripts > Spambot Trap Deluxe > spambot-trap-deluxe/class.ezSpamBotTrap.php
<?php

/****************************************
 * ezSpamBotTrap - v3.20070924
 *
 * This script generates a labyrinth
 * of random e-mail-addresses.
 *
 * This script is to free the world
 * from Spam! Make love not spam!
 *
 * This script can be used always for free
 * and should never be sold and is free for 
 * sharing. Never remove this text.
 * 
 * ! CAUTION !
 * Usage of this script is always on your
 * own risk! You should always use the script
 * far away of your main ip/domain.
 * Spammer may dislike your actions and
 * try to harm your servers or reputation.
 * You should also have no limits on traffic.
 * Spambots are as stupid as their creators
 * and may spider your pages without ending.
 * An exit link is created on each page to 
 * hopefully prevent.
 * Be warned of spam-abuse to your domains
 * and high traffic-rates!
 * The author doesnt care. It is all up to 
 * yourself. Theres no liability, no warranty.
 *
 */


/* Generate Spambot-Labyrinth-Page */
class ezSpamBotTrap
{
  /*** PRIVATE ***/
  var $page_num               = 0;
  var $count_pagebrowserlinks = 1;
  var $count_maxpages         = 100000;
  var $count_addresses        = 1;
  var $email_link             = TRUE;
  var $chars1                 = 'abcdefghijklmnopqrstuvwxyz';
  var $chars2                 = 'abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz';
  var $tlds = array('aero', 'arpa', 'biz', 'com', 'coop', 'edu', 'org', 'gov', 'info',
                    'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'pro', 'travel',
                    'co.uk', 'ac.uk', 'com.br', 'com.co', 'co.id', 'co.il', 'co.kr', 'com.mx',
                    'com.my', 'co.nz', 'com.sa', 'co.th', 'co.za', 'com.ua', 'com.tr', 'com.mt',
                    'co.hu', 'com.fr', 'com.au', 'com.ar', 'co.at', 'or.at', 'org.uk', 'me.uk',
                    'com.cn', 'net.cn', 'org.cn', 'de.com', 'eu.com', 'com.es', 'org.es', 
                    'biz.pl', 'com.pl', 'info.pl', 'net.pl', 'org.pl', 'com.pt', 'com.ro',
                    'gb.com', 'com.ag', 'net.ag', 'org.ag', 'us.com', 'co.in', 'net.in', 'org.in',
                    'firm.in', 'gen.in', 'ind.in', 'com.sg', 'com.tw', 'org.tw', 'com.sc', 'net.sc',
                    'org.sc', 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq',
                    'ar', 'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg',
                    'bh', 'bi', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz',
                    'ca', 'cat', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co',
                    'cr', 'cs', 'cu', 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz',
                    'ec', 'ee', 'eg', 'eh', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo',
                    'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', 'gn', 'gp',
                    'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', 'hr', 'ht', 'hu',
                    'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', 'it', 'je', 'jm', 'jo', 
                    'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', 'kr', 'kw', 'ky', 'kz', 'la',
                    'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', 'ma', 'mc', 'md',
                    'mg', 'mh', 'mk', 'ml', 'mm', 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu',
                    'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no',
                    'np', 'nr', 'nt', 'nu', 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl',
                    'pm', 'pn', 'pr', 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'ru', 'rw', 'sa',
                    'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', 'sm', 'sn', 'so',
                    'sr', 'st', 'sv', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', 'tk', 'tl',
                    'tm', 'tn', 'to', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', 'ug', 'uk', 'um', 'us',
                    'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', 'ye', 'yt',
                    'za', 'zm', 'zw');



/*** PUBLIC ***/
/* Constructor */
function ezSpamBotTrap($count_pagebrowserlinks = 1, $count_maxpages = 1, $count_addresses = 1, $email_link = TRUE)
{
    /* Init vars */
    $this->count_pagebrowserlinks = $count_pagebrowserlinks;
    $this->count_maxpages = $count_maxpages;
    $this->count_addresses = $count_addresses;
    $this->email_link = $email_link;

    /* Get page_num */
    $this->page_num = (int)($_GET['page_num']);
 
    /* Render Page2Browser */
    $this->render();
}


/*** PRIVATE ***/
/* Render Page2Browser */
function render()
{
    if (!$this->validate()) $this->page_not_found();

    /* page-header */
    $page = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<HTML>
<HEAD>
<TITLE>E-Mails '.$this->page_num.'</TITLE>
<META NAME="keywords" CONTENT="'.$this->get_keyword().'">
<META NAME="description" CONTENT="'.$this->get_keyword().'">
<META NAME="date" CONTENT="'.date('Y-m-d H:i.s').'">
<META HTTP-EQUIV="content-type" CONTENT="text/html; CHARSET=iso-8859-1">
<META HTTP-EQUIV="content-language" CONTENT="en">
</HEAD>
<BODY>
';

    /* new pagebrowser */
    $page .= '<P>' . $this->get_pagebrowser() . '</P>';

    /* new emails */
    $page .= $this->get_emails();

    /* new pagebrowser */
    $page .= "\n<P>" . $this->get_pagebrowser() . '</P>';
    
    /* new exitlink */
    $page .= "\n<P>" . $this->get_exitlink() . "</P>\n";

    /* page-footer */
    $page .= '</BODY></HTML>';

    /* output page */
    echo $page;
}


/* Validate input */
function validate()
{
    if (!is_int($this->page_num) || $this->page_num > $this->count_maxpages || $this->page_num < 0 || 
        !is_int($this->count_pagebrowserlinks) || count($this->count_pagebrowserlinks) <= 0 ||
        !is_int($this->count_maxpages) || count($this->count_maxpages) <= 0 || !is_int($this->count_addresses) ||
        count($this->count_addresses) <= 0 || !is_bool($this->email_link)) return FALSE;
    return TRUE;
}


/* Page not found */
function page_not_found()
{
    @header("HTTP/1.0 404 Not Found");
    die();
}


/* Generate keywords */
function get_keyword()
{
    $keywords = array('email','emails','emailaddress','emailaddresses','emailadressen','e-mail','e-mails','e-mailaddress','e-mailaddresses','e-mailadressen','e-mail-address','e-mail-addresses','e-mail-adressen','e mail','e mails','e mailaddress','e mailaddresses','e mailadressen','e mail address','e mail addresses','e mail adressen');
    return $keywords[rand(0, count($keywords) - 1)];
}


/* Generate pagebrowser */
function get_pagebrowser()
{
    $pagebrowser = '';
    for ($i = 1; $i <= $this->count_pagebrowserlinks; $i++)
    {
        $newid = rand(0, $this->count_maxpages);
        $pagebrowser .= '<A HREF="' . $newid . '.html">' . $newid . '</A>';
        if ($i != $this->count_pagebrowserlinks) $pagebrowser .= " | \n";
    }
    return $pagebrowser;
}


/* Generate single random email-addresses */
function create_email()
{
         $output     = '';
         $name_len1  = rand(2, 20); // name-part1 2-20 chars
         $name_len2  = rand(2, 20); // name-part2 2-20 chars
         $domain_len = rand(7, 50); // domain-name 7-50 chars

         /* 1st mail-name part */
         for ($i = 0; $i < $name_len1; $i++) $output .= $this->chars1{rand(0, strlen($this->chars1))};
         $spacer = rand(0, 5);  //spacer or not
         switch ($spacer)
         {
             case 0: $output .= '.';
             break;
             case 1: $output .= '_';
             break;
             case 2: $output .= '-';
             break;
         }

         /* 2nd mail-name part */
         for ($i = 0; $i < $name_len2; $i++) $output .= $this->chars2{rand(0, strlen($this->chars2))};
         $output .= '@';

         /* 1st mail-domain part */
         $temp_output = '';
         for ($i = 0; $i < $domain_len; $i++) $temp_output .= $this->chars2{rand(0, strlen($this->chars2))};
         $spacer = rand (0,3);
         switch ($spacer)
         {
             case 0: $temp_output{rand(1, strlen($temp_output) - 6)} = '.';
             break;
             case 1: $temp_output{rand(1, strlen($temp_output) - 6)} = '-';
             break;
         }
         $output .= $temp_output;      

         /* 2nd mail-domain part - tld */
         $output .= '.';
         $output .= $this->tlds[rand(0, (count($this->tlds) - 1))];
         return $output;
}


/* Generate email-addresses and links */
function get_emails()
{
         $addresses = "\n";
         for ($i = 1; $i <= $this->count_addresses; $i++)
         {
              $new_address = $this->create_email();
              if ($this->email_link)
              {
                    $addresses .= '<A HREF="mailto:' . $new_address . '">';
                    $addresses .= $new_address . '</A>';
              } else {
                    $addresses .= $new_adress;
              }
              if ($i != $this->count_addresses) $addresses .= " <BR>\n";
         }
         return $addresses;
}


/* Generate exitlink */
function get_exitlink()
{
    $exitlink = '<A HREF="http://';
    $temp_exitlink = 'www.';
    $domain_length = rand(10, 40); 
    for ($i = 0; $i < $domain_length; $i++) $temp_exitlink .= $this->chars2{rand(0, strlen($this->chars2))};
    $temp_exitlink  .= '.' . $this->tlds[rand(0, (count($this->tlds)-1))];
    $exitlink .= $temp_exitlink;
    $exitlink .= '">' . $temp_exitlink . '</A>';
    return $exitlink;
}


} //END class.ezSpamBotTrap.php


?>
Return current item: Spambot Trap Deluxe