How does this obfuscated JavaScript work?

前端 未结 4 1899
清歌不尽
清歌不尽 2021-01-29 17:31

How does the following JavaScript work?

I understand that it is minified code. I have tried de-obfuscating it a little, but I can\'t get a clear concept of how it achiev

4条回答
  •  既然无缘
    2021-01-29 18:09

    A string with the all the code is evaluated, and a timeout makes the loop; The string is stored in a variable named z and in the middle of the code, between comments /* and */there is an "Earth ASCII Art". The code parses the comments and changes the document content, keeping the js and updating the art. Bellow is just the code sliced:

      p="
    ";
      for(y in n="zw24l6k4e3t4jnt4qj24xh2 x42kty24wrt413n243n9h243pdxt41csb yz43iyb6k43pk7243nmr24".split(4)){ 
        for(a in t = parseInt(n[y],36)+(e=x=r=[]))
          for(r=!r,i=0;t[a]>i;i+=.05)
            with(Math) x-= .05,0>cos(o=new Date/1e3+x/PI)&&(e[~~(32*sin(o)*sin(.5+y/7))+60] =-~ r);
              for(x=0;122>x;) p += "   *#"[e[x++]+e[x++\]] ||
                  (S=("eval"+"(z=\'"+z.split(B = "\\\\").join(B+B).split(Q="\'").join(B+Q)+Q+")//m1k")[x/2+61*y-1]).fontcolor(/\\w/.test(S)&&"#\03B");
        p += B+"\\n"
        document.body.innerHTML= p
      }
    

提交回复
热议问题