A (terrible) Python wrapper for hlbc
Project description
hlbc-python
A (terrible) Python wrapper for hlbc - A Hashlink bytecode disassembler and decompiler.
Installation
pip install hlbc
Usage
Before running this example, download either the prebuilt bytecode or the source code of the Clazz test file and place the compiled bytecode in the same directory as the script.
import hlbc
# Open and disassemble a file
code = hlbc.Bytecode("./Clazz.hl")
# Get the debug files
print(code.get_debug_files())
# > ['Clazz.hx', 'C:\\HaxeToolkit\\haxe\\std/hl/_std/Std.hx', 'C:\\HaxeToolkit\\haxe\\std/hl/_std/String.hx', ... '?']
# Get all functions from a specific debug file in the bytecode
print(code.get_functions("Clazz.hx"))
# > ['fn main@22 () -> void', 'fn method@23 (Clazz) -> i32', 'fn <none>@337 ((f64, f64) -> i32, i32, i32) -> i32', ...]
# Decompile a single function by index
print(code.decompile("23"))
# > static function method(_: Clazz): Int {
# > return 42;
# > }
# Stub a function
print(code.stub("23"))
# > static function method(_: Clazz): Int {}
Notes
- Any errors will be raised back to Python as simple
Exceptions, but this is subject to change. - The
Bytecodeclass is thread-safe. You can use the same instance multiple times in different threads. It also doesn't hold the file open, so you can create multiple instances of it with the same file.
Credits
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hlbc-0.5.0.tar.gz
(28.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
hlbc-0.5.0-cp310-none-win_amd64.whl
(290.3 kB
view details)
File details
Details for the file hlbc-0.5.0.tar.gz.
File metadata
- Download URL: hlbc-0.5.0.tar.gz
- Upload date:
- Size: 28.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21c8b0a3bdde506b588094e61ee51789c8e5485b72b70544da6504936f73f815
|
|
| MD5 |
9fa42d154731130ae16ca7e89472bb30
|
|
| BLAKE2b-256 |
279d357b9d2a8848308455725066f8e08e4d27e678616171226ddfa812dd03d7
|
File details
Details for the file hlbc-0.5.0-cp310-none-win_amd64.whl.
File metadata
- Download URL: hlbc-0.5.0-cp310-none-win_amd64.whl
- Upload date:
- Size: 290.3 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5feed59051c95c8a7a959c9915f23b2cd50865a29167906a766dc25b2940e300
|
|
| MD5 |
3bee5f6c829e7c2c105ec8d2d09e2eec
|
|
| BLAKE2b-256 |
cce50be193cacfe2e4f8e918b45b6cde02dabfa52ce78eef213cd3a48a595584
|