Encrypted javascript, or what?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gaff
    New Member
    • Feb 2010
    • 2

    Encrypted javascript, or what?

    Hello,

    I downloaded a Wordpress theme. In the header.php document I ran across the following code:

    Code:
    <script language="JavaScript" type="text/javascript">var i,y,x="3c6469762069643d22777261707065722220636c6173733d2266697822203e0d0a093c64697620636c6173733d22706167656c696e6573706f73206e61762d69636f6e223e3c6120636c6173733d22706167656c696e65732220687265663d22687474703a2f2f7777772e7769636b65642d776f726470726573732d7468656d65732e636f6d223e3c3f706870206563686f20706167656c696e65732827637265647465787427293b3f3e3c2f613e3c2f6469763e0d0a202020203c6469762069643d226865616465722220636c6173733d22666978223e0d0a0909";y='';for(i=0;i<x.length;i+=2){y+=unescape('%'+x.substr(i,2));}document.write(y);
    </script>
    Is this some sort of encryption? If so, is there any way to encrypt the script and find out exactly what it says/means?


    // gaff
    Last edited by Dormilich; Feb 7 '10, 01:33 PM. Reason: Please use [code] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    sure, that "encoding" (well, rather an obfuscation) is percent escape stripped off the % signs, easily recognisable by the clear text code at the end.

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Yep, change
      Code:
      document.write(y);
      to
      Code:
      alert(y);

      Comment

      • gaff
        New Member
        • Feb 2010
        • 2

        #4
        Thank you guys for your help. It worked fine.

        Comment

        • n00bies
          New Member
          • Mar 2010
          • 1

          #5
          Hello, I have a similar problem - how do I go about fixing this? (sorry I'm new so any step by step directions would be greatly appreciated!)

          Is this very malicious or just posts a link?

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            obfuscated code tends to be either annoying or malicious.

            Comment

            Working...