summaryrefslogtreecommitdiff
path: root/rust/plugin_examples/data_renderer/README.md
diff options
context:
space:
mode:
authorLukBukkit <luk.bukkit@gmail.com>2025-04-24 16:20:32 +0000
committerMason Reed <mason@vector35.com>2025-10-07 16:47:33 -0400
commit64633f61f7b9e03be9437b5f4896bbe122f7a7a2 (patch)
tree8fafed1395a8d2e29e5a6b8b7f7d7b8a2af2731a /rust/plugin_examples/data_renderer/README.md
parente6e4ebea5d0ea7842766c7e686e0dfd45cb54bb8 (diff)
[Rust] Implement custom data renderer API
Also adds an example plugin and misc rust fixes / documentation. This is a continuation of https://github.com/Vector35/binaryninja-api/pull/6721 Co-authored-by: rbran <lgit@rubens.io>
Diffstat (limited to 'rust/plugin_examples/data_renderer/README.md')
-rw-r--r--rust/plugin_examples/data_renderer/README.md63
1 files changed, 63 insertions, 0 deletions
diff --git a/rust/plugin_examples/data_renderer/README.md b/rust/plugin_examples/data_renderer/README.md
new file mode 100644
index 00000000..794b93b9
--- /dev/null
+++ b/rust/plugin_examples/data_renderer/README.md
@@ -0,0 +1,63 @@
+# Data Renderer Example
+
+This example implements a simple data renderer for the Mach-O load command LC_UUID.
+You can try the renderer by loading the `/bin/cat` binary from macOS.
+
+We're implementing a functionality similar to the one described in the Python data renderer blog post:
+https://binary.ninja/2024/04/08/customizing-data-display.html.
+
+## Building
+
+```sh
+# Build from the root directory (binaryninja-api)
+cargo build --manifest-path rust/plugin_examples/data_renderer/Cargo.toml
+# Link binary on macOS
+ln -sf $PWD/target/debug/libexample_data_renderer.dylib ~/Library/Application\ Support/Binary\ Ninja/plugins
+```
+
+## Result
+
+The following Mach-O load command be will be transformed from
+
+```c
+struct uuid __macho_load_command_[10] =
+{
+ enum load_command_type_t cmd = LC_UUID
+ uint32_t cmdsize = 0x18
+ uint8_t uuid[0x10] =
+ {
+ [0x0] = 0x74
+ [0x1] = 0xa0
+ [0x2] = 0x3a
+ [0x3] = 0xbd
+ [0x4] = 0x1e
+ [0x5] = 0x19
+ [0x6] = 0x32
+ [0x7] = 0x67
+ [0x8] = 0x9a
+ [0x9] = 0xdc
+ [0xa] = 0x42
+ [0xb] = 0x99
+ [0xc] = 0x4e
+ [0xd] = 0x26
+ [0xe] = 0xa2
+ [0xf] = 0xb7
+ }
+}
+```
+
+into the following representation
+
+```c
+struct uuid __macho_load_command_[10] =
+{
+ enum load_command_type_t cmd = LC_UUID
+ uint32_t cmdsize = 0x18
+ uint8_t uuid[0x10] = UUID("74a03abd-1e19-3267-9adc-42994e26a2b7")
+}
+```
+
+You can compare the shown UUID with the output of otool:
+```sh
+otool -arch all -l /bin/cat
+``` \ No newline at end of file