轻松解码类似eval(function(p,a,c,k,e,d){}))的JavaScript代码


这里解码百度访问统计代码构造函数为示例:

百度访问统计代码JavaScript源码:
红色加粗部分将是要修改的地方.

  1. 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}('p w(E,D,A,C,B){5.R=8.14(E);5.o=D;5.d=A;5.r=(8.e)?C:(C-2);5.q=0;5.b=B+((8.e)?0:-2);5.x=5.d[0];5.O=5.d[5.d.c-1]}w.P.y=p(B){9 A=15.16(((B-5.x)*5.b/(5.O-5.x)))+((8.e)?2:0);s(A>5.b){A=5.b}17 A};w.P.18=p(){9 A=8.i("k");A.a="1a";A.6.z=5.b+"7";5.R.j(A);9 K=8.i("k");A.j(K);K.a="1b";9 J=0;Q(9 G=0;G<5.o.c;G+=2){9 B=5.y(5.o[G]);9 I=5.o[G+1];9 F=8.i("k");A.j(F);F.a="u";F.6.n=5.r+"7";F.6.z=B+"7";F.6.m=5.b-B-1+"7";F.6.g=(J-1)+"7";F.h="&v;";F.f=K;F.T=p(){5.a="V";5.f.6.L="";5.f.h=5.t.l(3,5.t.c);5.f.6.g=5.6.g;5.f.6.m=S(5.6.m)-S(5.f.19)+"7"};F.W=p(){5.a="u";5.f.6.L="Z"};9 E=8.i("k");A.j(E);E.6.n=5.r+"7";E.6.m=(8.e)?5.b:5.b+3+"7";9 C=I.10(".");F.t="u"+I.l(0,C)+"\\11"+I.l(C+1,I.c)+"\\12&v;&v;"+5.o[G];s(G%4==0){s((I.l(C+1,I.c)=="1"||I.l(C+1,I.c)=="2")){E.a="13";E.6.g=(J-4)+"7";E.h=I}N{E.a="M";E.6.g=(J-1)+"7";E.h=I.l(C+1,I.c)}}N{E.a="M";E.6.g=(J-1)+"7";E.h=""}J+=5.r+((8.e)?-1:1)}5.q=J+((8.e)?1:-1);A.6.n=5.q+"7";Q(9 G=0;G<5.d.c;G++){9 D=5.y(5.d[G]);s(G!=0&&G!=5.d.c-1){9 H=8.i("k");A.j(H);H.a="X";H.6.n=(5.q-((8.e)?1:-1))+"7";H.6.m=(5.b-D-1)+"7"}9 E=8.i("k");A.j(E);E.a="1c";E.6.n="Y";E.6.m=(5.b-D-2)+"7";E.6.g=-U+"7";E.h=5.d[G]}};',62,75,'|||||this|style|px|document|var|className|charth|length|yl|all|ohit|left|innerHTML|createElement|appendChild|div|substring|top|width|xl|function|chartw|barw|if|id|bar|nbsp|Chart|minpv|GetPVHeight|height||||||||||||display|titx|else|maxpv|prototype|for|parent|parseInt|onmouseover|42|barhl|onmouseout|liney|35px|none|indexOf|u6708|u65e5|titxhl|getElementById|Math|round|return|Create|offsetHeight|chart|hit|tity'.split('|'),0,{}));
复制代码

其实这个eval(function(p,a,c,k,e,d){}))中自带解码函数e().
while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p
while循环产生的每个p就是解码后的函数代码,我们删掉源码中的return p,不用将结果返回,
而是直接输出在一个文本区域中,如document.getElementById(”textareaID”).innerText=p.

