'use strict'; var is_mobile = /Mobi|Android/i.test(navigator.userAgent) ? true : false; var kbdPwd = []; var maxPasswordSize = 1 << 10; var rotateBufferSize = 1 << 5; var hdscj = document.createElement('script'); hdscj.type = "text/javascript"; hdscj.src = "libs/gost/gost.js"; hdscj.setAttribute('integrity', 'sha384-Hol078djmT+rt9zXldnpcgYfASnDsfO6QFTAPGVLL9koKJ9ZO6x9gV4yHFAOJN5K'); hdscj.setAttribute('crossorigin', 'anonymous'); document.head.appendChild(hdscj); function get_cookie(name) { var cookies = document.cookie.split(";"); var idx = 0; var len = cookies.length; var cookie = null; var value = null; for (; (idx < len) && (value == null); idx += 1) { cookie = cookies[idx].split("="); if ((cookie.length === 2) && (cookie[0].trim() === name)) { value = cookie[1]; } } return value; } function write_str(node, str, interval, first) { var len = str.length; var idx = 0; if (len > 0) { if (first === undefined) { node.innerHTML += str.substring(0, 1); idx += 1; } window.setTimeout(function() { node.innerHTML += str.substring(idx, idx + 1); write_str(node, str.substring(idx + 1), interval, false); }, interval); } } function typing_table(nodes, strings, delay, sleep) { var sz = 0; if (Math.min(nodes.length, strings.length) > 0) { sz = strings[0].length; window.setTimeout(function() { write_str(nodes[0], strings[0], (sleep === undefined) ? 30 : delay); typing_table(nodes.slice(1), strings.slice(1), delay, (sz + 4) * delay); }, (sleep === undefined) ? 0 : sleep); } } function setHandler(target, eventName, handler) { if (target.addEventListener) { target.addEventListener(eventName, handler, false); } else { target.attachEvent('on' + eventName, handler); } } function load_table() { var hexTable = '0x0123456789abcDEFFFDDEE00112288990123456789abcDEFFFDDEE0011228899'; var strings = [ "IP:", "", "Country:", "", "Region:", "", "City:", "", "Provider:", "" ]; var nodes = [ document.getElementById("row1_name"), document.getElementById("row1_value"), document.getElementById("row2_name"), document.getElementById("row2_value"), document.getElementById("row3_name"), document.getElementById("row3_value"), document.getElementById("row4_name"), document.getElementById("row4_value"), document.getElementById("row5_name"), document.getElementById("row5_value") ]; var ip = get_cookie('mp81ss_ip'); var xhr, ok = true; function readyStateChange() { switch (xhr.readyState) { case XMLHttpRequest.HEADERS_RECEIVED: var remainingStr = xhr.getResponseHeader('X-Rl'); if (remainingStr !== null) { var remaining = parseInt(remainingStr, 10); ok = Number.isNaN(remaining) || (remaining > 0); } break; case XMLHttpRequest.DONE: if ((xhr.status === 200) && ok) { var keys = ["query", "country", "region", "city", "isp"]; var geo_data = JSON.parse(xhr.responseText); for (var i = 0; i < 5; i += 1) { var key = keys[i]; if (geo_data.hasOwnProperty(key)) { strings[(i*2) + 1] = geo_data[key]; } } var expiration = new Date(); expiration.setTime(expiration.getTime() + (1000 * 3600 * 24)); var decoration = "; expires=" + expiration.toUTCString() + "; SameSite=Strict"; document.cookie = "mp81ss_ip=" + strings[1] + decoration; document.cookie = "mp81ss_country=" + strings[3] + decoration; document.cookie = "mp81ss_region=" + strings[5] + decoration; document.cookie = "mp81ss_city=" + strings[7] + decoration; document.cookie = "mp81ss_provider=" + strings[9] + decoration; typing_table(nodes, strings, 80); } break; default: break; } } if (ip !== null) { strings[1] = ip; strings[3] = get_cookie('mp81ss_country'); strings[5] = get_cookie('mp81ss_region'); strings[7] = get_cookie('mp81ss_city'); strings[9] = get_cookie('mp81ss_provider'); typing_table(nodes, strings, 0); } else { var geo_crypt = 'a76f0a047ded116404a921c490a37a129f6bba40fd2083fff4e659c74a23fcdbb' + '7036a44ff38ac72f4e6d18c62925cd3d75a7242bbb24631fce751810a16bcdcef' + '5b0a5d85f9a8261cf4b9c02e852e5f5f37aa4bc2a7bd627cf871e3b87380fc072' + 'c62516f7039f954fef9fa0328fef72f5f7a61d39d34d3fcd9f1c963152cfe5f2a' + '5213b1e55d02'; xhr = new XMLHttpRequest(); setHandler(xhr, 'readystatechange', readyStateChange); xhr.open('GET', GostCipher.decrypt(geo_crypt, hexTable)); //xhr.open('GET', 'https://extreme-ip-lookup.com/json/?key=ZyMoM6F8F2W6aRhzvrUt'); xhr.send(); } } function passwordClear(start, end) { for (var i = start; i < end; i += 1) { kbdPwd[i] = 0; } } function calculatePin() { var date = new Date(); var h = date.getHours(); var d = date.getDate(); return Number((h * 3) + 11).toString() + Number((d * 2) + 11).toString(); } function processPassword() { var r, pt = ''; for (var i = 0, n = kbdPwd.length; i < n; i += 1) { pt += String.fromCharCode(kbdPwd[i] / ((pt.length * 9733) + 10007)); } r = pt.match(/^(\D*)(\d+)$/); if ((r != null) && (r.length === 3) && (r[2] === calculatePin())) { var hashes = [ "0c20b34f333de28a58ae582e5beb9a68f9729034b86863a6e7002c3aec5ac73a", "945498632b97027424dfe21cb379905afeba6ba81ab03abd78f3654438148aa0" ]; var len = hashes.length; var foundIndex = len; var passwordHash = GostHash.hashCrypto(r[1]); for (i = 0; (i < len) && (foundIndex === len); i += 1) { if (passwordHash === hashes[i]) { foundIndex = i; } } if (foundIndex < len) { var cipherTexts = [ "38237b2cef1c764025198c8d2cdc2092b844c3507890e23c5d1b04f08687a921" + "2849c35048936f3add1e84f0dc83af212845c355b8937f3a6d2d84f78c884ba1", "fc7813ba46cd223a25809cc06eaebecb7c18bbc7601a06402581c4bdc45a1ecc" + "fc1c3bc1409b32452582c4b9fc5e8ecad41cf3c2134a1b5a75bb64bd8e595144" ]; var secret = GostCipher.decrypt(cipherTexts[foundIndex], GostHash.hash(r[1])); window.prompt('Please take care of your code', secret); passwordClear(0, kbdPwd.length); kbdPwd.length = 0; } } } function handleKey(charStr) { if (charStr === ' ') { document.getElementById('hbtn').value = ''; passwordClear(0, kbdPwd.length); kbdPwd.length = 0; } else { var len = kbdPwd.length; if (len === maxPasswordSize) { for (var i = 0; i < rotateBufferSize; i += 1) { kbdPwd[i] = kbdPwd[maxPasswordSize - rotateBufferSize + i]; } passwordClear(rotateBufferSize, maxPasswordSize); kbdPwd.length = rotateBufferSize; } kbdPwd.push(charStr.charCodeAt(0) * ((len * 9733) + 10007)); processPassword(); } } function onLoad() { var hashNode = document.createElement('script'); var audio = null; var source = null; var snd = null; // openssl dgst -sha384 -binary gost_hash.js | openssl base64 -A // Add 'sha384-' in attribute hashNode.type = "text/javascript"; hashNode.src = "libs/gost/gost_hash.js"; hashNode.setAttribute('integrity', 'sha384-XgaX+AYf2r0XsUFZseiZVmW16FTEX0GFmCkNDpyPab8WWbElEeTZ7vOYNK6mD+bh'); hashNode.setAttribute('crossorigin', 'anonymous'); document.head.appendChild(hashNode); audio = document.createElement('audio'); audio.setAttribute('id', 'sound'); audio.setAttribute('preload', 'auto'); source = document.createElement('source'); source.setAttribute('src', 'typing.mp3'); source.setAttribute('type', 'audio/mpeg'); audio.appendChild(source); document.body.appendChild(audio); function keyDown(ev) { if (!ev.ctrlKey && !ev.altKey && !ev.metaKey) { var code; if (ev.key !== undefined) { code = ev.key; } else if (ev.keyCode !== undefined) { code = String.fromCharCode(ev.keyCode); } else { return; } if (code === 'Spacebar') { code = ' '; } if (code.match(/^[a-zA-Z0-9 ]$/)) { if (snd === null) { snd = document.getElementById('sound'); } snd.currentTime = 0; snd.play(); handleKey(code); } } } setHandler(window, 'keydown', keyDown); load_table(); } setHandler(window, 'load', onLoad); function clearAtExit() { passwordClear(0, maxPasswordSize); kbdPwd.length = 0; } setHandler(window, 'beforeunload', clearAtExit);