fix false positive on 0x20 failure
This commit is contained in:
parent
e1d0322ed2
commit
f8b2fb7ff8
16
bin/dig.js
16
bin/dig.js
|
@ -186,6 +186,7 @@ cli.main(function (args, cli) {
|
|||
|
||||
cli.onMessage = function (nb) {
|
||||
var packet = dnsjs.DNSPacket.parse(nb.buffer.slice(nb.byteOffset, nb.byteOffset + nb.byteLength));
|
||||
var fail0x20;
|
||||
|
||||
if (packet.id !== query.id) {
|
||||
console.log('ignoring packet for ', packet.question[0].name);
|
||||
|
@ -197,6 +198,13 @@ cli.main(function (args, cli) {
|
|||
console.log(packet);
|
||||
}
|
||||
|
||||
packet.question.forEach(function (q) {
|
||||
// if (-1 === q.name.indexOf(cli.casedQuery))
|
||||
if (q.name !== cli.casedQuery) {
|
||||
fail0x20 = q.name;
|
||||
}
|
||||
});
|
||||
|
||||
if (!cli.norecase && !cli.recase) {
|
||||
[ 'question', 'answer', 'authority', 'additional' ].forEach(function (group) {
|
||||
(packet[group]||[]).forEach(function (a) {
|
||||
|
@ -225,14 +233,12 @@ cli.main(function (args, cli) {
|
|||
});
|
||||
}
|
||||
|
||||
packet.question.forEach(function (q) {
|
||||
// if (-1 === q.name.indexOf(cli.casedQuery))
|
||||
if (q.name !== cli.casedQuery) {
|
||||
if (fail0x20) {
|
||||
console.warn("");
|
||||
console.warn(";; Warning: DNS 0x20 security not implemented (or packet spoofed). Queried '" + cli.casedQuery + "' but got response for '" + q.name + "'.");
|
||||
console.warn(";; Warning: DNS 0x20 security not implemented (or packet spoofed). Queried '" + cli.casedQuery + "' but got response for '" + fail0x20 + "'.");
|
||||
console.warn("");
|
||||
}
|
||||
});
|
||||
|
||||
console.log(';; Got answer:');
|
||||
dig.logQuestion(packet);
|
||||
|
||||
|
|
Loading…
Reference in New Issue