[ Index ]

PHP Cross Reference of phpwcms V1.4.3 _r380 (23.11.09)

title

Body

[close]

/include/inc_module/mod_bad-behavior/bad-behavior/ -> blackhole.inc.php (source)

   1  <?php if (!defined('BB2_CORE')) die('I said no cheating!');
   2  
   3  // Look up address on various blackhole lists.
   4  // These cannot be used for GET requests under any circumstances!
   5  function bb2_blackhole($package) {
   6      // Only conservative lists
   7      $bb2_blackhole_lists = array(
   8          "sbl-xbl.spamhaus.org",    // All around nasties
   9  //        "dnsbl.sorbs.net",    // Old useless data.
  10  //        "list.dsbl.org",    // Old useless data.
  11  //        "dnsbl.ioerror.us",    // Bad Behavior Blackhole
  12      );
  13      
  14      // Things that shouldn't be blocked, from aggregate lists
  15      $bb2_blackhole_exceptions = array(
  16          "sbl-xbl.spamhaus.org" => array("127.0.0.4"),    // CBL is problematic
  17          "dnsbl.sorbs.net" => array("127.0.0.10",),    // Dynamic IPs only
  18          "list.dsbl.org" => array(),
  19          "dnsbl.ioerror.us" => array(),
  20      );
  21  
  22      // Check the blackhole lists
  23      $ip = $package['ip'];
  24      $find = implode('.', array_reverse(explode('.', $ip)));
  25      foreach ($bb2_blackhole_lists as $dnsbl) {
  26          $result = gethostbynamel($find . "." . $dnsbl . ".");
  27          if (!empty($result)) {
  28              // Got a match and it isn't on the exception list
  29              $result = @array_diff($result, $bb2_blackhole_exceptions[$dnsbl]);
  30              if (!empty($result)) {
  31                  return '136673cd';
  32              }
  33          }
  34      }
  35      return false;
  36  }
  37  ?>


Generated: Wed Dec 30 05:55:15 2009 Cross-referenced by PHPXref 0.7