[Mimedefang] Net::DNS referral section for a Domain?
Dale Moore
Dale.Moore at cs.cmu.edu
Thu Nov 13 18:51:42 EST 2014
Instead of using the $reply->answer
Use the $reply->authority section.
use Net::DNS;
my $res = Net::DNS::Resolver->new() ||
die "No Resolver\n";
my $reply = $res->query('pccc .com') ||
die "No Reply\n";
my $authority = $reply->authority ||
die "No Authority\n";
foreach my $rr ( $reply->authority) {
( $rr->type eq 'NS' ) || next;
print $rr->nsdname , "\n";
}
-----Original Message-----
From: mimedefang-bounces at lists.roaringpenguin.com [mailto:mimedefang-bounces at lists.roaringpenguin.com] On Behalf Of Kevin A. McGrail
Sent: Thursday, November 13, 2014 5:44 PM
To: mimedefang at lists.roaringpenguin.com
Subject: [Mimedefang] Net::DNS referral section for a Domain?
Trying to do some checks on spam by nameservers but I can't figure out how to find the referral nameservers for a domain from the
root servers.
For example, this snippet is NOT what I need, I don't think:
use Net::DNS;
my $res = Net::DNS::Resolver->new;
my $reply = $res->query("pccc.com", "NS");
if ($reply) {
foreach $rr (grep { $_->type eq 'NS' } $reply->answer) {
print $rr->nsdname, "\n";
}
}
else {
warn "query failed: ", $res->errorstring, "\n";
}
This snippet gets the SOA records which don't have to agree with whois, for example:
ns3.pccc.com
ns.2rad.net
ns.pccc.com
ns2.pccc.com
But perhaps it's because our system will check and the servers are authoritative.
What we want is the equivalent of a dig +trace referral record which would be:
;; Received 486 bytes from 198.41.0.4#53(a.root-servers.net) in 9 ms
pccc.com. 172800 IN NS ns.pccc.com.
pccc.com. 172800 IN NS ns2.pccc.com.
pccc.com. 172800 IN NS ns3.pccc.com.
Any thoughts on how to do that programmatically with Net::DNS?
Regards,
KAM
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above message, it is NULL AND VOID. You may ignore it.
Visit http://www.mimedefang.org and http://www.roaringpenguin.com MIMEDefang mailing list MIMEDefang at lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
More information about the MIMEDefang
mailing list