> For the complete documentation index, see [llms.txt](https://sec88.0x88.online/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sec88.0x88.online/android-appsec/decompile-a-hermes-react-native-binary.md).

# Decompile a Hermes React Native Binary

1. **Pull APK from device**

```bash
adb shell pm list packages | grep <app_name>
adb shell pm path <package_name>
adb pull /data/app/<package_name>-<random>/base.apk .
```

1. **Decompile APK resources**

   ```bash
   apktool d base.apk -o output_folder
   ```
2. **Locate React Native bundle**

   ```bash
   cd output_folder/assets/
   ls
   ```
3. **Check if Hermes bytecode**

   ```bash
   file index.android.bundle
   ```
4. **Get Hermes decompiler**

   ```bash
   git clone https://github.com/cognisys/hermes-dec.git
   cd hermes-dec
   pip3 install -r requirements.txt
   ```
5. **Disassemble Hermes bytecode**

   ```bash
   python3 hbc_disassembler.py ../index.android.bundle disasm_out
   ```
6. **Decompile to JavaScript**

   ```bash
   python3 hbc_decompiler.py ../index.android.bundle decompiled_out
   ```
7. **(Optional) Beautify/Deobfuscate JS**

   ```bash
   npx prettier --write decompiled_out/*.js
   ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sec88.0x88.online/android-appsec/decompile-a-hermes-react-native-binary.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
