From b3a184d7325400bbb75c5abe9b71eb595cfb7d56 Mon Sep 17 00:00:00 2001 From: j4k0xb <55899582+j4k0xb@users.noreply.github.com> Date: Sun, 4 Jun 2023 17:39:19 +0200 Subject: [PATCH] docs: link to documentation site --- README.md | 133 ++---------------------------------------------------- 1 file changed, 3 insertions(+), 130 deletions(-) diff --git a/README.md b/README.md index 175abc97..4c75dd01 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,9 @@

webcrack

-This projects aims to combine the best features of other javascript deobfuscators and unpackers into one tool, while improving on them in the following ways: +webcrack is a tool for reverse engineering javascript. It can deobfuscate, unminify, and unpack bundles, to resemble the original source code as much as possible. + +Try it in the [online playground](https://webcrack.netlify.app/) or view the [documentation](https://webcrack.netlify.app/docs). - 🚀 **Performance** - Especially for large files - 🛡️ **Safety** - Considers variable references and scope @@ -17,132 +19,3 @@ This projects aims to combine the best features of other javascript deobfuscator - ✍🏻 **Readability** - Removes obfuscator/bundler artifacts - ⌨️ **TypeScript** - All code is written in TypeScript - 🧪 **Tests** - To make sure nothing breaks - -## Installation - -```sh -npm install -g webcrack -``` - -## Usage - -Online version: [webcrack.netlify.app](https://webcrack.netlify.app/) - -```text -Usage: webcrack [options] - -Deobfuscate, unminify and unpack bundled javascript - -Arguments: - file input file - -Options: - -V, --version output the version number - -o, --output output directory (default: "webcrack-out") - -f, --force overwrite output directory - -h, --help display help for command -``` - -```js -import { webcrack } from 'webcrack'; - -console.log((await webcrack('const a = 1+1;')).code); -``` - -## Deobfuscation - -### [obfuscator.io](https://obfuscator.io) - -Can be used to deobfuscate code obfuscated with the following options: - -- String Array - - Rotate - - Shuffle - - Index Shift - - Calls Transform - - Variable/Function Wrapper Type - - None/Base64/RC4 Encoding - - Split Strings -- Other Transformations - - Compact - - Simplify - - Numbers To Expressions - - Control Flow Flattening - - Dead Code Injection -- Disable Console Output -- Self Defending -- Debug Protection -- Domain Lock - -### General/Unminifying - -```js -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(); -void 0; // undefined -'red' === color; // color === 'red' -``` - -## JSX Decompiling - -Convert react components to JSX. - -```js -React.createElement( - 'div', - null, - React.createElement('span', null, 'Hello ', name) -); -``` - --> - -```jsx -
- Hello {name} -
-``` - -## Bundle Unpacking - -Currently supported bundlers: **webpack v4, v5**, **browserify** - -- Each module of a bundle gets extracted into a separate file -- The require/runtime code gets transformed -- Modules may get converted to ESM -- You can modify the unpacked modules and bundle them again¹: `npx webpack-cli ./webcrack-out` - -¹: only for webpack bundles, may require a custom config - -### Path-Mapping - -Useful for reverse-engineering and tracking changes across multiple versions of a bundle. - -The values are matchers. If they match a node in the AST, the module's path is changed to the corresponding key. - -Example: - -```js -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}$'), - 'node_modules/lodash/index.js': m.memberExpression( - m.identifier('lodash'), - m.identifier('map') - ), - }), -}); -result.save('output-dir'); -``` - -See [@codemod/matchers](https://github.com/codemod-js/codemod/tree/main/packages/matchers#readme) for more information about matchers.