Apr
10
2012

Dean Edwards Packer exposed.

Have you ever packed code and misplaced the original? Sadly, so have I.

Well after really looking at the packer for the first time the solution to decode it is painfully easy!

The secret lies in the eval() function

That is the function that allows the JavaScript engine to make sense of the code from Dean Edwards packer function. Replacing that function is what will allow us to make sense of the code.

So using JavaScript (mootools in this example) we can do something super simple such as:

Prep Work

/**
  * Open your packed code in your fav IDE.
  * Remove the opening eval(
  * than at the end of the string remove the );
  * copy what is left. (minus any comments, other JS functions etc...)
**/

Core HTML

<textarea id="decoded"></textarea>

Core Javascript (mooTools)

var decoder = function() {
    $('decoded').set('value', PASTE_YOUR_CODE_HERE);
}

window.addEvent('domready' , decoder);

Run the code and behold your unPacked Javascript!

Complete code example:

<!doctype html>
<head>
	<title>Javascript UnPacker</title>
	<script src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script>
	<script>
		var decoder = function() {
		    $('decoded').set('value', PASTE_YOUR_CODE_HERE);
		}
		window.addEvent('domready' , decoder);
	</script>
	<style>
		body {
			margin:0;
			padding:0;
		}
		textarea {
			display: block;
			height: 500px;
			margin: 12px auto;
			width: 80%;
		}
		p {
			text-align: center;
		}
	</style>
</head>
<body>
	<p>Copy your code below and use it here: <a href="http://jsbeautifier.org/">Beautify JavaScript</a>
	<textarea id="decoded"></textarea>
</body>
</html>

2 Comments + Add Comment

Leave a comment

Show/Hide Footer Actions

Status: Available for your project.