/usr/share/dnsviz/js/dnsviz.js is in dnsviz 0.6.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | /*
#
# This file is a part of DNSViz, a tool suite for DNS/DNSSEC monitoring,
# analysis, and visualization. This file (or some portion thereof) is a
# derivative work authored by VeriSign, Inc., and created in 2014, based on
# code originally developed at Sandia National Laboratories.
# Created by Casey Deccio (casey@deccio.net)
#
# Copyright 2012-2014 Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
# certain rights in this software.
#
# Copyright 2014-2016 VeriSign, Inc.
#
# DNSViz is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DNSViz is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with DNSViz. If not, see <http://www.gnu.org/licenses/>.
#
*/
function AuthGraph(anchorElement, maxPaperWidth, imageScale) {
this.anchorElement = anchorElement;
this.maxPaperWidth = maxPaperWidth == undefined ? 0 : maxPaperWidth;
this.imageScale = imageScale == undefined ? 1.4 : imageScale;
this._label_map = {
'rrsig': 'RRSIG',
'nsec': 'NSEC',
'nsec3': 'NSEC3',
'cname': 'CNAME',
'dname': 'DNAME',
'dnskey': 'DNSKEY',
'ds': 'DS',
'dlv': 'DLV',
'ttl': 'TTL',
'rrset': 'RRset',
'rdata': 'Record data',
}
this._dnssec_algorithms = {
1: 'RSA/MD5',
3: 'DSA/SHA1',
5: 'RSA/SHA-1',
6: 'DSA-NSEC3-SHA1',
7: 'RSASHA1-NSEC3-SHA1',
8: 'RSA/SHA-256',
10: 'RSA/SHA-512',
12: 'GOST R 34.10-2001',
13: 'ECDSA Curve P-256 with SHA-256',
14: 'ECDSA Curve P-384 with SHA-384',
}
this._digest_algorithms = {
1: 'SHA-1',
2: 'SHA-256',
3: 'GOST R 34.11-94',
4: 'SHA-384',
}
}
AuthGraph.prototype.infoToHtmlTable = function (obj) {
return '<table class="obj">' + this.infoToHtmlTableComponents(obj) + '</table>';
}
AuthGraph.prototype.infoToHtmlTableComponents = function (obj) {
s = '';
for (var key in obj) {
val = obj[key];
if (val == null) {
continue;
} else if (key.toLowerCase() in {'digest':null,'key':null,'signature':null,'dnskey':null}) {
// don't print digest or key
continue;
} else if (key.toLowerCase() in {'rdata':null,'meta':null} && !val.hasOwnProperty('length')) {
s += this.infoToHtmlTableComponents(val);
continue;
}
s += '<tr><th valign="top" align="right">' + this.labelFromSlug(key) + ':</th><td align="left">';
if (typeof val != "object") {
s += val;
} else if (val.hasOwnProperty("length")) {
if (key.toLowerCase() in {'nsec':null,'nsec3':null} && !val.hasOwnProperty('object')) {
var newval = [];
var nsec_type = key.toLowerCase() == 'nsec' ? 'NSEC' : 'NSEC3';
for (var i = 0; i < val.length; i++) {
newval.push(val[i]['name'] + ' IN ' + nsec_type + ' ' + val[i]['rdata'][0]);
};
val = newval;
}
if (key.toLowerCase() in {'errors':null,'warnings':null}) {
s += '<ul>';
for (var i = 0; i < val.length; i++) {
var servers_tags = [];
s += '<li>' + val[i]['description'];
if (val[i]['servers'] != undefined) {
servers_tags = servers_tags.concat(val[i]['servers']);
}
if (val[i]['query_options'] != undefined) {
servers_tags = servers_tags.concat(val[i]['query_options']);
}
if (servers_tags.length > 0) {
s += ' (' + servers_tags.join(", ") + ')';
}
s += '</li>';
}
s += '</ul>';
} else if (typeof val[0] in {'string':null,'number':null}) {
if (key.toLowerCase() in {'servers':null,'digest_type':null}) {
s += val.join(", ");
} else {
s += val.join("<br />");
}
} else {
s += '<ul>';
for (var i = 0; i < val.length; i++) {
s += '<li>' + this.infoToHtmlTable(val[i]) + '</li>';
}
s += '</ul>';
}
} else {
s += this.infoToHtmlTable(val);
}
s += '</td></tr>';
}
return s
}
AuthGraph.prototype.addNodeEvent = function (nodeObj, infoObj) {
var statusStr;
var s = '';
if (infoObj.hasOwnProperty('length') && infoObj.length > 1) {
statusStr = this.slugify(infoObj[0]['status']);
s += '<ul>';
for (var i = 0; i < infoObj.length; i++) {
s += '<li>' + this.infoToHtmlTable(infoObj[i]) + '</li>';
}
s += '</ul>'
} else {
if (infoObj.hasOwnProperty('length')) {
infoObj = infoObj[0];
}
statusStr = this.slugify(infoObj['status']);
s += this.infoToHtmlTable(infoObj);
}
s = '<div class="dnsviz-' + statusStr + '">' + s + '</div>';
$(nodeObj[0]).tooltip({ content: s, items: '*', track: true, show: false, hide: false });
//$(nodeObj[0]).css('cursor', 'pointer');
}
if (typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
AuthGraph.prototype.labelFromSlug = function (str) {
var labels = str.split(/_/);
for (var i in labels) {
var l = labels[i].toLowerCase();
if (l in this._label_map) {
labels[i] = this._label_map[l];
}
}
labels[0] = labels[0].charAt(0).toUpperCase() + labels[0].slice(1);
return labels.join(' ');
}
AuthGraph.prototype.slugify = function (str) {
_slugify_strip_re = /[^\w_\s-]/g;
_slugify_hyphenate_re = /[_\s-]+/g;
str = str.replace(_slugify_strip_re, '').trim().toLowerCase();
str = str.replace(_slugify_hyphenate_re, '-');
return str;
}
|