Example #1
0
 function getCheckIPResults()
 {
     $out = array();
     foreach ($this->ips as $ip => $ipinfo) {
         list($reason, $scorefactor) = $ipinfo;
         $res = SblamURI::gethostbynamel($this->reverse($ip));
         if ($res) {
             foreach ($res as $resip) {
                 $tmp = $this->score($ip, $resip, $reason, $scorefactor);
                 if ($tmp) {
                     $out[] = $tmp;
                 }
             }
         }
     }
     if (!count($out)) {
         return NULL;
     }
     $res = Sblam::sumResults($out);
     if ($res[0] > 1) {
         $res[0] = 1;
     }
     if ($res[1] > self::CERTAINITY_HIGH) {
         $res[1] = self::CERTAINITY_HIGH;
     }
     return $res;
 }
Example #2
0
 function getCheckHostResults()
 {
     $score = 0;
     foreach ($this->addedhosts as $host => $whatever) {
         $host .= '.multi.surbl.org';
         $res = SblamURI::gethostbynamel($host);
         if ($res && count($res)) {
             d($res, "found banned {$host}");
             $score += 3;
             $mask = 0;
             foreach ($res as $ip) {
                 $mask |= ip2long($ip);
             }
             $mask &= 127 - 1 - 16;
             // outblaze list has false positives, so lower score
             d($mask, "banned mask");
             while ($mask) {
                 $score++;
                 $mask >>= 1;
             }
             d("total surbl score until now is {$score}");
         } else {
             d("{$host} not listed {$res}");
         }
     }
     $finalscore = min(0.4 + $score / 25, 1.5);
     if ($score) {
         return array($finalscore, $score >= 13 ? self::CERTAINITY_HIGH : self::CERTAINITY_NORMAL, "Linked sites in SURBL (" . round($finalscore, 1) . " = {$score})");
     }
     return NULL;
 }