简体   繁体   中英

Decoding an encrypted HTML file using Javascript

I am trying to decrypt the encrypted page source of an HTML file. I am serching for a decoding trick to decrypt a page containing facebook interface UI. It is in the following post decrypted facebook Ui page . The demo page of that post is encrypted. Is there any posible way to decrypt it?

The code looks like this:

document.write(unescape("..."));

Copy the unescape("...") part. Go to JSFiddle . In the JavaScript area, type alert( , paste, and then type ); . Press run.

The "encrypted" (not) source will be alert ed. You can copy and paste that into your text editor of choice to start analyzing it.

By the way, the decrypted code looks pretty bad. I wouldn't want to learn from that.

You can't "decrypt" it back to the original source at this point. It is "obfuscated" to the point it's not really easy to read anymore.

You can deminify it to make it a little easier to read by using a JavaScript deminifer/deobfuscator as discussed in the SO question Is there such a thing as a javascript deminifier (deobfuscator)? JS Beautifier is one good one.

You could also use a debugger like a browser plugin like Firebug (though it doesn't deobfuscate/deminify without plugins) or use the latest version of Google Chrome which provides one built-in. In Chrome:

  1. Visit the page that has the script you are trying to view
  2. Press F12 to bring up the developer tools
  3. Go to the Scripts tab
  4. Choose the JavaScript file to view from the drop-down list in the top left
  5. Click the "brackets" icon in the bottom left to run the "Pretty print" tool which will make the script easier to read.

This still won't make it very easy to read since the author has obfuscated it pretty good. You're going to have to walk through it line by line and rebuild the script yourself if you want to go through all that trouble.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM