BinaryNinja 0.1.0.26
dotnet add package BinaryNinja --version 0.1.0.26
NuGet\Install-Package BinaryNinja -Version 0.1.0.26
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BinaryNinja" Version="0.1.0.26" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BinaryNinja" Version="0.1.0.26" />
<PackageReference Include="BinaryNinja" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BinaryNinja --version 0.1.0.26
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BinaryNinja, 0.1.0.26"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BinaryNinja@0.1.0.26
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BinaryNinja&version=0.1.0.26
#tool nuget:?package=BinaryNinja&version=0.1.0.26
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BinaryNinja C# Bindings (Typed, Safe, Native AOT Ready)
Modern, fully statically typed C# bindings for the Binary Ninja C API. Designed for safety, performance, and Native AOT compatibility. Use it as a dynamic library in your apps, compile CLI tools with Native AOT, or build native Binary Ninja plugins.
- Statically typed API surface
- 100% SafeHandle-based resource management
- Idiomatic IDisposable/Dispose pattern
- Native AOT friendly (no reflection-heavy runtime dependencies)
- Works with .NET 8.0+
WARNING
- Do not use this in production. The API is experimental and may introduce breaking changes without notice.
Install
dotnet add package BinaryNinja
Requirements
- .NET 8.0 or newer
- Binary Ninja installed (Desktop or Headless)
- Ensure the Binary Ninja native libraries are discoverable at runtime:
- environment variable: BINARYNINJA_BASE (points to Binary Ninja installation root)
Using in cli
using System;
using BinaryNinja;
class Program
{
static void Main()
{
NativeLibrary.SetDllImportResolver(
typeof(BinaryNinja.Core).Assembly,
new LibraryResolver().ResolveDllImport
);
Core.InitPlugins(true);
using BinaryView? view = BinaryView.LoadFile("driver.sys.bndb");
if (null == view)
{
throw new Exception("load fail");
}
foreach(Function function in view.Functions)
{
Console.WriteLine(function.RawName);
}
Core.Shutdown();
}
}
Using in Plugin
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using BinaryNinja;
namespace Dummy
{
public static class Plugin
{
static Plugin()
{
NativeLibrary.SetDllImportResolver(
typeof(BinaryNinja.Core).Assembly,
new LibraryResolver().ResolveDllImport
);
}
[UnmanagedCallersOnly(
EntryPoint = "CorePluginABIVersion",
CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })
]
public static uint CorePluginABIVersion()
{
return BinaryNinja.Core.CurrentCoreABIVersion;
}
[UnmanagedCallersOnly(EntryPoint = "CorePluginInit", CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
public static byte CorePluginInit()
{
BinaryNinja.Core.LogInfo("[+] i am native aot plugin\n");
BinaryNinja.Core.LogInfo( $"[+] Core CurrentCoreABIVersion: {Core.GetCurrentCoreABIVersion()}\n");
BinaryNinja.Core.LogInfo( $"[+] Core MinimumCoreABIVersion: {Core.GetMinimumCoreABIVersion()}\n");
BinaryNinja.Core.LogInfo( $"[+] Plugin CurrentCoreABIVersion: {Core.CurrentCoreABIVersion }\n");
BinaryNinja.Logger logger = BinaryNinja.Logger.GetOrCreateLogger("Dummy");
logger.LogInfo("[+] use private logger\n");
BinaryNinja.PluginCommand.RegisterPluginCommand(
"Dummy command",
"Dummy command description",
Plugin.DefaultCommand,
Plugin.DefaultIsValid
);
logger.LogInfo("[+] init done.");
return 1; // success
}
public static void DefaultCommand(BinaryView view )
{
Logger logger = BinaryNinja.Logger.GetOrCreateLogger("Dummy");
logger.LogInfo($"view length: {view.Length}");
Core.OpenUrl("https://github.com/tinysec/binaryninja");
Function? function = view.ChooseFunction();
if (null != function)
{
logger.LogInfo($"function , RawName: {function.RawName}");
}
}
public static bool DefaultIsValid(BinaryView view )
{
return true;
}
}
}
Troubleshooting
- DllNotFoundException / EntryPointNotFoundException
- Ensure set BINARYNINJA_BASE
- On Native AOT, confirm your RID is correct and you published with PublishAot=true
- AccessViolationException
- Check lifetime: ensure using-statements dispose views/sessions before exit
- Make sure the target BN C API functions exist in the installed version
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.