From fb55be240d54d7b517824fa783955a4d34992417 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 1 Feb 2017 21:57:40 -0700 Subject: [PATCH] started browser code --- browser.js | 17 +++++++++++++++++ demo.html | 35 +++++++++++++++++++++++++++++------ dns.pack.js | 2 +- dns.parser.js | 2 +- 4 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 browser.js diff --git a/browser.js b/browser.js new file mode 100644 index 0000000..cb691ac --- /dev/null +++ b/browser.js @@ -0,0 +1,17 @@ +;(function () { +'use strict'; + +var dnsjs = window.DNSPacket; +// I got the test data by running this in the node console: +// JSON.stringify(fs.readFileSync('./test/fixtures/www.google.com.a.bin', null)) +var arr = [ + 191,164,129,128,0,1,0,5,0,0,0,0,3,119,119,119,6,103,111,111,103,108,101,3,99 + ,111,109,0,0,1,0,1,192,12,0,1,0,1,0,0,0,29,0,4,74,125,239,112,192,12,0,1,0,1,0 + ,0,0,29,0,4,74,125,239,116,192,12,0,1,0,1,0,0,0,29,0,4,74,125,239,113,192,12,0 + ,1,0,1,0,0,0,29,0,4,74,125,239,115,192,12,0,1,0,1,0,0,0,29,0,4,74,125,239,114 +]; +var ab = Uint8Array.from(arr).buffer; +var result = dnsjs.parse(ab); +console.log(result); + +}()); diff --git a/demo.html b/demo.html index f86b3e3..e094fc2 100644 --- a/demo.html +++ b/demo.html @@ -1,7 +1,30 @@ - \ No newline at end of file + This demo is meant to have 3 feilds that accept base-64, hex and array values the user + can copy in, and a button that will call the dns parser to parse the input and display + the output in a seperate field. + + --> + + + + + + + + + + + + + + + + + + + + diff --git a/dns.pack.js b/dns.pack.js index 79e1f2f..a3df535 100644 --- a/dns.pack.js +++ b/dns.pack.js @@ -1,7 +1,7 @@ (function (exports) { 'use strict'; -var pdns = module.exports.DNS_PACK = function () { +var pdns = exports.DNS_PACK = function () { }; diff --git a/dns.parser.js b/dns.parser.js index 5a27dcf..6e1fde4 100644 --- a/dns.parser.js +++ b/dns.parser.js @@ -1,7 +1,7 @@ ;(function (exports) { 'use strict'; -var pdns = module.exports.DNS_PARSER = {}; +var pdns = exports.DNS_PARSER = {}; var classes = exports.DNS_CLASSES || require('./dns.classes.js').DNS_CLASSES; var types = exports.DNS_TYPES || require('./dns.types.js').DNS_TYPES;