:card_file_box: A javascript debundler. Takes a Browserify or Webpack bundle and recreates the initial, pre-bundled source.
This is a tool built to unpack javascript bundles prudiced by webpack and browserify.
This was a research project that is no longer maintained. I built to help me understand how javascript bundles are strutured. It works in a labratory environment most of the time, but often fails on real-world javascript bundles. Itβs been a while since I worked on this project so if you run into issues, I might not really be able to help you out all that much.
Reasons vary, but this tool was originally developed to help me with a reverse engineering project.
Needless to say, sifting through minified bundles to try and figure out how a service works isnβt
fun and is a lot easier when that bundle is broken into files and those files have semantic names.
npm i -g debundle
$ debundle
Usage: debundle [input file] {OPTIONS}
Options:
--input, -i Bundle to debundle
--output, -o Directory to debundle code into.
--config, -c Configuration file
$ curl https://raw.githubusercontent.com/1egoman/debundle/master/test_bundles/browserify/bundle.js > bundle.js
$ curl https://raw.githubusercontent.com/1egoman/debundle/master/test_bundles/browserify/debundle.config.json > debundle.config.json
$ cat debundle.config.json
{
"type": "browserify",
"knownPaths": {}
}
$ debundle -i bundle.js -o dist/ -c debundle.config.json
$ tree dist/
dist/
βββ index.js
βββ node_modules
βββ number
βΒ Β βββ index.js
βββ uuid
βββ index.js
βββ lib
βΒ Β βββ bytesToUuid.js
βΒ Β βββ rng.js
βββ v1.js
βββ v4.js
4 directories, 7 files
{
"type": "browserify",
"entryPoint": 1,
"knownPaths": {}
}
(To debundle a simple Webpack bundle, replace browserify
the above configuration with webpack
)
A configuration can have a number of flags - they are documented in DOCS.md.
No. There a bunch of metadata thatβs lost when bundling:
package.json
settings for each node_module
and the root package.1.js
) unless manually overridden.Not officially. However, if a bundle shares the same type module layout as Browserify or Webpack it
may be possible to set the moduleAst
configuration option to point to the location of the modules.
npm install
- that should be it../src/index.js
(thatβs how you run it!)test_bundles/
. A script, test_bundles/run_test.sh
can run thedist/
. (CI will, as part of runningnpm test
Some companies specify in their terms of service that their code cannot be βreverse engineeredβ.
Debundling can definitely (depending on how youβre using the code) fall under that umbrella.
Understand what you are doing so you donβt break any agreements π