backendrulz/javascript-unpacker

PHP helper that makes easy to unpack JavaScript code packed by Dean Edwards packer tool

Maintainers

Package info

github.com/backendrulz/JavaScriptUnpacker

pkg:composer/backendrulz/javascript-unpacker

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

v1.1.0 2026-02-16 01:55 UTC

This package is not auto-updated.

Last update: 2026-04-28 02:06:50 UTC


README

Makes it easy to unpack JavaScript code packed by Dean Edwards packer tool. Supports all known encodings. The input script may contain multiple encoded code blocks, mixed with non-encoded code, and supports repeatedly encoded code.

Installation via Composer

composer require "backendrulz/javascript-unpacker"

Usage

echo JavaScriptUnpacker::unpack(file_get_contents('/path/to/packed.js'));

Unpack JavaScript via PHP eval(function(p,a,c,k,e,d)

$js =<<<JS
eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0.1(\'2 3!\');',4,4,'console|log|Hello|world'.split('|'),0,{}));
JS;

echo JavaScriptUnpacker::unpack($js);
// output: console.log('Hello world!');;

Requirements

PHP >= 8.3

Testing

composer test

License

MIT