Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / Javascript

Decoder for Dean Edwards' JavaScript Packer

3.40/5 (3 votes)
4 Mar 2010CPOL 1   915  
This short article shows how to decrypt and beautify code encoded with Dean Edwards' Javascript Packer.

Introduction

If you are a website admin, you might want to know if the JavaScript provided to you is malicious. This code will decrypt the JavaScript code encrypted with Dean Edwards' Javascript Packer. JavaScript encoded with Dean Edwards' JavaScript Packer begins with this line:

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

Using the Code

This code is a simple HTML page with few lines of JavaScript.

HTML
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Decoder for Dean Edwards' Javascript Packer</title>
<script language="javascript" type="text/javascript">
function Decode() {
eval("var value=String" + txtInput.value.slice(4));
txtOutput.value = value;
}
</script>
</head>
<body>
<div>Input</div>
<textarea id="txtInput" style="width: 632px; height: 253px"></textarea>
<br />
<input id="btnDecode" style="width: 198px" 
type="button" value="Decode" onclick="Decode()" />
<br />
<div>Output</div>
<textarea id="txtOutput" style="width: 630px; height: 273px"></textarea>
<br />
<a href="http://dean.edwards.name/packer/">Dean Edwards' JS packer</a>
<br />
<a href="http://jsbeautifier.org/">Javascript unpacker and beautifier</a>
</body>
</html>

Points of Interest

After you decode the JavaScript with the page, beautify it with Javascript unpacker and beautifier.

You can read more about Dean Edwards' JS packer's inner workings on Golan Yosef blog.

History

  • 5th March, 2010: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)