{"id":51685432,"url":"https://github.com/tinysec/sharp-binaryninja","last_synced_at":"2026-07-15T19:34:50.093Z","repository":{"id":326333718,"uuid":"1103131503","full_name":"tinysec/sharp-binaryninja","owner":"tinysec","description":"BinaryNinja dotnet C# Bindings (Typed, Safe, Native AOT Ready)","archived":false,"fork":false,"pushed_at":"2026-07-06T05:52:19.000Z","size":1380,"stargazers_count":23,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-06T06:08:02.891Z","etag":null,"topics":["binaryninja","dotnet"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tinysec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-24T13:21:28.000Z","updated_at":"2026-07-06T05:51:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tinysec/sharp-binaryninja","commit_stats":null,"previous_names":["tinysec/binaryninja","tinysec/sharp-binaryninja"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/tinysec/sharp-binaryninja","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinysec%2Fsharp-binaryninja","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinysec%2Fsharp-binaryninja/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinysec%2Fsharp-binaryninja/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinysec%2Fsharp-binaryninja/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinysec","download_url":"https://codeload.github.com/tinysec/sharp-binaryninja/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinysec%2Fsharp-binaryninja/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35519051,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-15T02:00:06.706Z","response_time":131,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binaryninja","dotnet"],"created_at":"2026-07-15T19:34:48.025Z","updated_at":"2026-07-15T19:34:50.088Z","avatar_url":"https://github.com/tinysec.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BinaryNinja C# Bindings (Typed, Safe, Native AOT Ready)\n\n[![NuGet](https://img.shields.io/nuget/v/BinaryNinja.svg)](https://www.nuget.org/packages/BinaryNinja)\n![License](https://img.shields.io/github/license/tinysec/binaryninja)\n![Platforms](https://img.shields.io/badge/platforms-windows%20%7C%20linux-blue)\n![.NET](https://img.shields.io/badge/.NET-%3E%3D%208.0-512BD4)\n\nModern, fully statically typed C# bindings for the Binary Ninja C API. Designed for safety, performance, and Native AOT compatibility. \nUse it as a dynamic library in your apps, compile CLI tools with Native AOT, or build native Binary Ninja plugins.\n\n- Statically typed API surface\n- 100% SafeHandle-based resource management\n- Idiomatic IDisposable/Dispose pattern\n- Native AOT friendly (no reflection-heavy runtime dependencies)\n- Works with .NET 8.0+\n\n## WARNING\n- Do not use this in production. The API is experimental and may introduce breaking changes without notice.\n\n## Install\n\n```shell\ndotnet add package BinaryNinja\n```\n## Requirements\n\n- .NET 8.0 or newer\n- Binary Ninja installed (Desktop or Headless)\n- Ensure the Binary Ninja native libraries are discoverable at runtime:\n    - environment variable: BINARYNINJA_BASE or BINARYNINJA_HOME (points to Binary Ninja installation root)\n\n## Using in cli\n```csharp\nusing System;\nusing BinaryNinja;\n\nclass Program\n{\n    static void Main()\n    {\n        NativeLibrary.SetDllImportResolver(\n            typeof(BinaryNinja.Core).Assembly,\n            new LibraryResolver().ResolveDllImport\n\t\t);\n\t\t\t\n        Core.InitPlugins(true);\n        \n        using BinaryView? view = BinaryView.LoadFile(\"driver.sys.bndb\");\n        \n        if (null == view)\n        {\n            throw new Exception(\"load fail\");\n        }\n        \n        foreach(Function function in view.Functions)\n        {\n            Console.WriteLine(function.RawName);\n        }\n       \n        Core.Shutdown();\n    }\n}\n```\n\n## Using in Plugin\n\n```csharp\nusing System;\nusing System.Collections.Generic;\nusing System.Runtime.InteropServices;\nusing System.Runtime.CompilerServices;\nusing BinaryNinja;\n\nnamespace Dummy\n{\n\tpublic static class Plugin\n\t{\n\t\tstatic Plugin()\n\t\t{\n\t\t\tNativeLibrary.SetDllImportResolver(\n\t\t\t\ttypeof(BinaryNinja.Core).Assembly,\n\t\t\t\tnew LibraryResolver().ResolveDllImport\n\t\t\t);\n\t\t}\n\t\t\n\t\t[UnmanagedCallersOnly(\n\t\t\tEntryPoint = \"CorePluginABIVersion\", \n\t\t\tCallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })\n\t\t]\n\t\tpublic static uint CorePluginABIVersion()\n\t\t{\n\t\t\treturn BinaryNinja.Core.CurrentCoreABIVersion;\n\t\t}\n\t\t\n\t\t[UnmanagedCallersOnly(EntryPoint = \"CorePluginInit\", CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]\n\t\tpublic static byte CorePluginInit()\n\t\t{\n\t\t\tBinaryNinja.Core.LogInfo(\"[+] i am native aot plugin\\n\");\n\t\t\t\n\t\t\tBinaryNinja.Core.LogInfo( $\"[+] Core CurrentCoreABIVersion: {Core.GetCurrentCoreABIVersion()}\\n\");\n\t\t\t\n\t\t\tBinaryNinja.Core.LogInfo( $\"[+] Core MinimumCoreABIVersion: {Core.GetMinimumCoreABIVersion()}\\n\");\n\t\t\t\n\t\t\tBinaryNinja.Core.LogInfo( $\"[+] Plugin CurrentCoreABIVersion: {Core.CurrentCoreABIVersion }\\n\");\n\t\t\t\n\t\t\tBinaryNinja.Logger logger = BinaryNinja.Logger.GetOrCreateLogger(\"Dummy\");\n\t\t\t\n\t\t\tlogger.LogInfo(\"[+] use private logger\\n\");\n\t\t\t\n\t\t\tBinaryNinja.PluginCommand.RegisterPluginCommand(\n\t\t\t\t\"Dummy command\",\n\t\t\t\t\"Dummy command description\",\n\t\t\t\tPlugin.DefaultCommand,\n\t\t\t\tPlugin.DefaultIsValid\n\t\t\t);\n\t\t\t\n\t\t\tlogger.LogInfo(\"[+] init done.\");\n\t\t\t\n\t\t\treturn 1; // success\n\t\t}\n        \n        public static void DefaultCommand(BinaryView view )\n\t\t{\n\t\t\tLogger logger = BinaryNinja.Logger.GetOrCreateLogger(\"Dummy\");\n\t\t\t\n\t\t\tlogger.LogInfo($\"view length: {view.Length}\");\n\n\t\t\tCore.OpenUrl(\"https://github.com/tinysec/binaryninja\");\n\t\t\t\n\t\t\tFunction? function = view.ChooseFunction();\n\t\t\t\n\t\t\tif (null != function)\n\t\t\t{\n\t\t\t\tlogger.LogInfo($\"function , RawName: {function.RawName}\");\n\t\t\t}\n\t\t}\n\n\t\tpublic static bool DefaultIsValid(BinaryView view )\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t}\n}\n```\n\n## Troubleshooting\n\n- DllNotFoundException / EntryPointNotFoundException\n    - Ensure set BINARYNINJA_BASE\n    - On Native AOT, confirm your RID is correct and you published with PublishAot=true\n- AccessViolationException\n    - Check lifetime: ensure using-statements dispose views/sessions before exit\n    - Make sure the target BN C API functions exist in the installed version","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinysec%2Fsharp-binaryninja","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinysec%2Fsharp-binaryninja","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinysec%2Fsharp-binaryninja/lists"}