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:
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 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