This commit is contained in:
AJ ONeal 2017-01-21 14:44:37 -07:00
parent 844888caba
commit 4ecb1b679c
7 changed files with 6 additions and 5 deletions

View File

@ -1,13 +1,13 @@
'use strict'; 'use strict';
// EXAMPLE: // EXAMPLE:
// node pure-parser.js samples/a-0.mdns.bin // node bin/dns-parse.js samples/a-0.mdns.bin
// pass a terminal arg // pass a terminal arg
var filename = process.argv[2]; var filename = process.argv[2];
if (!filename) { if (!filename) {
console.error("Usage: node pure-parser-cli.js <path/to/sample.bin>"); console.error("Usage: node bin/dns-parse.js <path/to/sample.bin>");
console.error("Example: node pure-parser-cli.js ./samples/services-0.mdns.bin"); console.error("Example: node bin/dns-parse.js ./samples/services-0.mdns.bin");
process.exit(1); process.exit(1);
} }

View File

@ -24,10 +24,11 @@ handlers.onError = function (err) {
server.close(); server.close();
}; };
handlers.onMessage = function (buffer) { handlers.onMessage = function (buffer) {
var path = require('path');
var name = type + '-' + count + '.mdns.bin'; var name = type + '-' + count + '.mdns.bin';
count += 1; count += 1;
fs.writeFileAsync(name, buffer).then(function () { fs.writeFileAsync(path.join('samples', name), buffer).then(function () {
console.log('wrote ' + buffer.length + ' bytes to ' + name); console.log('wrote ' + buffer.length + ' bytes to ' + name);
}); });
}; };
@ -47,4 +48,4 @@ server.on('listening', handlers.onListening);
// 53 dns // 53 dns
// 5353 mdns // 5353 mdns
server.bind(5353); server.bind(5353);

0
dig
View File