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.
-
Would minifying the code, then beautifying it work? I'm not sure what you mean by ugly code, unfortunately.Chris Forrence– Chris Forrence2013-08-23 17:31:49 +00:00Commented Aug 23, 2013 at 17:31
-
I am talking about reversing this code that was done with this tool: github.com/mishoo/UglifyJSDr.YSG– Dr.YSG2013-08-25 02:27:21 +00:00Commented Aug 25, 2013 at 2:27
-
JS Beautifier does a great job with Uglified JS code. Not sure what the problem is?Chuck Le Butt– Chuck Le Butt2014-01-12 14:04:24 +00:00Commented 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.Dr.YSG– Dr.YSG2014-01-13 20:05:37 +00:00Commented 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!Dr.YSG– Dr.YSG2014-01-14 15:34:40 +00:00Commented Jan 14, 2014 at 15:34
3 Answers
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.
4 Comments
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.
Source: Tip #2 in this archived article.
1 Comment
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... :)
