Comparing version 1.1.2 to 1.2.1
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
@@ -2,0 +3,0 @@ |
@@ -0,1 +1,2 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
@@ -7,4 +8,5 @@ | ||
if (!type) { | ||
console.error("Usage: node aj-listener.js <type> [count]"); | ||
console.error("Example: node aj-listener.js _service 0"); | ||
console.error("Usage: mdns-capture.js <filename-prefix> [start-number]"); | ||
console.error("Example: mdns-capture.js _service 0"); | ||
console.error("Output: _service-0.mdns.bin"); | ||
process.exit(1); | ||
@@ -42,5 +44,7 @@ } | ||
console.log(server.address()); | ||
server.setBroadcast(true); | ||
server.addMembership('224.0.0.251'); | ||
console.log('CTRL+C to quit'); | ||
}; | ||
@@ -47,0 +51,0 @@ |
@@ -49,2 +49,6 @@ (function (exports) { | ||
if (ui8.byteLength - total < len) { | ||
//console.error('-1', ui8[total - 1]); | ||
//console.error(' 0', ui8[total]); | ||
//console.error(' 1', ui8[total + 1]); | ||
//console.error(' 1', ui8[total + 2]); | ||
throw new Error( | ||
@@ -51,0 +55,0 @@ "Expected a string of length " + len |
{ | ||
"name": "dns-suite", | ||
"version": "1.1.2", | ||
"version": "1.2.1", | ||
"description": "testing dns", | ||
"main": "dns.js", | ||
"bin": { | ||
"dns-pack.js": "bin/dns-pack.js", | ||
"dns-parse.js": "bin/dns-parse.js", | ||
"dns-test.js": "bin/dns-test.js", | ||
"mdns-capture.js": "bin/mdns-capture.js" | ||
}, | ||
"scripts": { | ||
@@ -14,3 +20,6 @@ "test": "node test/parser.js && node test/packer.js" | ||
"author": "", | ||
"license": "(MIT or Apache2)" | ||
"license": "(MIT or Apache2)", | ||
"developmentDependencies": { | ||
"bluebird": "^3.5.0" | ||
} | ||
} |
(function (exports) { | ||
'use strict'; | ||
// http://www.zytrax.com/books/dns/ch8/soa.html | ||
// Value Meaning/Use | ||
@@ -13,4 +15,2 @@ // Primary NS Variable length. The name of the Primary Master for the domain. May be a label, pointer, or any combination | ||
exports.DNS_PACKER_TYPE_SOA = function (ab, dv, total, record) { | ||
@@ -27,12 +27,12 @@ if(!record.name_server){ | ||
if(!record.ref){ | ||
throw new Error("no serial number for SOA record"); | ||
throw new Error("no refresh for SOA record"); | ||
} | ||
if(!record.ret){ | ||
throw new Error("no serial number for SOA record"); | ||
throw new Error("no update retry for SOA record"); | ||
} | ||
if(!record.ex){ | ||
throw new Error("no serial number for SOA record"); | ||
throw new Error("no expiry for SOA record"); | ||
} | ||
if(!record.nx){ | ||
throw new Error("no serial number for SOA record"); | ||
throw new Error("no nxdomain for SOA record"); | ||
} | ||
@@ -45,5 +45,6 @@ | ||
console.log('record.name_server', 1 + record.name_server.length, record.name_server); | ||
// pack name_server which is a sequence of labels | ||
record.name_server.split('.').forEach(function(label){ | ||
soaLen += 1 + label.length; | ||
record.name_server.split('.').forEach(function (label) { | ||
soaLen += (1 + label.length); | ||
@@ -58,5 +59,10 @@ dv.setUint8(total, label.length, false); | ||
}); | ||
// must be terminated by null when not using write null | ||
dv.setUint8(total, 0, false); | ||
total += 1; | ||
soaLen += 1; | ||
console.log('record.email_addr', 1 + record.email_addr.length, record.email_addr); | ||
// pack email address which is a sequence of labels | ||
record.email_addr.split('.').forEach(function (label){ | ||
record.email_addr.split('.').forEach(function (label) { | ||
soaLen += 1 + label.length; | ||
@@ -72,2 +78,6 @@ | ||
}); | ||
// must be terminated by null when not using write null | ||
dv.setUint8(total, 0, false); | ||
total += 1; | ||
soaLen += 1; | ||
@@ -87,2 +97,4 @@ // pack all 32-bit values | ||
// RDLENGTH | ||
console.log('rdAt', rdLenIndex); | ||
console.log('soaLen (lables + 2 + 20)', soaLen); | ||
dv.setUint16(rdLenIndex, soaLen, false); | ||
@@ -89,0 +101,0 @@ |
@@ -16,8 +16,2 @@ (function (exports) { | ||
// RDATA | ||
console.log("what is my record data: " + typeof record.data[0]); | ||
console.log("what are my labels? "); | ||
// var res = record.data[0].split(" "); | ||
// console.log("Res: " + res); | ||
console.log("for each rdata"); | ||
record.data.forEach(function(str){ | ||
@@ -27,3 +21,2 @@ | ||
txtLen += 1; | ||
@@ -33,7 +26,6 @@ // console.log(chcim); | ||
total += 1; | ||
}); | ||
}); | ||
console.log("txt rdata length is: " + txtLen); | ||
dv.setUint16(rdLenIndex, txtLen+1, false); | ||
@@ -40,0 +32,0 @@ dv.setUint8(rdLenIndex+2, txtLen, false); |
@@ -21,11 +21,15 @@ (function (exports) { | ||
// we need this information for this parser | ||
var cpcount = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }).cpcount; | ||
var offset = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }).byteLength; | ||
var labels = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }).labels; | ||
var labelInfo = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }); | ||
var cpcount = labelInfo.cpcount; | ||
var offset = labelInfo.byteLength; | ||
var labels = labelInfo.labels; | ||
// Primary NS | ||
record.name_server = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }).name; | ||
record.name_server = labelInfo.name; | ||
// TODO delete this commented out code after some testing | ||
// (pretty sure it was unnecessary and it seemed to work on code with compression pointers just fine) | ||
/* | ||
// if there exists compression pointers in the rdata | ||
if (cpcount > 0){ | ||
if (cpcount > 0) { | ||
// do something awesome with compression pointers to get the email address | ||
@@ -37,3 +41,3 @@ // I need the length of all the data before the email address starts. | ||
var start = 2; // start or email_addr. take into account compression pointer and address length | ||
for(var i = 0; i < labels.length; i++){ | ||
for (var i = 0; i < labels.length; i += 1) { | ||
@@ -43,3 +47,3 @@ // increase start by the label length. the +1 is to take into account the next label size byte | ||
// check for cpcount. 2 counts behind | ||
if(parseInt(dv.getUint8(start - 2), 10) === 192){ | ||
if (parseInt(dv.getUint8(start - 2), 10) === 192) { | ||
record.email_addr = unpackLabels(new Uint8Array(ab), record.rdstart + start ,{ byteLength: 0, cpcount: 0, labels: [], name: '' }).name; | ||
@@ -53,2 +57,5 @@ } | ||
} | ||
*/ | ||
record.email_addr = unpackLabels(new Uint8Array(ab), record.rdstart + offset, { byteLength: 0, cpcount: 0, labels: [], name: '' }).name; | ||
// Serial Number | ||
@@ -65,7 +72,5 @@ record.sn = dv.getUint32(dv.byteLength - 20, false); | ||
return record; | ||
}; | ||
}('undefined' !== typeof window ? window : exports)); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121420
121
2987
13
44