The standalone package library

Reviewable at https://dev.tornevall.net/sources/dnsbl/tornevall_dnsbl.php

Usage

 

Resolving in it's simplest form
require_once(__DIR__ . "/tornevall_dnsbl.php");
$dnsbl = new \TorneLIB\TorneLIB_DNSBL();
if ($dnsbl->isListed($testaddr)) {
    /* Actions to take against this host */
}

Other methods

MethodParametersTypeResult
isListed()
ipAddressboolThe example above
resolveBlacklist()
ipAddress (v4/v6)
getListedTypes (default=false) 
array

An array with strings defined in TORNEVALL_DNSBL_BITS.
The constants are listed below.

BIT_REPORTED = 1
BIT_CONFIRMED = 2
BIT_FRAUDBL = 4
BIT_EMPTY = 8
BIT_SPAM = 16
BIT_ANONYMOUS = 32
BIT_ABUSE = 64
BIT_DIFFERENTSTATE = 128

When getListedTypes are set to true, this function is returning data from TORNEVALL_DNSBL_BITS::getBitArray() 

getBitArray()
bitValue (integer)array 
getBlVersion()
blZonestringIf no zone are given the default value from the class TORNEVALL_DNSBL_ZONES is set to dnsbl.tornevall.org.
As described above, which DNSBL version is active, this function returns the version id of the current release. 
isBit()
bitType, bitValuebool

The TORNEVALL_DNSBL_BITS-class also have another method callable from public called isBit().
Let's say that you have the bitmask value 80, which represents the two bits BIT_ABUSE (64) and BIT_SPAM (16), you can ask this function if they are present. 

isBit()-method
$bitValue = 80;
$BitClass = new \TorneLIB\TORNEVALL_DNSBL_BITS();
if ($BitClass->isBit(self::BIT_SPAM, $bitValue)) { /* Do something here */ }
if ($BitClass->isBit(self::BIT_ABUSE, $bitValue)) { /* Do something here */ }

This method is calling isBit() in the TORNEVALL_DNSBL_BITS-class.

What is happening in this component?

Summary T Created Updated Status Resolution
Loading...
Refresh

  • No labels