Skip to content

Commit 9db4108

Browse files
committed
[WARP] Add example of batch processing using the headless Rust API
1 parent 023ec07 commit 9db4108

File tree

7 files changed

+427
-43
lines changed

7 files changed

+427
-43
lines changed

Cargo.lock

Lines changed: 182 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ members = [
2222
"plugins/svd/demo",
2323
"plugins/warp",
2424
"plugins/warp/demo",
25+
"plugins/warp/examples/headless",
2526
"plugins/workflow_objc",
2627
"plugins/workflow_objc/demo",
2728
]
2829

2930
[workspace.dependencies]
3031
binaryninja = { path = "rust" }
3132
binaryninjacore-sys = { path = "rust/binaryninjacore-sys" }
33+
warp_ninja = { path = "plugins/warp" }
3234

3335
[profile.release]
3436
lto = "thin"

plugins/warp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ log = "0.4"
1818
itertools = "0.14.0"
1919
dashmap = { version = "6.1", features = ["rayon"]}
2020
rayon = "1.10"
21-
arboard = "3.4"
21+
arboard = {version = "3.4", default-features = false}
2222
walkdir = "2.5"
2323
serde = { version = "1.0", features = ["derive"] }
2424
serde_json = "1.0"

plugins/warp/README.md

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,6 @@
22

33
Provides integration with [WARP](https://github.com/Vector35/warp), more specifically the function identification and associated type information.
44

5-
## Batch Processing
5+
## Documentation
66

7-
`sigem` (see code at `src/bin/sigem.rs`) allows for batch processing binaries for signature generation.
8-
9-
The only real "magic" here is the cross-linking of symbols in archives, this means that static libraries will have much finer constraint matching.
10-
11-
Duplicate functions will be removed to save space, any input will always produce a single output signature file, if you want separate signature files, invoke individually.
12-
13-
### Building
14-
15-
> Assuming you have the following:
16-
> - A compatible Binary Ninja with headless usage (see [this documentation](https://docs.binary.ninja/dev/batch.html#batch-processing-and-other-automation-tips) for more information)
17-
> - Clang
18-
> - Rust (currently tested for 1.83.0)
19-
> - Set `BINARYNINJADIR` env variable to your install directory (see [here](https://docs.binary.ninja/guide/#binary-path) for more details)
20-
21-
1. Clone this repository (`git clone https://github.com/Vector35/binaryninja-api/tree/dev`)
22-
2. Navigate to this plugin (`cd plugins/warp`)
23-
3. Build in release (`cargo build --release`)
24-
25-
If compilation fails because it could not link against binaryninjacore than you should double-check you set `BINARYNINJADIR` correctly.
26-
27-
Once it finishes you now will have a `sigem` binary in `target/release` for use.
28-
29-
### Usage
30-
31-
> Assuming you already have the `sigem` binary and a valid headless compatible Binary Ninja license.
32-
33-
To create a signature file simply pass the input as the first positional argument to `sigem`:
34-
35-
- A regular binary
36-
- An archive of binaries (`.a`, `.lib`, `.rlib`)
37-
- A directory of binaries
38-
- A BNDB
39-
40-
Example: `./sigem mylibrary.a` or `./sigem ./all-libs/`
41-
42-
Once its finished you should see a `.sbin` file next to the input file, this can be moved into the corresponding signature folder (see the [user docs](https://docs.binary.ninja/dev/annotation.html?h=install+path#signature-library) for more info)
43-
44-
If you encounter malloc errors or instability try and adjust the number of parallel threads using `RAYON_NUM_THREADS` environment variable (ex. `RAYON_NUM_THREADS=1 ./sigem mylib.a`)
7+
Documentation is available in the [User Guide](../../docs/guide/warp.md).
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "warp_headless"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
clap = { version = "4.5", features = ["derive"] }
8+
indicatif = "0.18.2"
9+
warp_ninja.workspace = true
10+
binaryninjacore-sys.workspace = true
11+
binaryninja.workspace = true
12+
log = "0.4"
13+
env_logger = "0.11"
14+
ctrlc = "3.5"

0 commit comments

Comments
 (0)