From 44b4801ef6bc58b1c6ba6d4e1fe910fcc8aea0ed Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 18 Oct 2017 15:26:07 -0600 Subject: [PATCH] use status codes by name --- dns-request.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dns-request.js b/dns-request.js index d866191..76fc81c 100644 --- a/dns-request.js +++ b/dns-request.js @@ -4,11 +4,17 @@ var dnsjs = require('dns-suite'); var crypto = require('crypto'); var dgram = require('dgram'); +var RCODES = { + 0: 'NOERROR' +, 3: 'NXDOMAIN' +, 5: 'REFUSED' +}; + function logQuestion(packet) { var flags = ""; // TODO opcode 0 QUERY rcode 0 NOERROR - console.info(';; ->>HEADER<<- [opcode: ' + packet.header.opcode + ', status: ' + packet.header.rcode + '], id: ' + packet.header.id); + console.info(';; ->>HEADER<<- [opcode: ' + packet.header.opcode + ', status: ' + (RCODES[packet.header.rcode] || packet.header.rcode) + '], id: ' + packet.header.id); if (packet.header.tc) { console.info("Truncated [tc] (we don't know the normal way to print a tc packet... you should record this with -o tc-packet.dig and send it to us)"); } flags += ";; flags:"; if (packet.header.qr) { flags += " qr"; }