Skip to content
forked from j4k0xb/webcrack

Deobfuscate, unminify and unpack bundled javascript

License

Notifications You must be signed in to change notification settings

Sorte1/webcrack

 
 

Repository files navigation

webcrack

Test npm license

Deobfuscate, unminify and unpack bundled javascript

Installation

npm install -g webcrack

Usage

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);

Deobfuscations

  • String Array
    • Rotate
    • Shuffle
    • Index Shift
    • Variable/Function Wrapper Type
    • None/Base64/RC4 encoding
  • Numbers To Expressions
  • Split Strings

General/Unminifying

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();

Bundle Unpacking

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.

About

Deobfuscate, unminify and unpack bundled javascript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 70.7%
  • JavaScript 29.3%