hbctool
A command-line interface for disassembling and assembling the Hermes Bytecode.
Since the React Native team created their own JavaScript engine (named Hermes) for running the React Native application, the JavaScript source code is often compiled to the Hermes bytecode. In the penetration test project, I found that some React Native applications have already been migrated to the Hermes engine. It is really head for me to analyze or patch those applications. Therefore, I created hbctool for helping any pentester to test the Hermes bytecode.
Hermes is an open-source JavaScript engine optimized for running React Native apps on Android. For many apps, enabling Hermes will result in improved start-up time, decreased memory usage, and smaller app size. At this time Hermes is an opt-in React Native feature, and this guide explains how to enable it.
Special thanks to ErbaZZ and Jusmistic for helping me research and develop this tool.
For more information, please visit:
https://suam.wtf/posts/react-native-application-static-analysis-en/
Screenshot
This video with MP4 format can be found at /image/hbctool_example.mp4.
Installation
To install hbctool, simply use pip:
pip install hbctool
Usage
Please run hbctool --help to show the usage.
hbctool --help
A command-line interface for disassembling and assembling
the Hermes Bytecode.
Usage:
hbctool disasm <HBC_FILE> <HASM_PATH>
hbctool asm <HASM_PATH> <HBC_FILE>
hbctool --help
hbctool --version
Operation:
disasm Disassemble Hermes Bytecode
asm Assemble Hermes Bytecode
Args:
HBC_FILE Target HBC file
HASM_PATH Target HASM directory path
Options:
--version Show hbctool version
--help Show hbctool help manual
Examples:
hbctool disasm index.android.bundle test_hasm
hbctool asm test_hasm index.android.bundle
For Android, the HBC file normally locates at
assetsdirectory withindex.android.bundlefilename.
Support
hbctool currently supports the following Hermes Bytecode version:
- Hermes Bytecode version 59
- Hermes Bytecode version 62
- Hermes Bytecode version 74
- Hermes Bytecode version 76
Contribution
Feel free to create an issue or submit the merge request. Anyway you want to contribute this project. I'm very happy about it.
However, please run the unit test before submiting the pull request.
cd hbctool
python test.py
I use poetry to build this tool. To build it yourself, simply execute:
poetry install
Next Step
- Add the other Hermes bytecode versions
- Create a class abstraction
- Support overflow patching
- Do all TODO, NOTE, FIXME in source code
Metadata
Release files for hbctool 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hbctool-0.1.5.tar.gz | 9.4 MB | Without provenance | Details for hbctool-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hbctool-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for hbctool-0.1.5-py3-none-any.whl |
Total release size: 19.2 MB
Release files / hbctool-0.1.5.tar.gz
| Download URL | hbctool-0.1.5.tar.gz |
|---|---|
| Size | 9.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30aeb050095ba507da2ed26ea8e64a75cd63d459d0db2eeb99e189fb8421c8a3
|
|
BLAKE2b-256 checksum How to use checksums |
a585aad264ee4e6dbf58fa751bd026472d7d81bff0860c267228dabee7c2a9ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.10 Linux/5.11.0-34-generic
|
Release files / hbctool-0.1.5-py3-none-any.whl
| Download URL | hbctool-0.1.5-py3-none-any.whl |
|---|---|
| Size | 9.8 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba40d3d1997efcc5206fc1ccff715ec3807d5ad051eec14a278cc351481623d8
|
|
BLAKE2b-256 checksum How to use checksums |
db55dd87db8b14263bee85ca76056a541e06497c5491e2c0fcc091ca62baa9df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.8.10 Linux/5.11.0-34-generic
|
Security for hbctool 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.