1document.addEventListener('DOMContentLoaded', function () 2{ 3 // TODO: choose your own key (0 <= key <= 255): 4 const obfuscator = new Obfuscator(obfuscatorKey); 5 const textObfuscator = new TextCoder(obfuscator); 6 const linkObfuscator = new LinkCoder(obfuscator); 7 8 Nodes.decode('.obfuscatedl', linkObfuscator); 9 Nodes.decode('.obfuscated', textObfuscator); 10}); 11 12 13// Xor 14 15function Obfuscator (key) 16{ 17 this.key = key; 18} 19 20Obfuscator.prototype.encode = function (input) 21{ 22 let output = ''; 23 24 for (let i = 0; i < input.length; ++i) { 25 const hexInput = input.charCodeAt(i); 26 const hexOutput = hexInput ^ this.key; 27 28 output += this.fromHex(hexOutput); 29 } 30 31 return output; 32} 33 34Obfuscator.prototype.decode = function (input) 35{ 36 let output = ''; 37 38 for (let i = 0; i < input.length; i += 2) { 39 const hexInput = this.toHex(input, i); 40 const hexOutput = hexInput ^ this.key; 41 42 output += String.fromCharCode(hexOutput); 43 } 44 45 return output; 46} 47 48Obfuscator.prototype.fromHex = function (hex) 49{ 50 let text = hex.toString(16); 51 52 if (hex < 16) { 53 text = '0' + text; 54 } 55 56 return text; 57} 58 59Obfuscator.prototype.toHex = function (text, i) 60{ 61 const sequence = text.substr(i, 2); 62 63 return parseInt(sequence, 16); 64} 65 66 67// TextCoder 68 69function TextCoder (coder) 70{ 71 this.coder = coder; 72} 73 74TextCoder.prototype.encode = function (span) 75{ 76 this.apply('encode', span); 77} 78 79TextCoder.prototype.decode = function (span) 80{ 81 this.apply('decode', span); 82} 83 84TextCoder.prototype.apply = function (action, span) 85{ 86 const text = span.firstChild; 87 88 text.nodeValue = this.coder[action](text.nodeValue); 89} 90// LinkCoder 91 92function LinkCoder (coder) 93{ 94 this.coder = coder; 95} 96 97LinkCoder.prototype.encode = function (a) 98{ 99 this.apply('encode', a); 100} 101 102LinkCoder.prototype.decode = function (a) 103{ 104 this.apply('decode', a); 105} 106 107LinkCoder.prototype.apply = function (action, a) 108{ 109 const input = a.getAttribute('href'); 110 const output = this.coder[action](input); 111 112 a.setAttribute('href', output); 113} 114 115 116// Nodes 117 118Nodes = {}; 119 120Nodes.decode = function (selector, coder) 121{ 122 const nodes = document.querySelectorAll(selector); 123 const method = coder.decode.bind(coder); 124 125 nodes.forEach(method); 126}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.