Skip to content

binja API

lucasduffey edited this page Nov 20, 2016 · 17 revisions

C++ examples

C++ plugin entrypoint example

// https://github.com/bambu/binaryninja-api/blob/5a42aec73a77a3a54baf054cde9047533709be31/examples/breakpoint/src/breakpoint.cpp

void write_breakpoint(BinaryNinja::BinaryView *view, uint64_t start, uint64_t length){
        // code be here
}

extern "C" {
	BINARYNINJAPLUGIN bool CorePluginInit(){
        // Register the plugin with Binary Ninja
        PluginCommand::RegisterForRange("Convert to breakpoint",
                                        "Fill region with breakpoint instructions.",
                                        &write_breakpoint);
		return true;
	}
}

how is plugin loaded?

  • shared object?
  • plugin.json?? - how do you load C++ plugins? For now you need ctypes AFAIK.

ctypes

http://karuppuswamy.com/wordpress/2012/01/28/how-to-use-c-library-in-python-generating-python-wrappers-for-c-library/

official binja

how are C++ plugins loaded? No support in plugin.json yet. 

Ctypes and/or symlink is best bet right now.

jordan	[8:42 AM]  
It just loads the `.so`, `.dll`, or `.dylib` from the plugins folder.Only the python plugins are loaded from a subfolder for now.
Clone this wiki locally