Provides headless support for generating, inspecting, and validating Binary Ninja type libraries (BNTL).
Assuming you have the following:
- A compatible Binary Ninja with headless usage (see this documentation for more information)
- Clang
- Rust (currently tested for 1.91.1)
- Set
BINARYNINJADIRenv variable to your installation directory (see here for more details) > - If this is not set, the -sys crate will try and locate using the default installation path and last run location.
- Clone this repository (
git clone https://github.com/Vector35/binaryninja-api/tree/dev) - Build in release (
cargo build --release)
If compilation fails because it could not link against binaryninjacore than you should double-check you set BINARYNINJADIR correctly.
Once it finishes you now will have a bntl_cli binary in target/release for use.
Assuming you already have the
bntl_clibinary and a valid headless compatible Binary Ninja license.
Generate a new type library from local files or remote projects.
Examples:
./bntl_cli create sqlite3.dll "windows-x86_64" ./headers/ ./output/- Places a single
sqlite.dll.bntlfile in theoutputdirectory, as headers have no dependency names associated they will be namedsqlite.dll.
- Places a single
./bntl_cli create myproject "windows-x86_64" binaryninja://enterprise/https://enterprise.com/23ce5eaa-f532-4a93-80f2-a7d7f0aed040/ ./output/- Downloads and processes all files in the project, placing potentially multiple
.bntlfiles in theoutputdirectory.
- Downloads and processes all files in the project, placing potentially multiple
./bntl_cli create sqlite3.dll "windows-x86_64" ./winmd/ ./output/winmdfiles are also supported as input, they will be processed together. You also probably want to provide some apiset schema files as well.
./bntl_cli create sqlite3.dll "windows-x86_64" ./headers/ ./output/ --include-directories ./system_headers/- You can also specify additional include directories to search for referenced headers.
Export a type library back into a C header file for inspection.
Examples:
./bntl_cli dump sqlite3.dll.bntl ./output/sqlite.h
Compare two type libraries and generate a .diff file.
Examples:
./bntl_cli diff sqlite3.dll.bntl sqlite3.dll.bntl ./output/sqlite.diff
Check type libraries for common errors, ensuring all referenced types exist across specified platforms.
Examples:
./bntl_cli validate ./typelibs/ ./output/- Pass in a directory containing
.bntlfiles to validate, outputting a JSON file for each type library containing any errors.
- Pass in a directory containing