Deobfuscate, unminify and unpack bundled javascript
npm install -g webcrack
Usage: webcrack [options] <file>
Arguments:
file input file
Options:
-V, --version output the version number
-o, --output <path> output directory (default: "webcrack-out")
-m, --max-iterations <number> maximum iterations for readability transforms (default: 5)
-f, --force overwrite output directory
-h, --help display help for command
import { webcrack } from 'webcrack';
console.log((await webcrack('const a = 1+1;')).code);
- String Array
- Rotate
- Shuffle
- Index Shift
- Variable/Function Wrapper Type
- None/Base64/RC4 encoding
- Numbers To Expressions
- Split Strings
console['\x6c\x6f\x67']('\x61'); // console.log('a')
x && y && z(); // if (x && y) z();
x || y || z(); // if (!(x || y)) z();
!0; // true
!1; // false
![]; // false
!![]; // true
return a(), b(), c(); // a(); b(); return c();
if ((a(), b())) c(); // a(); if (b()) c();
Extracts each module of a webpack bundle into a separate file and allows the paths to be remapped based on AST matching.
import { webcrack } from 'webcrack';
import { readFileSync } from 'fs';
const result = await webcrack(readFileSync('webpack-bundle.js', 'utf8'), {
mappings: m => ({
'./utils/color.js': m.regExpLiteral('^#([0-9a-f]{3}){1,2}$'),
}),
});
result.save('output-dir');
See @codemod/matchers for more information about the mappings
option.