Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverse Uglified Javascript Code

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.

like image 611
Dr.YSG Avatar asked Aug 23 '13 17:08

Dr.YSG


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.

like image 149
cmolina Avatar answered Nov 06 '22 23:11

cmolina


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: point #2 in https://web.archive.org/web/20150418125316/http://www.elijahmanor.com/7-chrome-tips-developers-designers-may-not-know

like image 32
Srinivas Avatar answered Nov 07 '22 01:11

Srinivas


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 ther 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... :)

like image 23
Ishan Hettiarachchi Avatar answered Nov 07 '22 00:11

Ishan Hettiarachchi