准确的说eval处理过的代码应该叫作压缩代码,不过效果上算是加密过了同样!不少小伙伴不想直接让别人看到本身的js代码每每就会采起这样的处理措施。不过,其实这样的方法只能防护那些小白。对于真正的大佬来讲,破解就是秒秒钟的事!真的就是秒秒钟!话很少说,咱们直接进入正题!javascript
eval(function(p,a,c,k,e,r){e=function(c){return c.toString(36)};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[1-9a-g]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(document).ready(3(){1 s=window.screen;1 4=q.4=s.4;1 7=q.7;1 5=Array(300).join(0).split(\'\');1 2=q.9(\'a\');1 b=3(){2.c=\'rgba(0,0,0,.05)\';2.fillRect(0,0,4,7);2.c=\'red\';2.font=\'10pt Georgia\';5.map(3(y,6){d=String.fromCharCode(1e2+e.f()*33);x=(6*8)+8;q.9(\'a\').fillText(d,x,y);if(y>e.f()*1e4){5[6]=0}else{5[6]=y+8}})};g();3 g(){Game_Interval=setInterval(b,30)}});',[],17,'|var|ctx|function|width|yPositions|index|height|10|getContext|2d|draw|fillStyle|text|Math|random|RunMatrix'.split('|'),0,{}))
打开浏览器控制台;html
调到Console
;java
复制代码,粘贴;jquery
删除“eval
”这四个字符;ajax
回车。json
不要和我说你不会回车....canvas
$(document).ready(function () { var s = window.screen; var width = q.width = s.width; var height = q.height; var yPositions = Array(300).join(0).split(''); var ctx = q.getContext('2d'); var draw = function () { ctx.fillStyle = 'rgba(0,0,0,.05)'; ctx.fillRect(0, 0, width, height); ctx.fillStyle = 'red'; ctx.font = '10pt Georgia'; yPositions.map(function (y, index) { text = String.fromCharCode(1e2 + Math.random() * 33); x = (index * 10) + 10; q.getContext('2d').fillText(text, x, y); if (y > Math.random() * 1e4) { yPositions[index] = 0; } else { yPositions[index] = y + 10; } }); }; RunMatrix(); function RunMatrix() { Game_Interval = setInterval(draw, 30); } });
<html> <head> <title>The Matrix</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> <meta charset="utf-8"> <script> /* ① 用setInterval(draw, 33)设定刷新间隔 ② 用String.fromCharCode(1e2+Math.random()*33)随机生成字母 ③ 用ctx.fillStyle=’rgba(0,0,0,.05)’; ctx.fillRect(0,0,width,height); ctx.fillStyle=’#0F0′; 反复生成opacity为0.5的半透明黑色背景 ④ 用x = (index * 10)+10;和yPositions[index] = y + 10;顺序肯定显示字母的位置 ⑤ 用fillText(text, x, y); 在指定位置显示一个字母 以上步骤循环进行,就会产生《黑客帝国》的片头效果。 */ $(document).ready(function () { var s = window.screen; var width = q.width = s.width; var height = q.height; var yPositions = Array(300).join(0).split(''); var ctx = q.getContext('2d'); var draw = function () { ctx.fillStyle = 'rgba(0,0,0,.05)'; ctx.fillRect(0, 0, width, height); ctx.fillStyle = 'red'; ctx.font = '10pt Georgia'; yPositions.map(function (y, index) { text = String.fromCharCode(1e2 + Math.random() * 33); x = (index * 10) + 10; q.getContext('2d').fillText(text, x, y); if (y > Math.random() * 1e4) { yPositions[index] = 0; } else { yPositions[index] = y + 10; } }); }; RunMatrix(); function RunMatrix() { Game_Interval = setInterval(draw, 30); } }); </script> </head> <body> <div align="center"> <canvas id="q" width="500" height="500"></canvas> </div> </body> </html>
建议加密后再解密,检查解密代码和源代码是否一致!api