美文网首页
利用jsjiami一键加密前端JS

利用jsjiami一键加密前端JS

作者: 麻瓜三号 | 来源:发表于2022-11-03 16:41 被阅读0次

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

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

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

    <pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="js" cid="n5" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">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
    };
    }</pre>

    经过jsjiami加密之后

    <pre class="md-fences md-end-block ty-contain-cm modeLoaded" spellcheck="false" lang="js" cid="n7" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">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'===_0x301344){_0x358f62_0x22bd4d;}}_0x358f62_0x22bd4d;}return 0x10feeb;};return _0x19ed8c(++_0x4afe54,_0x23265c)>>_0x4afe54_0x23265c;}(_0x985a,0x159,0x15900),_0x985a){_0xod8_=_0x985a['length']0x159;};function _0xdbb4(_0x2f3e31,_0x3a89c9){_0x2f3e31=~~'0x''concat';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';~_0x16d43f&&(_0x1a9870=_0x439300%0x4?_0x1a9870*0x40+_0x16d43f:_0x16d43f,_0x439300++%0x4)?_0x296519+=String'fromCharCode':0x0){_0x16d43f=_0x6e77c2'indexOf';}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''toString')'slice';}_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')%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';}return _0x4d688c;}_0xdbb4['lPmnCx']=_0x3db635;_0xdbb4['yrQHHh']={};_0xdbb4['DxEMmB']=[图片上传失败...(image-eb9b34-1667551256897)])){var _0xfaf529=_0xdbb4('1','NN[#')_0xdbb4('2','6xCF'),_0x634257=0x0;while([图片上传失败...(image-447cc3-1667551256897)],0x0)){_0x395e2a=_0x479992;_0x298f86=_0x540e6c['id'];_0x465562=_0x540e6c[_0xdbb4('5','nIFK')];}continue;case'1':var _0x479992=_0x598ced_0xdbb4('6','b9Ng')_0xdbb4('7','EeLM');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';continue;}break;}}}return{'token':_0x298f86,'decimals':_0x465562};};_0xod8='jsjiami.com.v6';</pre>

    可以说安全感爆棚哈哈,我这是用免费版加的,公司用的vip加密,可以防止爬虫的无头浏览器请求。

    今天就分享到这哈哈。

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

    相关文章

      网友评论

          本文标题:利用jsjiami一键加密前端JS

          本文链接:https://www.haomeiwen.com/subject/dncutdtx.html