A lot of javascript gets packed up these days with Dean Edwards’ amazing Packer functionality. This is great for delivery and optimization, but hard for people to make minor adjustments or to just peak at the code to learn some new techniques. It’s also quite frustrating if you just want to tweak a bit of code you just purchased, but the original author doesn’t reply to your inquiries. So here’s a short and simple way to turn/decode “packed” javascript into plain readable javascript.
- Bookmark the following javascript link so you can run it from any site: Enable Decode Button
- Now go to the packer website and click the bookmarked link you just created. The “copy” text area should now be writable and the decode button activated. Now copy in your packed and obfuscated code and hit decode.
- At this point you pretty much have what you need, but for better legibility head over here, paste your decoded code in and hit beautify.
After you’re done making changes it’s probably best to pack the code again, because it does have its advantages (a much smaller file size for example).
Happy coding!
December 13th, 2011 at 12:19 PM
Obsolete, dead links, doesn’t work.
December 13th, 2011 at 12:30 PM
Thanks for letting me know. I’ve updated the “beautify” link.
January 8th, 2012 at 4:51 PM
Got the form with the “copy” area writtable and “decode” button activated, but after pasting single testing obfuscated line of code it says:
error decoding script: Stringnf is not defined
Am I doing something wrong?
Line I am trying if this:
dw_Inf.mg=dw_Inf.fn(‘\x64\x77\x5f\x49\x6e\x66\x2e\x67\x65\x74\x28\x64\x77\x5f\x49\x6e\x66\x2e\x61\x72\x29′);
January 25th, 2012 at 12:46 PM
This particular tutorial is only meant to decode Javascript which has been obfuscated by Dean Edwards’ Packer. Packer-encoded scripts start with: eval(function(p,a,c,k,e,d){e=function(c){ etc.
The line of code you’re trying to decode is encoded a little differently. However, it’s simple to decode. Just wrap the entire thing in a console.log(“”) statement and the script in plain text is printed the the console as: dw_Inf.mg=dw_Inf.fn(‘dw_Inf.get(dw_Inf.ar)′);