废话不多说,代码敏感,只上部分。
源代码
(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找我。网站底部有我联系方式