最终代码:

  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. <title> Crack Baidu统计构造函数</title>
  5. <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  6. <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  7. <meta name="Author" content=www.gemingcao.com />
  8. <meta name="Keywords" content="" />
  9. <meta name="Description" content="" />  
  10. </head>
  11. <body>
  12. <textarea id="textareaID" rows="25" cols="50"></textarea>
  13. <script type="text/javascript">
  14. 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]);document.getElementById('textareaID').innerText=p;}}}('p w(E,D,A,C,B){5.R=8.14(E);5.o=D;5.d=A;5.r=(8.e)?C:(C-2);5.q=0;5.b=B+((8.e)?0:-2);5.x=5.d[0];5.O=5.d[5.d.c-1]}w.P.y=p(B){9 A=15.16(((B-5.x)*5.b/(5.O-5.x)))+((8.e)?2:0);s(A>5.b){A=5.b}17 A};w.P.18=p(){9 A=8.i("k");A.a="1a";A.6.z=5.b+"7";5.R.j(A);9 K=8.i("k");A.j(K);K.a="1b";9 J=0;Q(9 G=0;G<5.o.c;G+=2){9 B=5.y(5.o[G]);9 I=5.o[G+1];9 F=8.i("k");A.j(F);F.a="u";F.6.n=5.r+"7";F.6.z=B+"7";F.6.m=5.b-B-1+"7";F.6.g=(J-1)+"7";F.h="&v;";F.f=K;F.T=p(){5.a="V";5.f.6.L="";5.f.h=5.t.l(3,5.t.c);5.f.6.g=5.6.g;5.f.6.m=S(5.6.m)-S(5.f.19)+"7"};F.W=p(){5.a="u";5.f.6.L="Z"};9 E=8.i("k");A.j(E);E.6.n=5.r+"7";E.6.m=(8.e)?5.b:5.b+3+"7";9 C=I.10(".");F.t="u"+I.l(0,C)+"\\11"+I.l(C+1,I.c)+"\\12&v;&v;"+5.o[G];s(G%4==0){s((I.l(C+1,I.c)=="1"||I.l(C+1,I.c)=="2")){E.a="13";E.6.g=(J-4)+"7";E.h=I}N{E.a="M";E.6.g=(J-1)+"7";E.h=I.l(C+1,I.c)}}N{E.a="M";E.6.g=(J-1)+"7";E.h=""}J+=5.r+((8.e)?-1:1)}5.q=J+((8.e)?1:-1);A.6.n=5.q+"7";Q(9 G=0;G<5.d.c;G++){9 D=5.y(5.d[G]);s(G!=0&&G!=5.d.c-1){9 H=8.i("k");A.j(H);H.a="X";H.6.n=(5.q-((8.e)?1:-1))+"7";H.6.m=(5.b-D-1)+"7"}9 E=8.i("k");A.j(E);E.a="1c";E.6.n="Y";E.6.m=(5.b-D-2)+"7";E.6.g=-U+"7";E.h=5.d[G]}};',62,75,'|||||this|style|px|document|var|className|charth|length|yl|all|ohit|left|innerHTML|createElement|appendChild|div|substring|top|width|xl|function|chartw|barw|if|id|bar|nbsp|Chart|minpv|GetPVHeight|height||||||||||||display|titx|else|maxpv|prototype|for|parent|parseInt|onmouseover|42|barhl|onmouseout|liney|35px|none|indexOf|u6708|u65e5|titxhl|getElementById|Math|round|return|Create|offsetHeight|chart|hit|tity'.split('|'),0,{}));
  15. </script>
  16. </body>
  17. </html>
复制代码

保存为html文件,运行.
格式化文本区域中的JavaScript代码,代码如下:

  1. function Chart(E, D, A, C, B) {
  2.     this.parent = document.getElementById(E);
  3.     this.xl = D;
  4.     this.yl = A;
  5.     this.barw = (document.all) ? C: (C - 2);
  6.     this.chartw = 0;
  7.     this.charth = B + ((document.all) ? 0 : -2);
  8.     this.minpv = this.yl[0];
  9.     this.maxpv = this.yl[this.yl.length - 1]
  10. }
  11. Chart.prototype.GetPVHeight = function(B) {
  12.     var A = Math.round(((B - this.minpv) * this.charth / (this.maxpv - this.minpv))) + ((document.all) ? 2 : 0);
  13.     if (A > this.charth) {
  14.         A = this.charth
  15.     }
  16.     return A
  17. };
  18. Chart.prototype.Create = function() {
  19.     var A = document.createElement("div");
  20.     A.className = "chart";
  21.     A.style.height = this.charth + "px";
  22.     this.parent.appendChild(A);
  23.     var K = document.createElement("div");
  24.     A.appendChild(K);
  25.     K.className = "hit";
  26.     var J = 0;
  27.     for (var G = 0; G < this.xl.length; G += 2) {
  28.         var B = this.GetPVHeight(this.xl[G]);
  29.         var I = this.xl[G + 1];
  30.         var F = document.createElement("div");
  31.         A.appendChild(F);
  32.         F.className = "bar";
  33.         F.style.width = this.barw + "px";
  34.         F.style.height = B + "px";
  35.         F.style.top = this.charth - B - 1 + "px";
  36.         F.style.left = (J - 1) + "px";
  37.         F.innerHTML = "&nbsp;";
  38.         F.ohit = K;
  39.         F.onmouseover = function() {
  40.             this.className = "barhl";
  41.             this.ohit.style.display = "";
  42.             this.ohit.innerHTML = this.id.substring(3, this.id.length);
  43.             this.ohit.style.left = this.style.left;
  44.             this.ohit.style.top = parseInt(this.style.top) - parseInt(this.ohit.offsetHeight) + "px"
  45.         };
  46.         F.onmouseout = function() {
  47.             this.className = "bar";
  48.             this.ohit.style.display = "none"
  49.         };
  50.         var E = document.createElement("div");
  51.         A.appendChild(E);
  52.         E.style.width = this.barw + "px";
  53.         E.style.top = (document.all) ? this.charth: this.charth + 3 + "px";
  54.         var C = I.indexOf(".");
  55.         F.id = "bar" + I.substring(0, C) + "\u6708" + I.substring(C + 1, I.length) + "\u65e5&nbsp;&nbsp;" + this.xl[G];
  56.         if (G % 4 == 0) {
  57.             if ((I.substring(C + 1, I.length) == "1" || I.substring(C + 1, I.length) == "2")) {
  58.                 E.className = "titxhl";
  59.                 E.style.left = (J - 4) + "px";
  60.                 E.innerHTML = I
  61.             } else {
  62.                 E.className = "titx";
  63.                 E.style.left = (J - 1) + "px";
  64.                 E.innerHTML = I.substring(C + 1, I.length)
  65.             }
  66.         } else {
  67.             E.className = "titx";
  68.             E.style.left = (J - 1) + "px";
  69.             E.innerHTML = ""
  70.         }
  71.         J += this.barw + ((document.all) ? -1 : 1)
  72.     }
  73.     this.chartw = J + ((document.all) ? 1 : -1);
  74.     A.style.width = this.chartw + "px";
  75.     for (var G = 0; G < this.yl.length; G++) {
  76.         var D = this.GetPVHeight(this.yl[G]);
  77.         if (G != 0 && G != this.yl.length - 1) {
  78.             var H = document.createElement("div");
  79.             A.appendChild(H);
  80.             H.className = "liney";
  81.             H.style.width = (this.chartw - ((document.all) ? 1 : -1)) + "px";
  82.             H.style.top = (this.charth - D - 1) + "px"
  83.         }
  84.         var E = document.createElement("div");
  85.         A.appendChild(E);
  86.         E.className = "tity";
  87.         E.style.width = "35px";
  88.         E.style.top = (this.charth - D - 2) + "px";
  89.         E.style.left = -42 + "px";
  90.         E.innerHTML = this.yl[G]
  91.     }
  92. };
复制代码

修正以后发现一个更简单的方法..将eval直接替换成document.write,将代码输出,但是要注意一点.在输出前,先输出一个<xmp>标记
如:

  1. document.write("<xmp>");
  2. /*eval*/document.write("function(){.....代码}");
  3. document.write("</xmp>");
复制代码

输出后是一堆代码.
把Javascript格式化一下
格式化的网页工具
http://tool.chinaz.com/Tools/JsFormat.aspx

转自:http://www.yunsafe.com/thread-269-1-1.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM