Forum Discussion

Azzeddine_S's avatar
Mar 15, 2022

How to extract Address from DNS::Answer ??

Hi all i

am trying to extract from a DNS:answer ony the IP address of the record by spliting the answer using "} {" spliting delimiter but it seems that using both of these caracters is not possible.

is there any way to use them, or may be a more optimal way to get IP address of the record answers.

thanks

  • Here is the answer
     
    when DNS_RESPONSE {
     
             set records [DNS::answer]
         
             foreach record $records {
        
                   log local0. "The IP address for the FQDN [DNS::question name]  is [DNS::rdata $record]"
       
      }
    }

1 Reply

  • Here is the answer
     
    when DNS_RESPONSE {
     
             set records [DNS::answer]
         
             foreach record $records {
        
                   log local0. "The IP address for the FQDN [DNS::question name]  is [DNS::rdata $record]"
       
      }
    }