You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> :warning:**These bindings are in a very early beta, only have partial support for the core APIs and are still actively under development. Compatibility _will_ break and conventions _will_ change! They are being used for core Binary Ninja features however, so we expect much of what is already there to be reliable enough to build on, just don't be surprised if your plugins/scripts need to hit a moving target.**
> :warning: This project requires Rust version `1.83.0`
9
+
## WARNING
8
10
9
-
## Documentation
11
+
These bindings are still actively under development. Compatibility _will_ break and conventions _will_ change!
12
+
It is encouraged that you reference a specific commit to avoid having your plugin/application break when the API changes.
13
+
To specify a specific commit see the cargo documentation [here](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#choice-of-commit).
10
14
11
-
Documentation can be found at https://dev-rust.binary.ninja/
15
+
**MSRV**: The Rust version specified in the `Cargo.toml`.
12
16
13
-
### Offline Documentation
17
+
##Example
14
18
15
-
Offline documentation can be generated like any other rust crate, using `cargo doc`.
:warning: If you're thinking of contributing to the Rust API, we encourage you to join the #rust-api channel in our Slack: https://slack.binary.ninja, especially for large-effort PRs.
40
+
## Getting Started
25
41
26
-
##Dependencies
42
+
### Requirements
27
43
28
44
- Having BinaryNinja installed (and your license registered)
29
45
- Clang
30
46
- Rust
31
47
32
-
## How to use
48
+
### To link to Binary Ninja
49
+
50
+
Writing a standalone executable _or_ a plugin requires that you link to `binaryninjacore` directly. The process of locating that however
51
+
is done for you within the `binaryninjacore-sys` crate. Because linker arguments are _not_ transitive for executables you
- All standalone binaries should call both `binaryninja::headless::init()` and `binaryninja::headless::shutdown()`.
94
-
- Prefer using `binaryninja::headless::Session`, it will call shutdown for you.
95
-
- All standalone binaries need to provide a `build.rs`.
96
-
- Or otherwise provide binaryninjacore to the rpath.
129
+
## Contributing
130
+
131
+
If you're thinking of contributing to the Rust API, we encourage you to join the #rust-api channel in our [Slack](https://slack.binary.ninja), especially for large-effort PRs.
//! This crate is the official [Binary Ninja] API wrapper for Rust.
26
-
//!
27
-
//! [Binary Ninja] is an interactive disassembler, decompiler, and binary analysis platform for reverse engineers, malware analysts, vulnerability researchers, and software developers that runs on Windows, macOS, and Linux. Our extensive API can be used to create and customize loaders, add or augment architectures, customize the UI, or automate any workflow (types, patches, decompilation...anything!).
28
-
//!
29
-
//! If you're just getting started with [Binary Ninja], you may wish to check out the [Getting Started Guide]
30
-
//!
31
-
//! If you have questions, we'd love to answer them in [our public Slack], and if you find any issues, please [file an issue] or [submit a PR].
//! > ⚠️ **These bindings are in a very early beta, only have partial support for the core APIs and are still actively under development. Compatibility _will_ break and conventions _will_ change! They are being used for core Binary Ninja features however, so we expect much of what is already there to be reliable enough to build on, just don't be surprised if your plugins/scripts need to hit a moving target.**
39
-
//!
40
-
//! > ⚠️ This project runs on Rust version `1.83.0`
41
-
//!
42
-
//! ---
43
-
//!
44
-
//! # Examples
45
-
//!
46
-
//! There are two distinct ways to use this crate:
47
-
//! 1. [Writing a Plugin](#writing-a-plugin)
48
-
//! 2. [Writing a Script](#writing-a-script)
49
-
//!
50
-
//! ## Writing a Plugin
51
-
//!
52
-
//! Create a new library (`cargo new --lib <plugin-name>`) and include the following in your `Cargo.toml`:
//! In `lib.rs` you'll need to provide a `CorePluginInit` or `UIPluginInit` function for Binary Ninja to call.
63
-
//!
64
-
//! See [`command`] for the different actions you can provide and how to register your plugin with [Binary Ninja].
65
-
//!
66
-
//! ## Writing a Script:
67
-
//!
68
-
//! "Scripts" are binaries (`cargo new --bin <script-name>`), and have some specific requirements:
69
-
//!
70
-
//! ### build.rs
71
-
//!
72
-
//! Because [the only official method of providing linker arguments to a crate is through that crate's `build.rs`], all scripts need to provide their own `build.rs` so they can probably link with Binary Ninja.
73
-
//!
74
-
//! The most up-to-date version of the suggested [`build.rs` is here].
75
-
//!
76
-
//! ### `main.rs`
77
-
//!
78
-
//! Standalone binaries need to initialize Binary Ninja before they can work. You can do this through [`headless::Session`], or [`headless::init()`] at start and [`headless::shutdown()`] at shutdown.
79
-
//!
80
-
//! ```no_run
81
-
//! // This loads all the core architecture, platform, etc plugins
82
-
//! // Standalone executables need to call this, but plugins do not
83
-
//! let headless_session = binaryninja::headless::Session::new().unwrap();
//! See the [examples] on GitHub for more comprehensive examples.
101
-
//!
102
-
//! [Binary Ninja]: https://binary.ninja/
103
-
//! [Getting Started Guide]: https://docs.binary.ninja/
104
-
//! [our public Slack]: https://join.slack.com/t/binaryninja/shared_invite/zt-3u4vu3ja-IGUF4ZWNlD7ER2ulvICvuQ
105
-
//! [file an issue]: https://github.com/Vector35/binaryninja-api/issues
106
-
//! [submit a PR]: https://github.com/Vector35/binaryninja-api/pulls
107
-
//! [the only official method of providing linker arguments to a crate is through that crate's `build.rs`]: https://github.com/rust-lang/cargo/issues/9554
108
-
//! [`build.rs` is here]: https://github.com/Vector35/binaryninja-api/blob/dev/rust/examples/template/build.rs
0 commit comments