Home

Skip to Content Skip to Navigation

Now, I know why most people compress they're js files, because they don't won't people to steal the code, but it must be the case that sometimes, like what happened to me today, you've just gotta crack that encryption. I'm a bit worried about posting this, so I hope it's in someway new and/or useful.

Basically we need to go into a js file that was given to us, in order to change a few DOM-based functions. I opened up the file, and lo and behold, this was the first few characters…

eval(function(p,a,c,k,e,d){…

This is the trademark sign of the packer by Dean Edwards. I'd seen this a few more times, and used it myself too, but never had to decode it before. So I did a little searching and found a nice method of decoding it:

  1. Use the bookmarklet found here whilst on the packer encode/decode page. This will enable the decode button and remove the read-only limitation on the bottom text area.
  2. Paste your encoded code into the bottom textarea and press decode. In theory, you should get the original code, but without line breaks, whitespace etc.
  3. To put the whitespace back in, I used 'Javascript Tidy'. Whilst not 100% successful (depends on your browser it seems somewhat), is did tidy up the majority of the code.Found a better beautifer thanks to one of my comments: JS Beautifier, so use this to re-add the whitespace.

So yeah, that's how to decode the p,a,c,k,e,r compressor. Theres other ways too, apparently replacing the eval function with alert works too, didn't seem too for me unfortunately.

5 Responses to Decompressing (p,a,c,k,e,d) Javascript Files

Avatar

al3loo

September 5th, 2008 at 6:27 pm

Hi,

This is a nice method.. but how can I use it I think they disable that code.. is there any new one ?!
or any new site to decompres the javascript files ?

Thanks in advance
Regards,

Avatar

al3loo

September 5th, 2008 at 6:50 pm

Its work fine with:
eval=alert;

Thanks very much !

Avatar

Leo Woods

February 27th, 2009 at 1:25 am

That is very useful thank you.

I found this was slightly more successful for prettying up the Javascript though - http://jsbeautifier.org/

Avatar

Mohaine

October 22nd, 2009 at 7:30 am

As well as slowing down code theft, it’s also useful to compress js files for performance - simply to have smaller files to download to the browser.

Avatar

james

May 22nd, 2010 at 6:06 pm

Please note:
http://jsbeautifier.org/

Seems to decode AND beautify packed code :)

Comment Form

Back to top