mirror of
https://github.com/radareorg/r2hermes.git
synced 2026-11-08 08:49:43 -10:00
Compare commits
1
Commits
main
...
rebrandcli
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
991cc90760 |
No files matched your search
@@ -7,19 +7,19 @@ Use this guide to navigate the code, extend features, and avoid common pitfalls
|
||||
**Repo Layout**
|
||||
- `src/lib` C sources for the library
|
||||
- `src/r2/` radare2 plugin sources (optional)
|
||||
- `src/tool/` source code of the libhbctool program
|
||||
- `src/tool/` source code of the r2hermes program
|
||||
- `include/` public and internal headers
|
||||
- `bin/` where the libhbctool CLI program is compiled
|
||||
- `bin/` where the r2hermes CLI program is compiled
|
||||
- `build/` static library and objects
|
||||
- `tests/` testsuite based on `r2r` tool
|
||||
|
||||
**Build & Run**
|
||||
- Build library + libhbctool cli tool: `make` (no debug messages)
|
||||
- Build library + r2hermes cli tool: `make` (no debug messages)
|
||||
- Build with address sanitizer checks: `make asan`
|
||||
- Build library + radare2 plugins + user-install: `make r2`
|
||||
- Format the source with `make fmt` (requires `clang-format-radare2`)
|
||||
- Clean: `make clean`
|
||||
- Run CLI: `./bin/libhbctool <command> <input> [output]`
|
||||
- Run CLI: `./bin/r2hermes <command> <input> [output]`
|
||||
|
||||
**Public API**
|
||||
- Primary header: `include/hbc/hbc.h`
|
||||
|
||||
@@ -19,17 +19,17 @@ DECOMPILE_SRC = $(wildcard $(SRC_DIR)/decompilation/*.c)
|
||||
OPCODES_SRC = $(filter-out $(SRC_DIR)/opcodes/%.inc.c,$(wildcard $(SRC_DIR)/opcodes/*.c))
|
||||
LIB_SRC = $(UTILS_SRC) $(PARSERS_SRC) $(DISASM_SRC) $(DECOMPILE_SRC) $(OPCODES_SRC) \
|
||||
$(SRC_DIR)/hbc.c $(SRC_DIR)/literals_api.c $(SRC_DIR)/opcodes/encoder.c $(SRC_DIR)/opcodes/decoder.c $(SRC_DIR)/r2.c
|
||||
MAIN_SRC = src/tool/libhbctool.c
|
||||
MAIN_SRC = src/tool/r2hermes.c
|
||||
HBC_HEADERS = $(shell find include -name '*.h')
|
||||
|
||||
## Object files
|
||||
LIB_OBJ = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(LIB_SRC))
|
||||
LIB_RELOC_OBJ = $(BUILD_DIR)/libhbc_all.o
|
||||
MAIN_OBJ = $(BUILD_DIR)/libhbctool.o
|
||||
MAIN_RELOC_OBJ = $(BUILD_DIR)/libhbctool_all.o
|
||||
MAIN_OBJ = $(BUILD_DIR)/r2hermes.o
|
||||
MAIN_RELOC_OBJ = $(BUILD_DIR)/r2hermes_all.o
|
||||
|
||||
## Artifacts
|
||||
BIN_FILE = $(BIN_DIR)/libhbctool
|
||||
BIN_FILE = $(BIN_DIR)/r2hermes
|
||||
STATIC_LIB = $(BUILD_DIR)/libhbc.a
|
||||
|
||||
# Include paths
|
||||
@@ -74,7 +74,7 @@ $(MAIN_OBJ): $(MAIN_SRC) $(HBC_HEADERS) | $(VH)
|
||||
$(CC) $(CFLAGS) -fvisibility=default $(INCLUDES) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR) $(BIN_DIR)/libhbctool
|
||||
rm -rf $(BUILD_DIR) $(BIN_DIR)/r2hermes
|
||||
rm -f $(VH)
|
||||
$(MAKE) -C src/r2 clean
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ r2pm -ci r2hermes
|
||||
|
||||
### From source
|
||||
|
||||
Build the `libhbctool` cli tool and install the `radare2` plugin:
|
||||
Build the `r2hermes` cli tool and install the `radare2` plugin:
|
||||
|
||||
```bash
|
||||
make && make user-install
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
Hermes bytecode tools and radare2 plugins
|
||||
r2hermes provides libhbctool, libhbc, and radare2 plugins to inspect, disassemble, assemble, and decompile React Native Hermes bytecode files.
|
||||
r2hermes provides libhbc, and radare2 plugins to inspect, disassemble, assemble, and decompile React Native Hermes bytecode files.
|
||||
Vendored
+1
-1
@@ -24,7 +24,7 @@ else
|
||||
cd ../.. && $(MAKE) clean && $(MAKE) && $(MAKE) -C src/r2
|
||||
rm -rf root
|
||||
mkdir -p root/usr/bin
|
||||
cp -f ../../bin/libhbctool root/usr/bin/
|
||||
cp -f ../../bin/r2hermes root/usr/bin/
|
||||
mkdir -p root/usr/lib
|
||||
cp -f ../../build/libhbc.a root/usr/lib/
|
||||
mkdir -p root/usr/include
|
||||
|
||||
+5
-5
@@ -93,12 +93,12 @@ install_subdir('include/hbc',
|
||||
install_dir: 'include',
|
||||
)
|
||||
|
||||
# libhbctool CLI
|
||||
libhbctool_src = files('src/tool/libhbctool.c')
|
||||
# r2hermes CLI
|
||||
r2hermes_src = files('src/tool/r2hermes.c')
|
||||
|
||||
executable(
|
||||
'libhbctool',
|
||||
libhbctool_src,
|
||||
'r2hermes',
|
||||
r2hermes_src,
|
||||
link_with: libhbc,
|
||||
include_directories: include_dirs,
|
||||
c_args: ['-pedantic'],
|
||||
@@ -184,7 +184,7 @@ endif
|
||||
# Summary
|
||||
message('r2hermes build summary:')
|
||||
message(' Library: libhbc')
|
||||
message(' CLI: libhbctool')
|
||||
message(' CLI: r2hermes')
|
||||
if r2_core.found()
|
||||
message(' radare2 plugins: core_hbc (includes arch, bin, asm)')
|
||||
message(' Plugin install path: ' + r2_plugdir)
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ Result _hbc_generate_r2_script(const char *input_file, const char *output_file)
|
||||
|
||||
/* Generate r2 script header */
|
||||
fprintf (out, "# R2 script for Hermes bytecode file: %s\n", input_file);
|
||||
fprintf (out, "# Generated by libhbctool\n\n");
|
||||
fprintf (out, "# Generated by r2hermes\n\n");
|
||||
|
||||
/* Add basic file info as comments */
|
||||
fprintf (out, "# Hermes File Version: %u\n", reader.header.version);
|
||||
|
||||
File renamed without changes.
Reference in new issue
Block a user