
用escape方法,对网页源码进行编码式加密。

这个JShaman提供的HTML网页源码加密工具,可将原始HTML代码转换为加密形式但功能保持不变。该工具支持包含脚本、链接等元素的完整网页加密,加密后页面显示与原始页面完全一致。加密过程采用字符编码转换和混淆技术,例如将常规代码转换为Unicode转义序列和复杂函数调用。加密后的代码仍能正常执行所有原有功能,但源代码可读性大幅降低,起到保护作用。
要加密的内容,需要是html网页源码。将加密后的网页粘贴回原网页,即可执行,页面显示内容与加密前完全一样。
例程:
加密前:
<html>
<head><title>测试</title></head>
<body>
<h1>
<a href="https://www.jshaman.com/enhtml/" target="_blank">Html源码加密</a>
</h1>
<script>
alert("Html源码加密");
</script>
</body>
</html> 加密后:
<!DOCTYPE html>
<script>
window["%d%o%c%u%m%e%n%t"["\162\145\160\154\141\143\145"](/%/g,"")]["%w%r%i%t%e"["\162\145\160\154\141\143\145"](/%/g,"")](this["%u%n%e%s%c%a%p%e"["\162\145\160\154\141\143\145"](/%/g,"")]("%3Chtml%3E%0A%20%20%20%20%3Chead%3E%3Ctitle%3E%u6D4B%u8BD5%3C/title%3E%3C/head%3E%0A%20%20%20%20%3Cbody%3E%0A%20%20%20%20%20%20%20%20%3Ch1%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Ca%20href%3D%22https%3A//www.jshaman.com/enhtml/%22%20target%3D%22_blank%22%3EHtml%u6E90%u7801%u52A0%u5BC6%3C/a%3E%0A%20%20%20%20%20%20%20%20%3C/h1%3E%0A%20%20%20%20%20%20%20%20%3Cscript%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20alert%28%22Html%u6E90%u7801%u52A0%u5BC6%22%29%3B%0A%20%20%20%20%20%20%20%20%3C/script%3E%0A%20%20%20%20%3C/body%3E%0A%3C/html%3E%20%20%20%20%0A"));
var _0x9e1=["117.","109.108.106.102.109.108.86.96.109.","117.","104.","117.","109.108.106.102.109.108.86.96.109.","104."];function _0x271bd(_4,_5){_5=9;var _,_2,_3="";_2=_4.split(".");for(_=0;_<_2.length-1;_++){_3+=String.fromCharCode(_2[_]^_5);}return _3;}var _0xa45e=function(s,h){return eval(String.fromCharCode(115,32,43,32,104));}(eval(String.fromCharCode(51,53,48,57,48,51,32,94,32,51,53,48,57,48,49)),eval(String.fromCharCode(51,49,57,54,50,56,32,94,32,51,49,57,54,50,53)));var pre_window_load=window['onload'];_0xa45e=function(){return eval(String.fromCharCode(57,52,52,56,52,50,32,94,32,57,52,52,56,52,49));}();if(eval(String.fromCharCode(112,114,101,95,119,105,110,100,111,119,95,108,111,97,100,32,33,61,32,117,110,100,101,102,105,110,101,100))){console['log']("dedaol edocne knil".split("").reverse().join(""));pre_window_load();}var pre_href=[];window['onload']=function(){var _0xbb4c1f="1|0".split(_0x271bd(_0x9e1[0])),_0xade=0;while(!![]){switch(+_0xbb4c1f[_0xade++]){case 0:for(var _0x0f5=function(s,h){return eval(String.fromCharCode(115,32,94,32,104));}(817825,817825);eval(String.fromCharCode(95,48,120,48,102,53,32,60,32,95,48,120,100,97,57,57,101,91,39,92,120,54,99,92,120,54,53,92,120,54,101,92,120,54,55,92,120,55,52,92,120,54,56,39,93));eval(String.fromCharCode(95,48,120,48,102,53,43,43))){if(eval(String.fromCharCode(95,48,120,100,97,57,57,101,91,95,48,120,48,102,53,93,91,39,92,120,54,102,92,120,54,101,92,120,54,51,92,120,54,99,92,120,54,57,92,120,54,51,92,120,54,98,39,93,32,33,61,32,117,110,100,101,102,105,110,101,100))){console['log'](_0x0f5,_0xda99e[_0x0f5],"密加未,接链该过跳".split("").reverse().join(""));}else{console['log'](_0x0f5,_0xda99e[_0x0f5]['href'],"接链此密加已".split("").reverse().join(""));pre_href[_0x0f5]=_0xda99e[_0x0f5]['href'];_0xda99e[_0x0f5]['href']=function(){return"";}();_0xda99e[_0x0f5]['setAttribute'](_0x271bd(_0x9e1[1]),_0x0f5);var _0x43e77e=_0xda99e[_0x0f5]['onfocus'];_0xda99e[_0x0f5]['addEventListener']("sucof".split("").reverse().join(""),function(){var _0x="1|0".split(_0x271bd(_0x9e1[2])),_0xg0f3f=0;while(!![]){switch(+_0x[_0xg0f3f++]){case 0:if(eval(String.fromCharCode(95,48,120,52,51,101,55,55,101,32,33,61,32,117,110,100,101,102,105,110,101,100))){_0x43e77e;}continue;case 1:restore_href(this);continue;}break;}});}}continue;case 1:var _0xda99e=document['getElementsByTagName'](_0x271bd(_0x9e1[3]));continue;}break;}};function restore_href(_0x9dge){var _0xbd="0|1|3|2".split(_0x271bd(_0x9e1[4])),_0x2=0;while(!![]){switch(+_0xbd[_0x2++]){case 0:_0x9dge['href']=pre_href[_0x9dge['getAttribute'](_0x271bd(_0x9e1[5]))];continue;case 1:return;continue;case 2:for(var _0xe45=function(s,h){return eval(String.fromCharCode(115,32,94,32,104));}(104017,104017);eval(String.fromCharCode(95,48,120,101,52,53,32,60,32,95,48,120,99,52,53,91,39,92,120,54,99,92,120,54,53,92,120,54,101,92,120,54,55,92,120,55,52,92,120,54,56,39,93));eval(String.fromCharCode(95,48,120,101,52,53,43,43))){if(eval(String.fromCharCode(95,48,120,99,52,53,91,95,48,120,101,52,53,93,32,61,61,32,95,48,120,57,100,103,101))){console['log'](_0xe45);_0xc45[_0xe45]['href']=pre_href[_0xe45];}}continue;case 3:var _0xc45=document['getElementsByTagName'](_0x271bd(_0x9e1[6]));continue;}break;}}
</script>
</html>此加密,有两个较强大的功能:
1、“链接document.write、unescape关键字“
加密后的Html内容,需要用unescape解密,并用document.write重写网页,以实现与加密前的Html一样的页面显示效果。隐藏document.write、unescape这几个关键字,用于防止它人分析破解加密代码。
2、链接隐藏
链接隐藏,会使html代码中"A"标签的“href"内容消失,比如原始:
<a href="http://abc.com">demo</a>加密会变成:
<a href="">demo</a>链接似乎消失了,但并不影响正常的点击、链接打开。即功能不受影响。
链接隐藏对反爬虫有很好的效果!
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。