diff options
| author | Jordan Wiens <jordan@psifertex.com> | 2023-08-29 23:31:56 -0400 |
|---|---|---|
| committer | Jordan Wiens <jordan@psifertex.com> | 2023-08-29 23:31:56 -0400 |
| commit | 9202af38c7d0d894038be4192e0a90294a7c07aa (patch) | |
| tree | abfda454f9312e813dc5a7bd83c4badf3f8145c6 | |
| parent | 1875328326356054538694240064822492534697 (diff) | |
UI plugin dev and more licensing documentation
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | docs/about/open-source.md | 15 | ||||
| -rw-r--r-- | docs/dev/concepts.md | 42 | ||||
| -rw-r--r-- | docs/dev/plugins.md | 12 |
4 files changed, 71 insertions, 2 deletions
@@ -113,3 +113,7 @@ In addition to this main API repository being open source Vector35 also has open ## Licensing Some components may be released under compatible but slightly different open source licenses and will have their own LICENSE file as appropriate. + +Remaining components are released under an [MIT](https://github.com/Vector35/binaryninja-api/blob/dev/LICENSE.txt) license. + +Note that `.lib` files are included the native binary builds of Binary Ninja for windows. Those lib files are also released under the same license as this repository and may be distributed accordingly. diff --git a/docs/about/open-source.md b/docs/about/open-source.md index d66cfb16..b2817625 100644 --- a/docs/about/open-source.md +++ b/docs/about/open-source.md @@ -1,6 +1,6 @@ # Binary Ninja -## Open Source +## Third Party Open Source Vector 35 is grateful for the following open source packages that are used in Binary Ninja directly or indirectly: @@ -53,6 +53,13 @@ The previous tools are used in the generation of our documentation, but are not - [flatbuffer] ([flatbuffer license] - Apache License 2.0) used in the binary format for the function fingerprint libraries - [deprecation] ([deprecation license] - Apache License 2.0) used in the Python API for marking deprecated functions/properties/classes +## First Party Open Source + +* Several components of Binary Ninja developed by Vector 35 directly are released under open source licenses, noted as below: + - [API / Documentation] ([api license] - MIT) All APIs (Python, Rust, C, C++) and Documentation (User, API, etc)</li> + - LIB Files ([api license] - MIT) .lib files included with the native windows builds of Binary Ninja are released under the same MIT license as the API itself, distinct from the standard EULA + - [Views] ([views license] - Apache License 2.0) Binary views included with the product + - [Architectures] ([architectures license] - Apache License 2.0) Architecture support included with the product ## Building Qt @@ -152,3 +159,9 @@ Please note that we offer no support for running Binary Ninja with modified Qt l [num-integer license]: https://github.com/rust-num/num-integer/blob/master/LICENSE-MIT [num-traits]: https://github.com/rust-num/num-traits [num-traits license]: https://github.com/rust-num/num-traits/blob/master/LICENSE-MIT +[API / Documentation]: https://github.com/vector35/binaryninja-api +[api license]: https://github.com/Vector35/binaryninja-api/blob/dev/LICENSE.txt +[Views]: https://github.com/Vector35/?q=view-&type=all&language=&sort= +[views license]: https://github.com/Vector35/view-pe/blob/main/LICENSE +[Architectures]: https://github.com/Vector35/?q=arch-&type=all&language=&sort= +[architectures license]: https://github.com/Vector35/arch-armv7/blob/master/LICENSE
\ No newline at end of file diff --git a/docs/dev/concepts.md b/docs/dev/concepts.md index 5f839799..f962ba0d 100644 --- a/docs/dev/concepts.md +++ b/docs/dev/concepts.md @@ -20,4 +20,44 @@ It is easy to confuse ExpressionIndex and InstructionIndex properties in the API There are several ways to create UI elements in Binary Ninja. The first is to use the simplified [interaction](https://api.binary.ninja/binaryninja.interaction-module.html) API which lets you make simple UI elements for use in GUI plugins in Binary Ninja. As an added bonus, they all have fallbacks that will work in headless console-based applications as well. Plugins that use these API include the [angr](https://github.com/Vector35/binaryninja-api/blob/dev/python/examples/angr_plugin.py) and [nampa](https://github.com/kenoph/nampa) plugins. -The second and more powerful (but more complicated) mechanism is to leverage the _binaryninjaui_ module. Additional documentation is forthcoming, but there are several examples ([1](https://github.com/Vector35/kaitai), [2](https://github.com/Vector35/snippets), [3](https://github.com/Vector35/binaryninja-api/tree/dev/python/examples/triage)), and most of the APIs are backed by the [documented C++ headers](https://api.binary.ninja/cpp). Additionally, the generated _binaryninjaui_ module is shipped with each build of binaryninja and the usual python `dir()` instructions are helpful for exploring its capabilities.
\ No newline at end of file +The second and more powerful (but more complicated) mechanism is to leverage the _binaryninjaui_ module. Additional documentation is forthcoming, but there are several examples ([1](https://github.com/Vector35/kaitai), [2](https://github.com/Vector35/snippets), [3](https://github.com/Vector35/binaryninja-api/tree/dev/python/examples/triage)), and most of the APIs are backed by the [documented C++ headers](https://api.binary.ninja/cpp). Additionally, the generated _binaryninjaui_ module is shipped with each build of binaryninja and the usual python `dir()` instructions are helpful for exploring its capabilities. + +## Function Starts, Sizes, and Ending + +### How big is a Function? + +One of the common questions asked of a binary analysis platform is "how big is a function?". This is a deceptively simple question without a simple answer. There are rather several equally valid definitions you could give for what is the size of a function: + + - the total sum of all basic blocks? + - the highest virtual address in the function minus the lowest virtual address? + - the address of return instruction subtracted from the entry point + +Except that last one is a trick of course. Because not only can functions have multiple return instructions, but they may have multiple entry points (as is often the case with error handling). + +Basic blocks have, by definition, a start, and an end. Basic Blocks can therefore have consistent sizes that all binary analysis tools would agree upon (though more formal analysis might stop basic blocks on call instructions while for convenience sake, most reverse engineering tools do not). + +Summing up the basic blocks of a function is one way to produce a consistent size for a function, but how do you handle bytes that overlap standard function definitions, for example, via a tail call? Or via a mis-aligned jump where a byte is in two basic blocks? Different tools may resolve those ambiguous situations in different ways, so again, it is difficult to compare the "size" of any one binary analysis tool to another. + + In Binary Ninja, there is no explicit `.size` property of functions. Rather, you can choose to calculate it one of two ways: + +``` +function_size = current_function.total_bytes +# or +function_size = current_function.highest_address - current_function.lowest_address +``` + +Total bytes is similar to the first proposed definition above. It merely sums up the lengths of each basic block in the function. Because Binary Ninja allows bytes to exist in multiple blocks, this can cause bytes to be "double" counted, but this definition is consistent within BN itself, if not always with other tools in some edge cases. + +### When does a Function stop? + +One reason that having an "end" might be useful in a function (as opposed to the `.highest_address` in Binary Ninja), would be to make it a property that controls the analysis for a function. Unlike some other systems where it's possible to define the start and end of a function, in Binary Ninja, you merely define the start and allow analysis to occur naturally. The end results when all basic blocks terminate either in: + + - an invalid instruction + - a return instruction + - a call to a function marked as `__noreturn__` + - a branch to a block already in the function + - any other instruction such as an interrupt that by its definition stops analysis + +So how do you tell Binary Ninja how big a function is? The answer is you don't directly, but you can instead direct its analysis. For example, if a function is improperly not marked as a noreturn function, edit the function properties via the right-click menu and set the property and all calls to it will end analysis at that point in any callees. + +Likewise, you can do things like change memory permissions, patch in invalid instructions, [change an indirect branch's targets](https://github.com/Vector35/binaryninja-api/blob/dev/python/examples/jump_table.py), or use [UIDF](https://binary.ninja/2020/09/10/user-informed-dataflow.html) to influence analysis such that it ends where desired.
\ No newline at end of file diff --git a/docs/dev/plugins.md b/docs/dev/plugins.md index 100995fb..81f212f6 100644 --- a/docs/dev/plugins.md +++ b/docs/dev/plugins.md @@ -30,6 +30,7 @@ The simplest way to run your own plugin repository is to duplicate the structure Once you've created your test repository, use the `pluginManager.unofficialName` and `pluginManager.unofficialUrl` settings to add your third-party repository. The [`add_repository`](https://api.binary.ninja/binaryninja.pluginmanager-module.html#binaryninja.pluginmanager.RepositoryManager.add_repository) API can also be used to add the repository, though it [may require manual creation of the repository folder](https://github.com/Vector35/binaryninja-api/issues/2987). + ### Testing It's useful to be able to reload your plugin during testing. On the Commercial edition of Binary Ninja, this is easily accomplished with a stand-alone headless install using `import binaryninja` after [installing the API](https://github.com/Vector35/binaryninja-api/blob/dev/scripts/install_api.py). (install_api.py is included in each platforms respective [installation folder](../guide/index.md#binary-path)) @@ -74,6 +75,17 @@ If you wish to debug your python scripts, there are a few methods specific to di 1. Open Binary Ninja 1. Use `connect_pycharm_debugger(port=12345)` in the Python Console, using whichever port you selected in the Run Configuration. You should now see "Connected" in the PyCharm Debugger panel. +## UI Plugins + +Binary Ninja UI plugins should always `import binaryninjaui` before an `import PySide6`. Not only does this make sure the correct PySide6 is loaded (running the wrong version of PySide6 can result in crashing), but this [prevents plugins](https://github.com/Vector35/binaryninja-api/commit/55cb3e76f536bc8d4a6533bd7ea5202d464c5f81) from running headlessly. + +UI plugins can take many forms. Some, like [Snippets](https://github.com/vector35/snippets) create their own UI elements and interact via UIActions. Others extend the UI via existing UI elements such as [Triage](https://github.com/Vector35/binaryninja-api/tree/dev/python/examples/triage), [Kaitai](https://github.com/Vector35/kaitai), [hellosidebar](https://github.com/Vector35/binaryninja-api/blob/dev/python/examples/hellosidebar.py), or [helloglobalarea](https://github.com/Vector35/binaryninja-api/blob/dev/python/examples/helloglobalarea.py). + +Many other [third-party](https://github.com/vector35/community-plugins/) plugins also implement UI based examples, such as [BNIL Graph](https://github.com/withzombies/bnil-graph) using the FlowGraph APIs. + +Unfortunately, due to a PySide documentation generation issue, the best and most reliable documentation on the UI system is not in the regular [python](https://api.binary.ninja/) API docs, but in the [C++ documentation](https://api.binary.ninja/cpp/) which translates fairly cleanly to their python equivalent. + + ## Writing Native Plugins Writing native plugins allows for higher performance code and lower level access to the Binary Ninja API, but comes with a couple more hurdles than Python. |
