How to deobfuscate or decode or unminify JavaScript code

Md. Mahim Bin Firoj
1 min readSep 14, 2023
image credit: softwebtuts.com
eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[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}('(0(){4 1="5 6 7 8";0 2(3){9(3)}2(1)})();',10,10,'function|b|something|a|var|some|sample|packed|code|alert'.split('|'),0,{}))

How will you know this is javascript code?

When you see, eval(function(p,a,c,k,e,r), replace, while, new RegExp are used then it is JavaScript code. Or you can verify this by using various online tools. Even in medium, when you paste this in the code block,

Medium will auto detect this is as javascript code.

Anyway when you see this eval(function(p,a,c,k,e,r) then you should go to the below sites for unpacking the code.

You can also use the following site to see it decodes or not.

Thanks. Please Subscribe below.

LinkedIn:

https://www.linkedin.com/in/md-mahimbin-firoj-7b8a5a113/

YouTube:

--

--