nickw444 / rn-debundle

A very basic debundler for Javascript bundles compiled with React Native's bundler
27 stars 3 forks source link

Doesn't work for me #4

Closed udezueoluomachi closed 1 year ago

udezueoluomachi commented 1 year ago

rn-debundle ./resources/assets/index.android.bundle ./debundle

this is the error message that was returned to the console. `C:...\npm\node_modules\rn-debundle\node_modules\yargs\yargs.js:1193 else throw err ^

SyntaxError: Unexpected character '�' at Espree.raise (C:...\npm\node_modules\?[4mrn-debundle?[24m\node_modules\?[4mespree?[24m\lib\espree.js:190:25) at Espree.pp$9.getTokenFromCode (C:...\npm\node_modules\?[4mrn-debundle?[24m\node_modules\?[4macorn?[24m\dist\acorn.js:4708:10)

at Espree.pp$9.readToken (C:...\Roaming\npm\node_modules\?[4mrn-debundle?[24m\node_modules\?[4macorn?[24m\dist\acorn.js:4409:17)
at Espree.pp$9.nextToken (C:\...\Roaming\npm\node_modules\?[4mrn-debundle?[24m\node_modules\?[4macorn?[24m\dist\acorn.js:4400:17)
at Espree.parse (C:\...\npm\node_modules\?[4mrn-debundle?[24m\node_modules\?[4macorn?[24m\dist\acorn.js:554:10)
at Espree.parse (C:\...\npm\node_modules\?[4mrn-debundle?[24m\node_modules\?[4mespree?[24m\lib\espree.js:144:35)
at Object.parse (C:\...\npm\node_modules\?[4mrn-debundle?[24m\node_modules\?[4mespree?[24m\espree.js:134:38)
at Object.main [as handler] (C:\...\npm\node_modules\?[4mrn-debundle?[24m\src\index.js:12:22)
at Object.runCommand (C:\...npm\node_modules\?[4mrn-debundle?[24m\node_modules\?[4myargs?[24m\lib\command.js:240:40)
at Object.parseArgs [as _parseArgs] (C:...\npm\node_modules\?[4mrn-debundle?[24m\node_modules\?[4myargs?[24m\yargs.js:1115:39)

{ index: ?[33m0?[39m, lineNumber: ?[33m1?[39m, column: ?[33m1?[39m }`

OS : WINDOWS 10, NODE VERSION v16.13.0

nickw444 commented 1 year ago

Looks like you're trying to decompile an android React Native bundle - These aren't actually a JS bundle, which explains the reason for getting a syntax error. Android React Native bundles are compiled to Hermes bytecode.

This tool can only handle non-binary JS monolithic React Native Bundles (like the ones produced for iOS builds)

That said;

Since React Native 0.64, Hermes also runs on iOS. To enable Hermes for iOS, edit your ios/Podfile file and make the change illustrated below:

So this tool perhaps may become somewhat obsolete in the future.

https://github.com/P1sec/hermes-dec or https://github.com/bongtrop/hbctool looks like tools which can be used to decompile Hermes bytecode