j4k0xb / webcrack

Deobfuscate obfuscator.io, unminify and unpack bundled javascript
https://webcrack.netlify.app
MIT License
647 stars 73 forks source link

Webpack refactor #50

Open j4k0xb opened 5 months ago

j4k0xb commented 5 months ago

closes https://github.com/j4k0xb/webcrack/issues/6 closes https://github.com/j4k0xb/webcrack/issues/30 closes #33 closes #66 closes #68 closes #95

supersedes #31

netlify[bot] commented 5 months ago

Deploy Preview for webcrack ready!

Name Link
Latest commit 4cc7b2cc816027333c66ce5a5c7917a8c8fe8c52
Latest deploy log https://app.netlify.com/sites/webcrack/deploys/65b7fabe3dd73b000815526e
Deploy Preview https://deploy-preview-50--webcrack.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

mochaaP commented 5 months ago

Should also strip the __esModule property? This still got emitted currently:

Object.defineProperty(exports, "__esModule", {
  value: true
});
mochaaP commented 5 months ago

Also, these JSON imports and external imports weren't resolved as they should? They still emit a .js file instead of .json or inlining the import image

j4k0xb commented 5 months ago

Should also strip the __esModule property? This still got emitted currently:

Done

Also, these JSON imports and external imports weren't resolved as they should? They still emit a .js file instead of .json or inlining the import

emitting .json is now also implemented externals are properly resolved (by ignoring) but not inlined yet

mochaaP commented 5 months ago

also, export statements aren't transformed. they are firstly all initialized within a single VariableAssignment to undefined, then get assigned the actual value later.

j4k0xb commented 5 months ago

thats specific to typescript: https://www.typescriptlang.org/play?module=1#code/KYDwDg9gTgLgBAG2PAhnAvHAjAbiA this PR is mostly about fixing the webpack issues themselves but it could be implemented later

mochaaP commented 5 months ago

acked

j4k0xb commented 5 months ago

Externals are inlined now:

// 0: module.exports = require("worker_threads");
// 1: var tmp = __webpack_require__(0); ...
// 1 gets changed to:
import { MessageChannel, parentPort, Worker, workerData } from "worker_threads";

And import/export paths are properly resolved again for existing modules: import * as json from "./1.json"; instead of import * as json from "1";

mochaaP commented 5 months ago

:thinking: is anything still blocking this pr?

j4k0xb commented 5 months ago

yeah there are a couple issues like creating multiple conflicting import { a } from didn't have much time recently to work on it

mochaaP commented 5 months ago

👌

mochaaP commented 5 months ago

yeah there are a couple issues like creating multiple conflicting import { a } from didn't have much time recently to work on it

my few cents: generate names like import { a as a$chunkId$ } from './chunkId.js';

youdie323323 commented 3 weeks ago

interestingly when enable the mangle option its cause an error 🤔

obfuscated.txt https://github.com/j4k0xb/webcrack/assets/131268899/c30c8aa3-0b6e-4fef-af9f-6916810920e3

also it isnt unbundle files