The UDP object doesn't expose decoded DNS data if the sport or dport are 53. It just saves the data as this.data:
this.data = raw_packet.slice(offset, offset + (this.length - 8));
However, it does decode DNS in the toString() function:
UDP.prototype.toString = function () {
var ret = "UDP " + this.sport + "->" + this.dport + " len " + this.length;
if (this.sport === 53 || this.dport === 53) {
ret += (new DNS().decode(this.data, 0, this.data.length).toString());
}
return ret;
};
Moreover, the pcap library doesn't export the DNS decoder for a developer to manually decode DNS.
Is there a way to get the decoded DNS packet from a UDP packet?
Thanks
The
UDPobject doesn't expose decodedDNSdata if thesportordportare 53. It just saves the data asthis.data:However, it does decode
DNSin thetoString()function:Moreover, the
pcaplibrary doesn't export theDNSdecoder for a developer to manually decode DNS.Is there a way to get the decoded
DNSpacket from aUDPpacket?Thanks