Net::WDNS - Perl extension for the wdns low-level DNS library
# The primary interface to libwdns is through Net::WDNS::Msg objects: use Net::WDNS qw(:func); for my $pkt (@pkt_source) { my $msg = parse_message($pkt); # same as Net::WDNS::Msg->new($pkt) print $msg->as_str, "\n" if $msg->flags->{aa}; # or print "$msg\n" }
Net::WDNS is a perl binding to libwdns, the low-level DNS library. The library is designed to parse, examine, and render raw DNS packets.
Net::WDNS exports functions and constants from libwdns. Typically interactions with the library will be through the parse_message() function and, subsequently, Net::Nmsg::Msg objects. The rest of the functions exported here are provided for development purposes.
Functions and constants are individually exportable. To export everything, use ':all'. When functions describe dealing with "raw" formats, it means formatted for over the wire. The following tag groups are also available:
Convert a raw message type to a human-readable string.
Convert a raw domain name to a human-readable string.
Convert a numeric opcode to a descriptive string.
Convert a numeric rcode to a descriptive string.
Convert a string description of an rcode to its numeric equivalent.
Convert a numeric rrclass to a descriptive string.
Convert a string description of rrclass to its numeric equivalent.
Convert a numeric rrtype to a descriptive string. See also str_to_rrtype().
str_to_rrtype()
Convert a raw rdata type to a human-readable string.
Convert a string representation of an rdata type to raw format.
Convert a string to a raw rrtype. See also rrtype_to_str().
rrtype_to_str()
Convert a string to a raw domain. See also domain_to_str().
domain_to_str()
Convert a string to a raw domain, preserving case.
Return the length of a raw (uncompressed wire format) domain name.
Return a reversed raw domain.
Return a raw domain with the leftmost domain component (label) removed.
Return the number of components in a raw domain.
Return whether or not the first raw domain is a sub-domain of the second.
Free the memory assosciated with the raw msg. This normally happens during the DESTROY() call to a Net::WDNS::Msg object.
DESTROY()
Return the numeric id of a raw msg.
Return the bit-encoded flags of a raw msg.
Return the numeric rcode of a raw msg.
Return the numeric opcode of a raw msg.
Return the section (0-3) of a raw msg as an array of blessed objects (Net::Nmsg::Question or Net::Nmsg::RR)
WDNS_LEN_HEADER WDNS_MAXLEN_NAME WDNS_MSG_SEC_QUESTION WDNS_MSG_SEC_ANSWER WDNS_MSG_SEC_AUTHORITY WDNS_MSG_SEC_ADDITIONAL WDNS_MSG_SEC_MAX WDNS_PRESLEN_NAME WDNS_PRESLEN_TYPE_A WDNS_PRESLEN_TYPE_AAAA WDNS_OP_QUERY WDNS_OP_IQUERY WDNS_OP_STATUS WDNS_OP_NOTIFY WDNS_OP_UPDATE WDNS_R_NOERROR WDNS_R_FORMERR WDNS_R_SERVFAIL WDNS_R_NXDOMAIN WDNS_R_NOTIMP WDNS_R_REFUSED WDNS_R_YXDOMAIN WDNS_R_YXRRSET WDNS_R_NXRRSET WDNS_R_NOTAUTH WDNS_R_NOTZONE WDNS_R_BADVERS WDNS_CLASS_IN WDNS_CLASS_CH WDNS_CLASS_HS WDNS_CLASS_NONE WDNS_CLASS_ANY WDNS_TYPE_A WDNS_TYPE_NS WDNS_TYPE_MD WDNS_TYPE_MF WDNS_TYPE_CNAME WDNS_TYPE_SOA WDNS_TYPE_MB WDNS_TYPE_MG WDNS_TYPE_MR WDNS_TYPE_NULL WDNS_TYPE_WKS WDNS_TYPE_PTR WDNS_TYPE_HINFO WDNS_TYPE_MINFO WDNS_TYPE_MX WDNS_TYPE_TXT WDNS_TYPE_RP WDNS_TYPE_AFSDB WDNS_TYPE_X25 WDNS_TYPE_ISDN WDNS_TYPE_RT WDNS_TYPE_NSAP WDNS_TYPE_NSAP_PTR WDNS_TYPE_SIG WDNS_TYPE_KEY WDNS_TYPE_PX WDNS_TYPE_GPOS WDNS_TYPE_AAAA WDNS_TYPE_LOC WDNS_TYPE_NXT WDNS_TYPE_EID WDNS_TYPE_NIMLOC WDNS_TYPE_SRV WDNS_TYPE_ATMA WDNS_TYPE_NAPTR WDNS_TYPE_KX WDNS_TYPE_CERT WDNS_TYPE_A6 WDNS_TYPE_DNAME WDNS_TYPE_SINK WDNS_TYPE_OPT WDNS_TYPE_APL WDNS_TYPE_DS WDNS_TYPE_SSHFP WDNS_TYPE_IPSECKEY WDNS_TYPE_RRSIG WDNS_TYPE_NSEC WDNS_TYPE_DNSKEY WDNS_TYPE_DHCID WDNS_TYPE_NSEC3 WDNS_TYPE_NSEC3PARAM WDNS_TYPE_HIP WDNS_TYPE_NINFO WDNS_TYPE_RKEY WDNS_TYPE_TALINK WDNS_TYPE_CDS WDNS_TYPE_SPF WDNS_TYPE_TKEY WDNS_TYPE_TSIG WDNS_TYPE_IXFR WDNS_TYPE_AXFR WDNS_TYPE_MAILB WDNS_TYPE_MAILA WDNS_TYPE_ANY WDNS_TYPE_URI WDNS_TYPE_CAA WDNS_TYPE_TA WDNS_TYPE_DLV
Net::WDNS::Msg, Net::WDNS::Question, Net::WDNS::RD, Net::WDNS::RR, Net::Nmsg
The wdns library can be downloaded from: https://github.com/farsightsec/wdns
Matthew Sisk, <sisk@cert.org>
Copyright (C) 2015-2016 by Carnegie Mellon University
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, as published by the Free Software Foundation, under the terms pursuant to Version 2, June 1991.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
To install Net::WDNS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::WDNS
CPAN shell
perl -MCPAN -e shell install Net::WDNS
For more information on module installation, please visit the detailed CPAN module installation guide.