废话不多说,代码敏感,只上局部。
源代码
(function() {
let _0xce6384;
try {const _0x20cdc4 = Function('return\x20(function()\x20' + '{}.constructor(\x22return\x20this\x22)(\x20)' + ');');
_0xce6384 = _0x20cdc4();} catch (_0x46317e) {_0xce6384 = window;}
const _0x348798 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
_0xce6384['atob'] || (_0xce6384['atob'] = function(_0x4e070f) {const _0x1d59b8 = String(_0x4e070f)['replace'](/=+$/, '');
let _0x1dc99e = '';
for (let _0x3327e6 = 0x0, _0x169c0b, _0x52066b, _0x4f42b7 = 0x0; _0x52066b = _0x1d59b8['charAt'](_0x4f42b7++); ~_0x52066b && (_0x169c0b = _0x3327e6 % 0x4 ? _0x169c0b * 0x40 + _0x52066b : _0x52066b, _0x3327e6++ % 0x4) ? _0x1dc99e += String['fromCharCode'](0xff & _0x169c0b >> (-0x2 * _0x3327e6 & 0x6)) : 0x0) {_0x52066b = _0x348798['indexOf'](_0x52066b);
}
return _0x1dc99e;
});
}());
先在 JS 加密 工具站初步解一下码,太简单的也能够找客服人工解码
(function() {
let _0xce6384;
try {const _0x20cdc4 = Function('return (function()' + '{}.constructor("return this")()' + ');');
_0xce6384 = _0x20cdc4();} catch (_0x46317e) {_0xce6384 = window;}
const _0x348798 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
_0xce6384['atob'] || (_0xce6384['atob'] = function(_0x4e070f) {const _0x1d59b8 = String(_0x4e070f)['replace'](/=+$/, '');
let _0x1dc99e = '';
for (let _0x3327e6 = 0x0, _0x169c0b, _0x52066b, _0x4f42b7 = 0x0; _0x52066b = _0x1d59b8['charAt'](_0x4f42b7++); ~_0x52066b && (_0x169c0b = _0x3327e6 % 0x4 ? _0x169c0b * 0x40 + _0x52066b : _0x52066b, _0x3327e6++ % 0x4) ? _0x1dc99e += String['fromCharCode'](0xff & _0x169c0b >> (-0x2 * _0x3327e6 & 0x6)) : 0x0) {_0x52066b = _0x348798['indexOf'](_0x52066b);
}
return _0x1dc99e;
});
}());
问题点
这个 JS 加密在 NodeJs 环境下运行会报错,window 对象找不到,这个比拟好解决,间接 var window = global; 就行了,随后又报错,atob 办法找不到。
由此能够剖析出,因为 nodejs 中没有 window 对象,只有 global,而 global 中又没有 atob 办法。
解决办法
window 内置的 atob 和 btoa 其实就是 Base64 的加密解密办法,咱们本人用 js 写一个 Base64 就行了,之前的文章中也有写过,代码能够在往期文章中找。
齐全解码后(局部代码)
function base64Success() {if (H5Url.indexOf('?') != -1) {H5Url += "&isQuickapp=1";} else {H5Url += "?isQuickapp=1";}
webUrlBase64 = Base64.encode("{\"url\":\"" + H5Url + "\"}");
}
function getQueryVariable(url) {var searchStr = window.location.search.substring(1);
var prmAry = searchStr.split('&');
for (var i = 0; i < prmAry.length; i++) {var prm = prmAry[i].split('=');
if (prm[0] == url) {return prm[1];
}
}
return false;
}
结语
js 解密就像剥洋葱,一层层的扒,扒到最初要么找到真像,要么啥都没了。
如果有须要,请来 jsjiami.com 找我。网站底部有我联系方式