How to de-obfuscate Javascript code to make it readable again

In this tutorial I will show you my way to de-obfuscate a Javascript code to make it readable again. My way is very simple.

For example, I have this code:

eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('5 a(e){b 2=e.9,3=4.8(e);6 4.c(e)?!1:1===e.d&&2?!0:"g"===3||"5"!==3&&(0===2||"h"==f 2&&2>0&&2-1 7 e)}',18,18,'||t|n|x|function|return|in|type|length|j|var|isWindow|nodeType||typeof|array|number'.split('|'),0,{}))

If I want to de-obfuscate it, I will replace eval with document.write.

Next, you can format it here http://www.jspretty.com/

Video tutorial:









Leave a Comment