Ejemplo n.º 1
0
 public function execute($hostname)
 {
     $server = $this->getContext();
     $query = Utils::getHostForLookup($hostname, $server->getHostname(), true);
     $result = @$this->query($query);
     $response = new Response\NetDnsResponse();
     $response->setHostname($hostname);
     $response->setServer($server);
     $response->setQuery($query);
     if ($result) {
         $response->listed();
         $answer = '';
         $resultTXT = @$this->query($query, 'TXT');
         if ($resultTXT) {
             foreach ($resultTXT->answer as $txt) {
                 $answer .= $txt->text[0];
             }
         } else {
             $resultA = @$this->query($query, 'A');
             if ($resultA && isset($resultA->answer[0])) {
                 $answer = $resultA->answer[0]->address;
             }
         }
         $response->setAnswer($answer);
     }
     return $response;
 }
Ejemplo n.º 2
0
 /**
  * Execute query
  *
  * @param string $hostname
  *
  * @return Dnsbl\Resolver\Response\InterfaceResponse
  */
 public function execute($hostname)
 {
     $server = $this->getContext();
     $result = @file($this->location);
     $response = new Response\NetDnsResponse();
     $response->setHostname($hostname);
     $response->setServer($server);
     $response->setQuery($this->location);
     if ($result) {
         foreach ($result as $value) {
             if (trim($hostname) === trim($value)) {
                 $response->listed();
             }
         }
     }
     return $response;
 }
Ejemplo n.º 3
0
 /**
  * Execute query
  *
  * @param string $hostname
  *
  * @return Dnsbl\Resolver\Response\InterfaceResponse
  */
 public function execute($hostname)
 {
     $server = $this->getContext();
     $query = $hostname . '.' . $server->getHostname();
     $result = @$this->query($query);
     $response = new Response\NetDnsResponse();
     $response->setHostname($hostname);
     $response->setServer($server);
     $response->setQuery($query);
     if ($result) {
         $response->listed();
         $answer = '';
         $resultTXT = @$this->query($query, 'TXT');
         if ($resultTXT) {
             foreach ($resultTXT->answer as $txt) {
                 $answer .= $txt->text[0];
             }
         }
         $response->setAnswer($answer);
     }
     return $response;
 }