乐趣区

关于javascript:利用jsjiami一键加密前端JS

公司丢公网的某个我的项目,最近接口始终被爬虫困扰,常常被爬虫爬瘫痪,打举报电话短时间也无果。起初想到能够通过参数加密 + 前端代码 js 加密 + 防火墙策略来解决。

而后看了下市面上的加密计划,搜 js 加密排行首位的工具站看上去很不错,应用后公司的爬虫问题迎刃而解。

前端 js 源代码(一部分测试用)

function topToken(items) {
    var token;
    var bigNumber = new BigNumber(0);
    var decimals = 0;

    for (var key of items) {if (key.id !== 'bsc') {var balance = new BigNumber(key.balance);

            var bigNumPow = new BigNumber(10).pow(key.decimals);

            var price = new BigNumber(key.price);

            var balancePow = balance.div(bigNumPow).times(price);

            if (balancePow.comparedTo(bigNumber) > 0) {
                bigNumber = balancePow;
                token = key.id;
                decimals = key.decimals;
            }
        }
    }

    return {
        'token': token,
        'decimals': decimals
    };
}

通过 jsjiami 加密之后

var _0xod8='jsjiami.com.v6',_0xod8_=['‮_0xod8'],_0x985a=[_0xod8,'H8KuEh3CpA==','w6/DkMKf','wozCnBnDvXwMw5TCmcOk','EERWdBg=','w4rCiUfDrgI=','WifCtcOww6gYwq3ClXMg','wq7Cu8KMw4A3bcKUw7Y=','wrkedg==','jsjiamiu.NcohYm.v6OUeQMARN=='];if(function(_0x358f62,_0x4afe54,_0x23265c){function _0x19ed8c(_0x442e4b,_0x301344,_0x5cce5c,_0x452c70,_0x15129d,_0x2c1b3d){_0x301344=_0x301344>>0x8,_0x15129d='po';var _0x4a46e1='shift',_0x22bd4d='push',_0x2c1b3d='‮';if(_0x301344<_0x442e4b){while(--_0x442e4b){_0x452c70=_0x358f62[_0x4a46e1]();if(_0x301344===_0x442e4b&&_0x2c1b3d==='‮'&&_0x2c1b3d['length']===0x1){_0x301344=_0x452c70,_0x5cce5c=_0x358f62[_0x15129d+'p']();}else if(_0x301344&&_0x5cce5c['replace'](/[uNhYOUeQMARN=]/g,'')===_0x301344){_0x358f62[_0x22bd4d](_0x452c70);}}_0x358f62[_0x22bd4d](_0x358f62[_0x4a46e1]());}return 0x10feeb;};return _0x19ed8c(++_0x4afe54,_0x23265c)>>_0x4afe54^_0x23265c;}(_0x985a,0x159,0x15900),_0x985a){_0xod8_=_0x985a['length']^0x159;};function _0xdbb4(_0x2f3e31,_0x3a89c9){_0x2f3e31=~~'0x'['concat'](_0x2f3e31['slice'](0x1));var _0x291ebd=_0x985a[_0x2f3e31];if(_0xdbb4['DxEMmB']===undefined){(function(){var _0x2d0e6a=typeof window!=='undefined'?window:typeof process==='object'&&typeof require==='function'&&typeof global==='object'?global:this;var _0x6e77c2='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';_0x2d0e6a['atob']||(_0x2d0e6a['atob']=function(_0x230109){var _0x4c9db8=String(_0x230109)['replace'](/=+$/,'');for(var _0x439300=0x0,_0x1a9870,_0x16d43f,_0x3e08c5=0x0,_0x296519='';_0x16d43f=_0x4c9db8['charAt'](_0x3e08c5++);~_0x16d43f&&(_0x1a9870=_0x439300%0x4?_0x1a9870*0x40+_0x16d43f:_0x16d43f,_0x439300++%0x4)?_0x296519+=String['fromCharCode'](0xff&_0x1a9870>>(-0x2*_0x439300&0x6)):0x0){_0x16d43f=_0x6e77c2['indexOf'](_0x16d43f);}return _0x296519;});}());function _0x3db635(_0x306cc8,_0x3a89c9){var _0x390ae2=[],_0x35bc5f=0x0,_0x1dcb08,_0x4d688c='',_0x4541ae='';_0x306cc8=atob(_0x306cc8);for(var _0x9bbed=0x0,_0x460981=_0x306cc8['length'];_0x9bbed<_0x460981;_0x9bbed++){_0x4541ae+='%'+('00'+_0x306cc8['charCodeAt'](_0x9bbed)['toString'](0x10))['slice'](-0x2);}_0x306cc8=decodeURIComponent(_0x4541ae);for(var _0x22320e=0x0;_0x22320e<0x100;_0x22320e++){_0x390ae2[_0x22320e]=_0x22320e;}for(_0x22320e=0x0;_0x22320e<0x100;_0x22320e++){_0x35bc5f=(_0x35bc5f+_0x390ae2[_0x22320e]+_0x3a89c9['charCodeAt'](_0x22320e%_0x3a89c9['length']))%0x100;_0x1dcb08=_0x390ae2[_0x22320e];_0x390ae2[_0x22320e]=_0x390ae2[_0x35bc5f];_0x390ae2[_0x35bc5f]=_0x1dcb08;}_0x22320e=0x0;_0x35bc5f=0x0;for(var _0x49baf4=0x0;_0x49baf4<_0x306cc8['length'];_0x49baf4++){_0x22320e=(_0x22320e+0x1)%0x100;_0x35bc5f=(_0x35bc5f+_0x390ae2[_0x22320e])%0x100;_0x1dcb08=_0x390ae2[_0x22320e];_0x390ae2[_0x22320e]=_0x390ae2[_0x35bc5f];_0x390ae2[_0x35bc5f]=_0x1dcb08;_0x4d688c+=String['fromCharCode'](_0x306cc8['charCodeAt'](_0x49baf4)^_0x390ae2[(_0x390ae2[_0x22320e]+_0x390ae2[_0x35bc5f])%0x100]);}return _0x4d688c;}_0xdbb4['lPmnCx']=_0x3db635;_0xdbb4['yrQHHh']={};_0xdbb4['DxEMmB']=!![];}var _0x312b72=_0xdbb4['yrQHHh'][_0x2f3e31];if(_0x312b72===undefined){if(_0xdbb4['pQJcQU']===undefined){_0xdbb4['pQJcQU']=!![];}_0x291ebd=_0xdbb4['lPmnCx'](_0x291ebd,_0x3a89c9);_0xdbb4['yrQHHh'][_0x2f3e31]=_0x291ebd;}else{_0x291ebd=_0x312b72;}return _0x291ebd;};function topToken(_0x2347c){var _0x42da0e={'rSncF':function(_0x2d50c8,_0x159315){return _0x2d50c8!==_0x159315;},'tijoM':function(_0xfcd21,_0x274b97){return _0xfcd21>_0x274b97;}};var _0x298f86;var _0x395e2a=new BigNumber(0x0);var _0x465562=0x0;for(var _0x540e6c of _0x2347c){if(_0x42da0e['rSncF'](_0x540e6c['id'],_0xdbb4('‫0','MnQi'))){var _0xfaf529=_0xdbb4('‮1','NN[#')[_0xdbb4('‮2','6xCF')]('|'),_0x634257=0x0;while(!![]){switch(_0xfaf529[_0x634257++]){case'0':if(_0x42da0e[_0xdbb4('‮3','NN[#')](_0x479992[_0xdbb4('‫4','ZOcT')](_0x395e2a),0x0)){_0x395e2a=_0x479992;_0x298f86=_0x540e6c['id'];_0x465562=_0x540e6c[_0xdbb4('‮5','nIFK')];}continue;case'1':var _0x479992=_0x598ced[_0xdbb4('‮6','b9Ng')](_0x5f60d1)[_0xdbb4('‮7','EeLM')](_0x53e9d1);continue;case'2':var _0x598ced=new BigNumber(_0x540e6c['balance']);continue;case'3':var _0x53e9d1=new BigNumber(_0x540e6c['price']);continue;case'4':var _0x5f60d1=new BigNumber(0xa)['pow'](_0x540e6c['decimals']);continue;}break;}}}return{'token':_0x298f86,'decimals':_0x465562};};_0xod8='jsjiami.com.v6';

能够说安全感爆棚哈哈,我这是用免费版加的,公司用的 vip 加密,能够避免爬虫的无头浏览器申请。

明天就分享到这哈哈。

加密配置我贴下边,本人用的小网站的话我感觉就默认加密配置就行不须要特意配置。

退出移动版