Decompile a Hermes React Native Binary
Pull APK from device
adb shell pm list packages | grep <app_name>
adb shell pm path <package_name>
adb pull /data/app/<package_name>-<random>/base.apk .
Decompile APK resources
apktool d base.apk -o output_folder
Locate React Native bundle
cd output_folder/assets/ ls
Check if Hermes bytecode
file index.android.bundle
Get Hermes decompiler
git clone https://github.com/cognisys/hermes-dec.git cd hermes-dec pip3 install -r requirements.txt
Disassemble Hermes bytecode
python3 hbc_disassembler.py ../index.android.bundle disasm_out
Decompile to JavaScript
python3 hbc_decompiler.py ../index.android.bundle decompiled_out
(Optional) Beautify/Deobfuscate JS
npx prettier --write decompiled_out/*.js
Last updated
Was this helpful?