25

I am looking for way (preferably and online site) to a reverse Uglify of some javascript. The Website: http://jsbeautifier.org/ is great for minifed code, but it is does not do a great job for ugly stuff.

6
  • Would minifying the code, then beautifying it work? I'm not sure what you mean by ugly code, unfortunately. Commented Aug 23, 2013 at 17:31
  • I am talking about reversing this code that was done with this tool: github.com/mishoo/UglifyJS Commented Aug 25, 2013 at 2:27
  • JS Beautifier does a great job with Uglified JS code. Not sure what the problem is? Commented Jan 12, 2014 at 14:04
  • I don't need the answer any more, but If you put this down as answer, I will check it off, I think it will work. Commented Jan 13, 2014 at 20:05
  • Actually UglifyJS does all sorts of really nasty renaming, transforms of switches, ifs, etc. It is really is a one-way obfuscation of the code. So JS Beautifier does not help. But my solution is to join the development team, so I can get the source code! Commented Jan 14, 2014 at 15:34

3 Answers 3

28

There is this awesome online tool, JSNice, that makes a great job of finding names to obfuscated variables.

We make even obfuscated JavaScript code readable. We will rename variables and parameters to names that we learn from thousands of open source projects. Furthermore, often we are also able to guess or infer type annotations.

Sign up to request clarification or add additional context in comments.

4 Comments

Would be nice if I could do it offline in an automated fashion.
This project is no longer maintained but it still appears to be working as of this comment.
More recently I've also used general LLMs for this purpose.
Fwiw JSNice was js lame for me - "Error compiling input" 💩
6

Chrome dev tools ability to Pretty Print

All you need to do is to click the { } icon on the bottom toolbar to activate this feature. Of course, the names will still be obfuscated (depending on what program minfied the JavaScript in the first place), but you will at least be able to set break points and debug the code.

Chrome developer tools Script view - side by side - before and after prettify

Source: Tip #2 in this archived article.

1 Comment

I tried this, but it is the same "unminify" as jsbeutifier.org, and uglyfy does really nasty things: boolean short circuits instead of if, then, else, replace all semi-colons with commas, and other ugly things that go beyond minifying.
2

Depends on what options you used when you uglify your code. If you just remove the line breaks, then Chrome dev tools will be able to do a great work as sirinivas explained. But if you mangle the code, then there is no way you can get the exact previous code. (in uglifying var logngvariable = a + b; becomes var c=a+b;. there is no way a tool can figure out the previous name logngvariable )

On the otherhand if you want an un-uglified code you may not uglify it at the first place... :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.