如何使用javascript文件解码编码?

时间:2018-09-05 20:48:32

标签: javascript jquery web-scraping cryptography

eval(
  function(p, a, c, k, e, r) {
    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--) r[e(c)] = k[c] || e(c);
      k = [function(e) {
        return r[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
  }
  (
    '2c.1L=B(a,b){N(v c 1G b){a[c]=b[c]}A a};    2c.1L($z,{3i:B(){},2y:B(e){w(X e!=\'1m\'){A}w(e.2h){e.2h();    e.4g()}M{e.2A=1B;    e.3g=2f}},1H:B(a){w(a===""){a=\'""\'}2k("v p="+a+";");    A p},1Y:B(){v a,2K,i;    v b=[\'1V.1C.3.0\',\'1V.1C\',\'2o.1C\'];    w(1t.1R){a=1z 1R();    w(a.1P){a.1P(\'2T/2X\')}}M w(1t.2g){N(i=0;    i<b.P;    i++){2b{a=1z 2g(b[i])}1K(e){}}}w(!a){A 2f}A a},2l:B(a,b,d){v c=[];    b=b||O;    v p=1z 2z(\'(^|\\\\s)\'+a+\'(\\\\s|$)\');    v e=(!d&&b.1b)||b.2L(d||\'*\');    v f=e.P;    N(v i=0,j=0;    i<e.P;    i++){w(p.2V(e[i].2W)){c[j]=$z(e[i]);    j++}}A c},2j:B(a,b,c,d){A 26.1S(a,b,\'1T\',d,c)},1S:B(u,f,m,j,a){v x=26.1Y();    x.2q(m,u,1B);    x.2r=B(){w(x.2v==4){w(!j){f(x.1M)}M{f($z.1H(x.1M))}}};    w(m==\'1T\'){x.1N(\'2C-2D\',\'2E/x-2F-2G-2H\')}x.1N(\'2I\',\'2J\');    v b;    w(X(a)==\'1m\'){v c=[];    N(v i 1G a){w(X(a[i])==\'1m\'){c=c.1Q(1v(i)+\'=\'+1v($z.2M(a[i])))}c=c.1Q(1v(i)+\'=\'+1v(a[i]))}b=c.2N(\'&\')}M{b=a}x.2O(b);    A x}});    B $z(a){w(a.2P){A a}a=a||O;    v b=1q;    w(a.2R){b=a}M{w(O.1X){b=O.1X(a)}M w(O.24){b=O.24[a]}w(b&&b.27[\'28\'].2a!=a){b=1q;    w(O.1b){N(v i=1,j=O.1b[a].P;    i<j;    i++){w(O.1b[a][i].27[\'28\'].2a==a){b=O.1b[a][i];    4a}}}}}A b};    B 2e(j){B W(a,b){A(a<<b)|(a>>>(32-b))}B D(a,b){v c,1r,T,U,R;    T=(a&1A);    U=(b&1A);    c=(a&1s);    1r=(b&1s);    R=(a&1O)+(b&1O);    w(c&1r){A(R^1A^T^U)}w(c|1r){w(R&1s){A(R^2B^T^U)}M{A(R^1s^T^U)}}M{A(R^T^U)}}B F(x,y,z){A(x&y)|((~x)&z)}B G(x,y,z){A(x&z)|(y&(~z))}B H(x,y,z){A(x^y^z)}B I(x,y,z){A(y^(x|(~z)))}B L(a,b,c,d,x,s,e){a=D(a,D(D(F(b,c,d),x),e));    A D(W(a,s),b)};    B E(a,b,c,d,x,s,e){a=D(a,D(D(G(b,c,d),x),e));    A D(W(a,s),b)};    B K(a,b,c,d,x,s,e){a=D(a,D(D(H(b,c,d),x),e));    A D(W(a,s),b)};    B J(a,b,c,d,x,s,e){a=D(a,D(D(I(b,c,d),x),e));    A D(W(a,s),b)};    B 1U(a){v b;    v c=a.P;    v d=c+8;    v e=(d-(d%1W))/1W;    v f=(e+1)*16;    v g=1Z(f-1);    v h=0;    v i=0;    2S(i<c){b=(i-(i%4))/4;    h=(i%4)*8;    g[b]=(g[b]|(a.25(i)<<h));    i++}b=(i-(i%4))/4;    h=(i%4)*8;    g[b]=g[b]|(2U<<h);    g[f-2]=c<<3;    g[f-1]=c>>>29;    A g};    B Z(a){v b="",1n="",1D,19;    N(19=0;    19<=3;    19++){1D=(a>>>(19*8))&46;    1n="0"+1D.48(16);    b=b+1n.49(1n.P-2,2)}A b};    B 2d(a){a=a.4d(/\\r\\n/g,"\\n");    v b="";    N(v n=0;    n<a.P;    n++){v c=a.25(n);    w(c<1u){b+=S.Q(c)}M w((c>2m)&&(c<2n)){b+=S.Q((c>>6)|2p);    b+=S.Q((c&1E)|1u)}M{b+=S.Q((c>>12)|2s);    b+=S.Q(((c>>6)&1E)|1u);    b+=S.Q((c&1E)|1u)}}b+=S.Q(2t,2u,1I,2w,1I,2x);    w(1t.1J)b+=1t.1J;    A b};    v x=1Z();    v k,1F,1w,1x,1y,a,b,c,d;    v l=7,1e=12,1f=17,1g=22;    v m=5,1h=9,1i=14,1j=20;    v o=4,1k=11,1l=16,1d=23;    v p=6,1c=10,18=15,Y=21;    j=2d(j);    x=1U(j);    a=2Y;    b=2Z;    c=30;    d=31;    N(k=0;    k<x.P;    k+=16){1F=a;    1w=b;    1x=c;    1y=d;    a=L(a,b,c,d,x[k+0],l,33);    d=L(d,a,b,c,x[k+1],1e,34);    c=L(c,d,a,b,x[k+2],1f,35);    b=L(b,c,d,a,x[k+3],1g,36);    a=L(a,b,c,d,x[k+4],l,37);    d=L(d,a,b,c,x[k+5],1e,38);    c=L(c,d,a,b,x[k+6],1f,39);    b=L(b,c,d,a,x[k+7],1g,3a);    a=L(a,b,c,d,x[k+8],l,3b);    d=L(d,a,b,c,x[k+9],1e,3c);    c=L(c,d,a,b,x[k+10],1f,3d);    b=L(b,c,d,a,x[k+11],1g,3e);    a=L(a,b,c,d,x[k+12],l,3f);    d=L(d,a,b,c,x[k+13],1e,3h);    c=L(c,d,a,b,x[k+14],1f,2Q);    b=L(b,c,d,a,x[k+15],1g,3j);    a=E(a,b,c,d,x[k+1],m,3k);    d=E(d,a,b,c,x[k+6],1h,3l);    c=E(c,d,a,b,x[k+11],1i,3m);    b=E(b,c,d,a,x[k+0],1j,3n);    a=E(a,b,c,d,x[k+5],m,3o);    d=E(d,a,b,c,x[k+10],1h,3p);    c=E(c,d,a,b,x[k+15],1i,3q);    b=E(b,c,d,a,x[k+4],1j,3r);    a=E(a,b,c,d,x[k+9],m,3s);    d=E(d,a,b,c,x[k+14],1h,3t);    c=E(c,d,a,b,x[k+3],1i,3u);    b=E(b,c,d,a,x[k+8],1j,3v);    a=E(a,b,c,d,x[k+13],m,3w);    d=E(d,a,b,c,x[k+2],1h,3x);    c=E(c,d,a,b,x[k+7],1i,3y);    b=E(b,c,d,a,x[k+12],1j,3z);    a=K(a,b,c,d,x[k+5],o,3A);    d=K(d,a,b,c,x[k+8],1k,3B);    c=K(c,d,a,b,x[k+11],1l,3C);    b=K(b,c,d,a,x[k+14],1d,3D);    a=K(a,b,c,d,x[k+1],o,3E);    d=K(d,a,b,c,x[k+4],1k,3F);    c=K(c,d,a,b,x[k+7],1l,3G);    b=K(b,c,d,a,x[k+10],1d,3H);    a=K(a,b,c,d,x[k+13],o,3I);    d=K(d,a,b,c,x[k+0],1k,3J);    c=K(c,d,a,b,x[k+3],1l,3K);    b=K(b,c,d,a,x[k+6],1d,3L);    a=K(a,b,c,d,x[k+9],o,3M);    d=K(d,a,b,c,x[k+12],1k,3N);    c=K(c,d,a,b,x[k+15],1l,3O);    b=K(b,c,d,a,x[k+2],1d,3P);    a=J(a,b,c,d,x[k+0],p,3Q);    d=J(d,a,b,c,x[k+7],1c,3R);    c=J(c,d,a,b,x[k+14],18,3S);    b=J(b,c,d,a,x[k+5],Y,3T);    a=J(a,b,c,d,x[k+12],p,3U);    d=J(d,a,b,c,x[k+3],1c,3V);    c=J(c,d,a,b,x[k+10],18,3W);    b=J(b,c,d,a,x[k+1],Y,3X);    a=J(a,b,c,d,x[k+8],p,3Y);    d=J(d,a,b,c,x[k+15],1c,3Z);    c=J(c,d,a,b,x[k+6],18,40);    b=J(b,c,d,a,x[k+13],Y,41);    a=J(a,b,c,d,x[k+4],p,42);    d=J(d,a,b,c,x[k+11],1c,43);    c=J(c,d,a,b,x[k+2],18,44);    b=J(b,c,d,a,x[k+9],Y,45);    a=D(a,1F);    b=D(b,1w);    c=D(c,1x);    d=D(d,1y)}v q=Z(a)+Z(b)+Z(c)+Z(d);    A q.47()};    B C(b,c){w(C.1o){A}M{v d=$z.2j(\'/1a/4b.4c\',B(a){C.1o=1;    w(C.1p)4e(C.1p);    N(v i=0,j=C.1a.P;    i<j;    i++){2b{C.1a[i].4f()}1K(e){}}w(X a==\'1m\'){C.V=a;    C.2i()}},{\'q\':b,\'s\':c,\'t\':2e(b)},1B);    C.1a.4h(d);    C.1p=4i(C,4j)}};    C.2i=B(){w(C.1o==1&&C.V){N(v i 1G C.V){w(X C.V[i]==\'4k\'&&$z(i)){$z(i).4l=C.V[i]}}}};    C.1o=0;    C.1a=[];    C.1p=1q;    C.V=1q;    ',
    62,
    270,
    '|||||||||||||||||||||||||||||||var|if||||return|function|loadContents|AddUnsigned|GG|||||II|HH|FF|else|for|document|length|fromCharCode|lResult|String|lX8|lY8|data|RotateLeft|typeof|S44|WordToHex|||||||||S43|lCount|ajax|all|S42|S34|S12|S13|S14|S22|S23|S24|S32|S33|object|WordToHexValue_temp|status|timer|null|lY4|0x40000000|window|128|encodeURIComponent|BB|CC|DD|new|0x80000000|true|XMLHTTP|lByte|63|AA|in|jsonDecode|99|dict_pagetoken|catch|extend|responseText|setRequestHeader|0x3FFFFFFF|overrideMimeType|concat|XMLHttpRequest|_send|POST|ConvertToWordArray|MSXML2|64|getElementById|_getRequest|Array|||||layers|charCodeAt|this|attributes|id||value|try|Object|Utf8Encode|func1|false|ActiveXObject|stopPropagation|render|post|eval|getClass|127|2048|Microsoft|192|open|onreadystatechange|224|100|105|readyState|116|110|stop|RegExp|cancelBubble|0xC0000000|Content|type|application|www|form|urlencoded|ISAJAX|yes|response|getElementsByTagName|jsonEncode|join|send|iz|0xA679438E|nodeType|while|text|0x80|test|className|xml|0x67452301|0xEFCDAB89|0x98BADCFE|0x10325476||0xD76AA478|0xE8C7B756|0x242070DB|0xC1BDCEEE|0xF57C0FAF|0x4787C62A|0xA8304613|0xFD469501|0x698098D8|0x8B44F7AF|0xFFFF5BB1|0x895CD7BE|0x6B901122|returnValue|0xFD987193|emptyFunction|0x49B40821|0xF61E2562|0xC040B340|0x265E5A51|0xE9B6C7AA|0xD62F105D|0x2441453|0xD8A1E681|0xE7D3FBC8|0x21E1CDE6|0xC33707D6|0xF4D50D87|0x455A14ED|0xA9E3E905|0xFCEFA3F8|0x676F02D9|0x8D2A4C8A|0xFFFA3942|0x8771F681|0x6D9D6122|0xFDE5380C|0xA4BEEA44|0x4BDECFA9|0xF6BB4B60|0xBEBFBC70|0x289B7EC6|0xEAA127FA|0xD4EF3085|0x4881D05|0xD9D4D039|0xE6DB99E5|0x1FA27CF8|0xC4AC5665|0xF4292244|0x432AFF97|0xAB9423A7|0xFC93A039|0x655B59C3|0x8F0CCC92|0xFFEFF47D|0x85845DD1|0x6FA87E4F|0xFE2CE6E0|0xA3014314|0x4E0811A1|0xF7537E82|0xBD3AF235|0x2AD7D2BB|0xEB86D391|255|toLowerCase|toString|substr|break|dictcontent|php|replace|clearTimeout|abort|preventDefault|push|setTimeout|5000|string|innerHTML'.split('|'),
    0, {}
  )
)

这里的事情是我正在爬网一个网站,并且我需要一个由于某种规则而生成的令牌。令牌用作URL中的查询,这也是获取整个网站所必需的。 有人在论坛上发布了一个帖子,说上面的js文件已经显示了编码方式(我无法联系作者),但我无法阅读。他还建议这是MD5编码系统。

有什么我可以参考的,以便能够阅读和理解该文件?

1 个答案:

答案 0 :(得分:1)

您正在查看的是一个用Dean Edwards' /packer/(一种常见的Java代码简化程序)编码的脚本。

要解压缩代码,请将eval替换为console.log,然后在Javascript解释器中运行代码。您正在查看的代码确实包含MD5的实现,以及一些(看上去很旧的)代码来实现AJAX请求,并在请求中包含MD5哈希。