JS eval(function(p,a,c,k,e,r){e=function(c)*****解密
在网上下载源代码时,很可能发现代码里的JS脚本看不懂,这是由于JS加密造成的。如果你发现JS是以eval(function(p,a,c,k,e,r){e=function(c)开头的,看到这个页面你就可以解决他。
步骤:1.新建html页面,把以下代码考进去,运行。
2.把加密的代码粘进文本域,点击解密,OK!
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>JS解密</title> 6 </head> 7 8 <body> 9 <script> 10 a=62; 11 function encode() { 12 var code = document.getElementById('code').value; 13 code = code.replace(/[ ]+/g, ''); 14 code = code.replace(/'/g, "\'"); 15 var tmp = code.match(/(w+)/g); 16 tmp.sort(); 17 var dict = []; 18 var i, t = ''; 19 for(var i=0; i<tmp.length; i++) { 20 if(tmp[i] != t) dict.push(t = tmp[i]); 21 } 22 var len = dict.length; 23 var ch; 24 for(i=0; i<len; i++) { 25 ch = num(i); 26 code = code.replace(new RegExp('\b'+dict[i]+'\b','g'), ch); 27 if(ch == dict[i]) dict[i] = ''; 28 } 29 document.getElementById('code').value = "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}(" 30 + "'"+code+"',"+a+","+len+",'"+ dict.join('|')+"'.split('|'),0,{}))"; 31 } 32 33 function num(c) { 34 return(c<a?'':num(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36)); 35 } 36 37 function run() { 38 eval(document.getElementById('code').value); 39 } 40 41 function decode() { 42 var code = document.getElementById('code').value; 43 code2 = code.replace(/^eval/, ''); 44 //alert(code); 45 document.getElementById('code').value = eval(code2); 46 } 47 </script> 48 49 <textarea id=code cols=80 rows=20> 50 51 </textarea> 52 53 54 <input type=button onclick=encode() value=编码> 55 <input type=button onclick=run() value=执行> 56 <input type=button onclick=decode() value=解码> 57 </body> 58 </html>