Skip to content
Snippets Groups Projects
Commit 0577058b authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Add untested parsers for interesting record types

SRV, NAPTR, and URI
parent 2adc919e
No related branches found
No related tags found
No related merge requests found
...@@ -154,7 +154,7 @@ function DNS(servers) { ...@@ -154,7 +154,7 @@ function DNS(servers) {
tmp2 += tmp3.len; tmp2 += tmp3.len;
} while (tmp2 < len); } while (tmp2 < len);
return tmp; return tmp;
case 28: case 28: // AAAA
return format("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", return format("%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
ascii(resp[offset + 0]), ascii(resp[offset + 1]), ascii(resp[offset + 0]), ascii(resp[offset + 1]),
ascii(resp[offset + 2]), ascii(resp[offset + 3]), ascii(resp[offset + 2]), ascii(resp[offset + 3]),
...@@ -165,6 +165,43 @@ function DNS(servers) { ...@@ -165,6 +165,43 @@ function DNS(servers) {
ascii(resp[offset + 12]), ascii(resp[offset + 13]), ascii(resp[offset + 12]), ascii(resp[offset + 13]),
ascii(resp[offset + 14]), ascii(resp[offset + 15]) ascii(resp[offset + 14]), ascii(resp[offset + 15])
).replace(/(0000:)+/, ':').replace(/(^|:)0{1,3}/g, '$1'); ).replace(/(0000:)+/, ':').replace(/(^|:)0{1,3}/g, '$1');
case 33: // SRV
tmp = {};
tmp.priority = string_to_int16(resp.substr(offset, 2);
offset += 2;
tmp.weight = string_to_int16(resp.substr(offset, 2);
offset += 2;
tmp.port = string_to_int16(resp.substr(offset, 2);
offset += 2;
tmp.target = get_name(resp, offset).name;
return tmp;
case 35: // NAPTR
tmp = {};
tmp.order = string_to_int16(resp.substr(offset, 2);
offset += 2;
tmp.preference = string_to_int16(resp.substr(offset, 2);
offset += 2;
tmp2 = get_string(resp, offset);
tmp.flags = tmp2.string;
offset += tmp2.len;
tmp2 = get_string(resp, offset);
tmp.services = tmp2.string;
offset += tmp2.len;
tmp2 = get_string(resp, offset);
tmp.regexp = tmp2.string;
offset += tmp2.len;
tmp.replacement = get_name(resp, offset).name;
return tmp;
case 256: // URI
tmp = {};
tmp.priority = string_to_int16(resp.substr(offset, 2);
offset += 2;
tmp.weight = string_to_int16(resp.substr(offset, 2);
offset += 2;
tmp.target = get_string(resp, offset).string;
tmp.target = tmp.target.replace(/\\"/g, '"');
tmp.target = tmp.target.replace(/^"(.*)"$/, '$1');
return tmp;
case 3: // MD case 3: // MD
case 4: // MF case 4: // MF
case 7: // MB case 7: // MB
...@@ -312,7 +349,10 @@ DNS.types = { ...@@ -312,7 +349,10 @@ DNS.types = {
'MINFO':14, 'MINFO':14,
'MX':15, 'MX':15,
'TXT':16, 'TXT':16,
'AAAA':28 'AAAA':28,
'SRV':33,
'NAPTR':35,
'URI':256
}; };
DNS.classes = { DNS.classes = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment