WIP print all sections
This commit is contained in:
parent
5fff05a76f
commit
e16e7efe9e
56
bin/debug.js
56
bin/debug.js
|
@ -3,6 +3,7 @@
|
|||
// node bin/debug.js ../dig.js/blar.DOEsNteXiST.AJ.OnEal.DAplIE.me.any.0.bin
|
||||
// node bin/debugd.js ../dig.js/blar.DOEsNteXiST.AJ.OnEal.DAplIE.me.any.0.bin
|
||||
// dig @localhost -p 65053 ANY DOEsNteXiST.AJ.OnEal.DAplIE.me
|
||||
// dd if=../dig.js/blar.DOEsNteXiST.AJ.OnEal.DAplIE.me.any.0.bin of=blar.DOEsNteXiST.AJ.OnEal.DAplIE.me.any.0.trunc.bin bs=1 count=78
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
|
@ -77,8 +78,9 @@ function unpackQuestionLabels(opts) {
|
|||
+ ' 0x' + pointer.toString(16) + ' (' + pointer + ')'
|
||||
+ ' at byte index'
|
||||
+ ' 0x' + leftPad(total.toString(16)) + ' (' + total + ')'
|
||||
+ ' which back-references:'
|
||||
//+ ' which back-references:'
|
||||
);
|
||||
/*
|
||||
console.log('-4', dv.getUint8(pointer - 4, false));
|
||||
console.log('-3', dv.getUint8(pointer - 3, false));
|
||||
console.log('-2', dv.getUint8(pointer - 2, false));
|
||||
|
@ -94,6 +96,7 @@ function unpackQuestionLabels(opts) {
|
|||
console.log('+2', dv.getUint8(total + 2, false));
|
||||
console.log('+3', dv.getUint8(total + 3, false));
|
||||
console.log('+4', dv.getUint8(total + 4, false));
|
||||
*/
|
||||
//total += 1;
|
||||
opts.cp = true;
|
||||
qnames.push(unpackQuestionLabels({ dv: dv, total: pointer, len: len }).qname);
|
||||
|
@ -150,28 +153,9 @@ for (count = 0; count < qdcount; count += 1) {
|
|||
console.log('');
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log('//////////////////');
|
||||
console.log('// ANSWER //');
|
||||
console.log('//////////////////');
|
||||
console.log('');
|
||||
for (count = 0; count < ancount; count += 1) {
|
||||
console.log('');
|
||||
console.log('Answer', count + 1, 'of', ancount + ' (byte index: 0x' + q.total.toString(16) + ' ' + q.total + ')');
|
||||
q = unpackQuestion(dv, q.total, ab.byteLength);
|
||||
console.log('');
|
||||
}
|
||||
|
||||
|
||||
console.log('');
|
||||
console.log('//////////////////');
|
||||
console.log('// AUTHORITY //');
|
||||
console.log('//////////////////');
|
||||
console.log('');
|
||||
for (count = 0; count < nscount; count += 1) {
|
||||
console.log('');
|
||||
console.log('Authority', count + 1, 'of', nscount + ' (byte index: 0x' + q.total.toString(16) + ' ' + q.total + ')');
|
||||
q = unpackQuestion(dv, q.total, ab.byteLength);
|
||||
function unpackResourceRecord(dv, q, ab) {
|
||||
var _q = unpackQuestion(dv, q.total, ab.byteLength);
|
||||
q.total = _q.total;
|
||||
console.log('ttl (len 4):', dv.getUint32(q.total, false));
|
||||
q.total += 4;
|
||||
q.rdlength = dv.getUint16(q.total, false);
|
||||
|
@ -183,6 +167,30 @@ for (count = 0; count < nscount; count += 1) {
|
|||
console.log('');
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log('//////////////////');
|
||||
console.log('// ANSWER //');
|
||||
console.log('//////////////////');
|
||||
console.log('');
|
||||
for (count = 0; count < ancount; count += 1) {
|
||||
console.log('');
|
||||
console.log('Answer', count + 1, 'of', ancount + ' (byte index: 0x' + q.total.toString(16) + ' ' + q.total + ')');
|
||||
unpackResourceRecord(dv, q, ab);
|
||||
console.log('');
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log('//////////////////');
|
||||
console.log('// AUTHORITY //');
|
||||
console.log('//////////////////');
|
||||
console.log('');
|
||||
for (count = 0; count < nscount; count += 1) {
|
||||
console.log('');
|
||||
console.log('Authority', count + 1, 'of', nscount + ' (byte index: 0x' + q.total.toString(16) + ' ' + q.total + ')');
|
||||
unpackResourceRecord(dv, q, ab);
|
||||
console.log('');
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log('//////////////////');
|
||||
console.log('// ADDITIONAL //');
|
||||
|
@ -191,7 +199,7 @@ console.log('');
|
|||
for (count = 0; count < arcount; count += 1) {
|
||||
console.log('');
|
||||
console.log('Additional', count + 1, 'of', arcount + ' (byte index: 0x' + q.total.toString(16) + ' ' + q.total + ')');
|
||||
q = unpackQuestion(dv, q.total, ab.byteLength);
|
||||
unpackResourceRecord(dv, q, ab);
|
||||
console.log('');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue