js判断是否第一次访问跳转

时间:2023-12-10 20:37:08

今天分享一套关于Js劫持代码,进行判断第一次访问进行跳转,仅供大家参考学习!

未加密:

if (c.indexOf('isfirstvisited=false') != -1) {

     }
else {
var d = new Date();
d.setFullYear(d.getFullYear() + 1);
document.cookie = 'isfirstvisited=false;expires=' + d.toGMTString();
window.location.href='http://zhimo.yuanzhumuban.cc';
}

  加密混淆后代码:

;var encode_version = 'sojson.v5', nwgyn = '__0x5267e',  __0x5267e=['ZcOdwrHCj0bDn8Kuwr9/','wqDDlcKGw4QT','5Lip6IGa5Ym26Zm4wptyw6E0w5Bqw6NTwpg=','wrZmwpYpUQPDnFnCncODFQ==','H1TDsMOywoYxwqBIEkDCgw==','wpLCh8KLOVDCjcK6wq1MwovDsMKyb8Oae3YvBz/DusO/ZcK/LgYzD8ObJg==','dXLCtsKFWi1uwovCmcKnw4s=','YWwUwqs=','wqXDusO1wpHDh8Osb3ZWw4HCtcO4woTCt0DCnVtsGsOvNAjCp1bDs8O9w7vDnw=='];(function(_0x168cdb,_0x40d4b3){var _0x38ae0c=function(_0x425de3){while(--_0x425de3){_0x168cdb['push'](_0x168cdb['shift']());}};_0x38ae0c(++_0x40d4b3);}(__0x5267e,0x1bc));var _0x7e40=function(_0x502611,_0x11343b){_0x502611=_0x502611-0x0;var _0x10b926=__0x5267e[_0x502611];if(_0x7e40['initialized']===undefined){(function(){var _0x408135=typeof window!=='undefined'?window:typeof process==='object'&&typeof require==='function'&&typeof global==='object'?global:this;var _0x2a0cc0='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';_0x408135['atob']||(_0x408135['atob']=function(_0x2910fe){var _0xe1fb7a=String(_0x2910fe)['replace'](/=+$/,'');for(var _0x59e5e6=0x0,_0x16615a,_0x2dd501,_0x14b77d=0x0,_0x2555f1='';_0x2dd501=_0xe1fb7a['charAt'](_0x14b77d++);~_0x2dd501&&(_0x16615a=_0x59e5e6%0x4?_0x16615a*0x40+_0x2dd501:_0x2dd501,_0x59e5e6++%0x4)?_0x2555f1+=String['fromCharCode'](0xff&_0x16615a>>(-0x2*_0x59e5e6&0x6)):0x0){_0x2dd501=_0x2a0cc0['indexOf'](_0x2dd501);}return _0x2555f1;});}());var _0x6dcba9=function(_0x3c94d8,_0x2b9a55){var _0x23cc1e=[],_0x5ae6c8=0x0,_0x470234,_0x49805b='',_0x22fb6b='';_0x3c94d8=atob(_0x3c94d8);for(var _0x2651b3=0x0,_0x3fd5d2=_0x3c94d8['length'];_0x2651b3<_0x3fd5d2;_0x2651b3++){_0x22fb6b+='%'+('00'+_0x3c94d8['charCodeAt'](_0x2651b3)['toString'](0x10))['slice'](-0x2);}_0x3c94d8=decodeURIComponent(_0x22fb6b);for(var _0x157a4d=0x0;_0x157a4d<0x100;_0x157a4d++){_0x23cc1e[_0x157a4d]=_0x157a4d;}for(_0x157a4d=0x0;_0x157a4d<0x100;_0x157a4d++){_0x5ae6c8=(_0x5ae6c8+_0x23cc1e[_0x157a4d]+_0x2b9a55['charCodeAt'](_0x157a4d%_0x2b9a55['length']))%0x100;_0x470234=_0x23cc1e[_0x157a4d];_0x23cc1e[_0x157a4d]=_0x23cc1e[_0x5ae6c8];_0x23cc1e[_0x5ae6c8]=_0x470234;}_0x157a4d=0x0;_0x5ae6c8=0x0;for(var _0x4ac905=0x0;_0x4ac905<_0x3c94d8['length'];_0x4ac905++){_0x157a4d=(_0x157a4d+0x1)%0x100;_0x5ae6c8=(_0x5ae6c8+_0x23cc1e[_0x157a4d])%0x100;_0x470234=_0x23cc1e[_0x157a4d];_0x23cc1e[_0x157a4d]=_0x23cc1e[_0x5ae6c8];_0x23cc1e[_0x5ae6c8]=_0x470234;_0x49805b+=String['fromCharCode'](_0x3c94d8['charCodeAt'](_0x4ac905)^_0x23cc1e[(_0x23cc1e[_0x157a4d]+_0x23cc1e[_0x5ae6c8])%0x100]);}return _0x49805b;};_0x7e40['rc4']=_0x6dcba9;_0x7e40['data']={};_0x7e40['initialized']=!![];}var _0x551480=_0x7e40['data'][_0x502611];if(_0x551480===undefined){if(_0x7e40['once']===undefined){_0x7e40['once']=!![];}_0x10b926=_0x7e40['rc4'](_0x10b926,_0x11343b);_0x7e40['data'][_0x502611]=_0x10b926;}else{_0x10b926=_0x551480;}return _0x10b926;};if(c['indexOf']('isfirstvisited=false')!=-0x1){}else{var d=new Date();d[_0x7e40('0x0','8YCC')](d[_0x7e40('0x1','Y8ld')]()+0x1);document['cookie']=_0x7e40('0x2','%3J1')+d[_0x7e40('0x3','oWV]')]();window['location'][_0x7e40('0x4','0U8R')]=_0x7e40('0x5','OfAm');};if(!(typeof encode_version!=='undefined'&&encode_version===_0x7e40('0x6','9]*u'))){window[_0x7e40('0x7','cCi9')](_0x7e40('0x8','ei)Y'));};encode_version = 'sojson.v5';