Loading...
Searching...
No Matches

Detailed Description

Classes

struct  BinaryNinja::PluginCommandContext
 
class  BinaryNinja::PluginCommand
 The PluginCommand class is used for registering "commands" for Plugins, corresponding to code in those plugins to be executed. More...
 
class  BinaryNinja::MainThreadAction
 
class  BinaryNinja::MainThreadActionHandler
 
class  BinaryNinja::BackgroundTask
 

Class Documentation

◆ BinaryNinja::PluginCommandContext

struct BinaryNinja::PluginCommandContext

Public Member Functions

 PluginCommandContext ()
 

Public Attributes

Ref< BinaryViewbinaryView
 
uint64_t address
 
uint64_t length
 
size_t instrIndex
 
Ref< Functionfunction
 
Ref< LowLevelILFunctionlowLevelILFunction
 
Ref< MediumLevelILFunctionmediumLevelILFunction
 
Ref< HighLevelILFunctionhighLevelILFunction
 

Constructor & Destructor Documentation

◆ PluginCommandContext()

PluginCommandContext::PluginCommandContext ( )

Member Data Documentation

◆ binaryView

Ref<BinaryView> BinaryNinja::PluginCommandContext::binaryView

◆ address

uint64_t BinaryNinja::PluginCommandContext::address

◆ length

uint64_t BinaryNinja::PluginCommandContext::length

◆ instrIndex

size_t BinaryNinja::PluginCommandContext::instrIndex

◆ function

Ref<Function> BinaryNinja::PluginCommandContext::function

◆ lowLevelILFunction

Ref<LowLevelILFunction> BinaryNinja::PluginCommandContext::lowLevelILFunction

◆ mediumLevelILFunction

Ref<MediumLevelILFunction> BinaryNinja::PluginCommandContext::mediumLevelILFunction

◆ highLevelILFunction

Ref<HighLevelILFunction> BinaryNinja::PluginCommandContext::highLevelILFunction

◆ BinaryNinja::PluginCommand

class BinaryNinja::PluginCommand

The PluginCommand class is used for registering "commands" for Plugins, corresponding to code in those plugins to be executed.

The proper way to use this class is via one of the "Register*" static methods.

Public Member Functions

 PluginCommand (const BNPluginCommand &cmd)
 
 PluginCommand (const PluginCommand &cmd)
 
 ~PluginCommand ()
 
PluginCommandoperator= (const PluginCommand &cmd)
 
std::string GetName () const
 Get the name for the registered PluginCommand.
 
std::string GetDescription () const
 Get the description for the registered PluginCommand.
 
BNPluginCommandType GetType () const
 Get the type of the registered PluginCommand.
 
const BNPluginCommandGetObject () const
 
bool IsValid (const PluginCommandContext &ctxt) const
 
void Execute (const PluginCommandContext &ctxt) const
 

Static Public Member Functions

static void Register (const std::string &name, const std::string &description, const std::function< void(BinaryView *view)> &action)
 Register a command for a given BinaryView.
 
static void Register (const std::string &name, const std::string &description, const std::function< void(BinaryView *view)> &action, const std::function< bool(BinaryView *view)> &isValid)
 Register a command for a given BinaryView, with a validity check.
 
static void RegisterForAddress (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, uint64_t addr)> &action)
 Register a command for a given BinaryView, when an address is selected.
 
static void RegisterForAddress (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, uint64_t addr)> &action, const std::function< bool(BinaryView *view, uint64_t addr)> &isValid)
 Register a command for a given BinaryView and an address, with a validity check.
 
static void RegisterForRange (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, uint64_t addr, uint64_t len)> &action)
 Register a command for a given BinaryView, when a range of address is selected.
 
static void RegisterForRange (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, uint64_t addr, uint64_t len)> &action, const std::function< bool(BinaryView *view, uint64_t addr, uint64_t len)> &isValid)
 Register a command for a given BinaryView and a range, with a validity check.
 
static void RegisterForFunction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, Function *func)> &action)
 Register a command for a given BinaryView within a function.
 
static void RegisterForFunction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, Function *func)> &action, const std::function< bool(BinaryView *view, Function *func)> &isValid)
 Register a command for a given BinaryView and a function, with a validity check.
 
static void RegisterForLowLevelILFunction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, LowLevelILFunction *func)> &action)
 Register a command for a given BinaryView within a LowLevelILFunction.
 
static void RegisterForLowLevelILFunction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, LowLevelILFunction *func)> &action, const std::function< bool(BinaryView *view, LowLevelILFunction *func)> &isValid)
 Register a command for a given BinaryView and a Low Level IL function, with a validity check.
 
static void RegisterForLowLevelILInstruction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, const LowLevelILInstruction &instr)> &action)
 Register a command for a given BinaryView with a given LowLevelILInstruction.
 
static void RegisterForLowLevelILInstruction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, const LowLevelILInstruction &instr)> &action, const std::function< bool(BinaryView *view, const LowLevelILInstruction &instr)> &isValid)
 Register a command for a given BinaryView and a LowLevelILInstruction, with a validity check.
 
static void RegisterForMediumLevelILFunction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, MediumLevelILFunction *func)> &action)
 Register a command for a given BinaryView within a MediumLevelILFunction.
 
static void RegisterForMediumLevelILFunction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, MediumLevelILFunction *func)> &action, const std::function< bool(BinaryView *view, MediumLevelILFunction *func)> &isValid)
 Register a command for a given BinaryView and a Medium Level IL function, with a validity check.
 
static void RegisterForMediumLevelILInstruction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, const MediumLevelILInstruction &instr)> &action)
 Register a command for a given BinaryView with a given MediumLevelILInstruction.
 
static void RegisterForMediumLevelILInstruction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, const MediumLevelILInstruction &instr)> &action, const std::function< bool(BinaryView *view, const MediumLevelILInstruction &instr)> &isValid)
 Register a command for a given BinaryView and a MediumLevelILInstruction, with a validity check.
 
static void RegisterForHighLevelILFunction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, HighLevelILFunction *func)> &action)
 Register a command for a given BinaryView within a HighLevelILFunction.
 
static void RegisterForHighLevelILFunction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, HighLevelILFunction *func)> &action, const std::function< bool(BinaryView *view, HighLevelILFunction *func)> &isValid)
 Register a command for a given BinaryView and a High Level IL function, with a validity check.
 
static void RegisterForHighLevelILInstruction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, const HighLevelILInstruction &instr)> &action)
 Register a command for a given BinaryView with a given HighLevelILInstruction.
 
static void RegisterForHighLevelILInstruction (const std::string &name, const std::string &description, const std::function< void(BinaryView *view, const HighLevelILInstruction &instr)> &action, const std::function< bool(BinaryView *view, const HighLevelILInstruction &instr)> &isValid)
 Register a command for a given BinaryView and a HighLevelILInstruction, with a validity check.
 
static std::vector< PluginCommandGetList ()
 Get the list of registered PluginCommands.
 
static std::vector< PluginCommandGetValidList (const PluginCommandContext &ctxt)
 Get the list of valid PluginCommands for a given context.
 

Constructor & Destructor Documentation

◆ PluginCommand() [1/2]

PluginCommand::PluginCommand ( const BNPluginCommand & cmd)

◆ PluginCommand() [2/2]

PluginCommand::PluginCommand ( const PluginCommand & cmd)

◆ ~PluginCommand()

PluginCommand::~PluginCommand ( )

Member Function Documentation

◆ operator=()

PluginCommand & PluginCommand::operator= ( const PluginCommand & cmd)

◆ Register() [1/2]

static void BinaryNinja::PluginCommand::Register ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view)> & action )
static

Register a command for a given BinaryView.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::Register("MyPlugin\\MyAction", "Perform an action",
[](BinaryView* view)
{
// Perform an action on a view
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g. "void myCommand(BinaryView* view)"
void MyPlugin::MyCommand(BinaryView* view)
{
// Perform an action on a view
}
PluginCommand::Register("MyPlugin\\MySecondAction", "Perform an action", MyPlugin::MyCommand);
BinaryView implements a view on binary data, and presents a queryable interface of a binary file.
Definition binaryninjaapi.h:4440
static void Register(const std::string &name, const std::string &description, const std::function< void(BinaryView *view)> &action)
Register a command for a given BinaryView.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ Register() [2/2]

static void BinaryNinja::PluginCommand::Register ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view)> & action,
const std::function< bool(BinaryView *view)> & isValid )
static

Register a command for a given BinaryView, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::Register("MyPlugin\\MyAction", "Perform an action",
[](BinaryView* view)
{
// Perform an action on a view that requires it having symbols
},
[](BinaryView* view)
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace, e.g. "void myCommand(BinaryView* view)"
void MyPlugin::MyCommand(BinaryView* view)
{
// Perform an action on a view
}
PluginCommand::Register("MyPlugin\\MySecondAction", "Perform an action", MyPlugin::MyCommand,
[](BinaryView *view){ return view->HasSymbols(); });
bool HasSymbols() const
Check whether this BinaryView has any defined symbols.
Definition binaryview.cpp:2146
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidFunction that returns whether the command is allowed to be performed.

◆ RegisterForAddress() [1/2]

static void BinaryNinja::PluginCommand::RegisterForAddress ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, uint64_t addr)> & action )
static

Register a command for a given BinaryView, when an address is selected.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::RegisterForAddress("MyPlugin\\MyAddressAction", "Perform an action on an address",
[](BinaryView* view, uint64_t addr)
{
// Perform an action on a view and address
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g. "void myCommand(BinaryView* view)"
void MyPlugin::MyCommand(BinaryView* view, uint64_t addr)
{
// Perform an action on a view
}
PluginCommand::RegisterForAddress("MyPlugin\\MySecondAddressAction", "Perform an action", MyPlugin::MyCommand);
static void RegisterForAddress(const std::string &name, const std::string &description, const std::function< void(BinaryView *view, uint64_t addr)> &action)
Register a command for a given BinaryView, when an address is selected.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ RegisterForAddress() [2/2]

static void BinaryNinja::PluginCommand::RegisterForAddress ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, uint64_t addr)> & action,
const std::function< bool(BinaryView *view, uint64_t addr)> & isValid )
static

Register a command for a given BinaryView and an address, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::RegisterForAddress("MyPlugin\\MyAddressAction", "Perform an action",
[](BinaryView* view, uint64_t addr)
{
// Perform an action on a view that requires it having symbols
},
[](BinaryView* view, uint64_t addr)
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace, e.g. "void myCommand(BinaryView* view)"
void MyPlugin::MyCommand(BinaryView* view, uint64_t addr)
{
// Perform an action on a view
}
PluginCommand::RegisterForAddress("MyPlugin\\MySecondAddressAction", "Perform an action", MyPlugin::MyCommand,
[](BinaryView *view, uint64_t addr){ return view->HasSymbols(); });
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidExpression that returns whether the command is allowed to be performed.

◆ RegisterForRange() [1/2]

static void BinaryNinja::PluginCommand::RegisterForRange ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, uint64_t addr, uint64_t len)> & action )
static

Register a command for a given BinaryView, when a range of address is selected.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::RegisterForRange("MyPlugin\\MyRangeAction", "Perform an action on a range",
[](BinaryView* view, uint64_t addr, uint64_t len)
{
// Perform an action on a view and address
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g. "void myCommand(BinaryView* view)"
void MyPlugin::MyCommand(BinaryView* view, uint64_t addr, uint64_t len)
{
// Perform an action on a view
}
PluginCommand::RegisterForRange("MyPlugin\\MySecondRangeAction", "Perform an action", MyPlugin::MyCommand);
static void RegisterForRange(const std::string &name, const std::string &description, const std::function< void(BinaryView *view, uint64_t addr, uint64_t len)> &action)
Register a command for a given BinaryView, when a range of address is selected.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ RegisterForRange() [2/2]

static void BinaryNinja::PluginCommand::RegisterForRange ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, uint64_t addr, uint64_t len)> & action,
const std::function< bool(BinaryView *view, uint64_t addr, uint64_t len)> & isValid )
static

Register a command for a given BinaryView and a range, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::RegisterForRange("MyPlugin\\MyRangeAction", "Perform an action",
[](BinaryView* view, uint64_t addr, uint64_t len)
{
// Perform an action on a view that requires it having symbols
},
[](BinaryView* view, uint64_t addr, uint64_t len)
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace, e.g. "void myCommand(BinaryView* view)"
void MyPlugin::MyCommand(BinaryView* view, uint64_t addr, uint64_t len)
{
// Perform an action on a view
}
PluginCommand::RegisterForRange("MyPlugin\\MySecondRangeAction", "Perform an action", MyPlugin::MyCommand,
[](BinaryView *view, uint64_t addr, uint64_t len){ return view->HasSymbols(); });
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidExpression that returns whether the command is allowed to be performed.

◆ RegisterForFunction() [1/2]

static void BinaryNinja::PluginCommand::RegisterForFunction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, Function *func)> & action )
static

Register a command for a given BinaryView within a function.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::RegisterForFunction("MyPlugin\\MyFunctionAction", "Perform an action on a function",
[](BinaryView* view, Function* func)
{
// Perform an action on a view and function
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g.
// "void myCommand(BinaryView* view, Function* func)"
void MyPlugin::MyCommand(BinaryView* view, Function* func)
{
// Perform an action on a view
}
PluginCommand::RegisterForFunction("MyPlugin\\MySecondFunctionAction", "Perform an action", MyPlugin::MyCommand);
Definition binaryninjaapi.h:10572
static void RegisterForFunction(const std::string &name, const std::string &description, const std::function< void(BinaryView *view, Function *func)> &action)
Register a command for a given BinaryView within a function.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ RegisterForFunction() [2/2]

static void BinaryNinja::PluginCommand::RegisterForFunction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, Function *func)> & action,
const std::function< bool(BinaryView *view, Function *func)> & isValid )
static

Register a command for a given BinaryView and a function, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::RegisterForFunction("MyPlugin\\MyFunctionAction", "Perform an action",
[](BinaryView* view, Function* func)
{
// Perform an action on a view that requires it having symbols
},
[](BinaryView* view, Function* func)
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace,
// e.g. "void myCommand(BinaryView* view, Function* func)"
void MyPlugin::MyCommand(BinaryView* view, Function* func)
{
// Perform an action on a view
}
PluginCommand::RegisterForFunction("MyPlugin\\MySecondFunctionAction", "Perform an action", MyPlugin::MyCommand,
[](BinaryView *view, Function* func){ return view->HasSymbols(); });
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidExpression that returns whether the command is allowed to be performed.

◆ RegisterForLowLevelILFunction() [1/2]

static void BinaryNinja::PluginCommand::RegisterForLowLevelILFunction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, LowLevelILFunction *func)> & action )
static

Register a command for a given BinaryView within a LowLevelILFunction.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::RegisterForLowLevelILFunction("MyPlugin\\MyLLILFunctionAction", "Perform an action on a llil function",
[](BinaryView* view, LowLevelILFunction* func)
{
// Perform an action on a view and function
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g.
// "void myCommand(BinaryView* view, LowLevelILFunction* func)"
void MyPlugin::MyCommand(BinaryView* view, LowLevelILFunction* func)
{
// Perform an action on a view
}
PluginCommand::RegisterForLowLevelILFunction("MyPlugin\\MySecondLLILAction", "Perform an action", MyPlugin::MyCommand);
Definition binaryninjaapi.h:11627
static void RegisterForLowLevelILFunction(const std::string &name, const std::string &description, const std::function< void(BinaryView *view, LowLevelILFunction *func)> &action)
Register a command for a given BinaryView within a LowLevelILFunction.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ RegisterForLowLevelILFunction() [2/2]

static void BinaryNinja::PluginCommand::RegisterForLowLevelILFunction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, LowLevelILFunction *func)> & action,
const std::function< bool(BinaryView *view, LowLevelILFunction *func)> & isValid )
static

Register a command for a given BinaryView and a Low Level IL function, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::RegisterForLowLevelILFunction("MyPlugin\\MyLLILFunctionAction", "Perform an action",
[](BinaryView* view, LowLevelILFunction* func)
{
// Perform an action on a view that requires it having symbols
},
[](BinaryView* view, LowLevelILFunction* func)
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace,
// e.g. "void myCommand(BinaryView* view, LowLevelILFunction* func)"
void MyPlugin::MyCommand(BinaryView* view, LowLevelILFunction* func)
{
// Perform an action on a view
}
PluginCommand::RegisterForLowLevelILFunction("MyPlugin\\MySecondLLILAction", "Perform an action", MyPlugin::MyCommand,
[](BinaryView *view, LowLevelILFunction* func){ return view->HasSymbols(); });
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidExpression that returns whether the command is allowed to be performed.

◆ RegisterForLowLevelILInstruction() [1/2]

static void BinaryNinja::PluginCommand::RegisterForLowLevelILInstruction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, const LowLevelILInstruction &instr)> & action )
static

Register a command for a given BinaryView with a given LowLevelILInstruction.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::RegisterForRegisterForLowLevelILInstruction("MyPlugin\\MyLLILInstructionAction",
"Perform an action on an instruction",
{
// Perform an action on a view and a LowLevelILInstruction
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g.
// "void myCommand(BinaryView* view, LowLevelILInstruction* instr)"
void MyPlugin::MyCommand(BinaryView* view, LowLevelILInstruction* instr)
{
// Perform an action on a view
}
PluginCommand::RegisterForLowLevelILInstruction("MyPlugin\\MySecondLLILAction", "Perform an action", MyPlugin::MyCommand);
Definition lowlevelilinstruction.h:810
static void RegisterForLowLevelILInstruction(const std::string &name, const std::string &description, const std::function< void(BinaryView *view, const LowLevelILInstruction &instr)> &action)
Register a command for a given BinaryView with a given LowLevelILInstruction.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ RegisterForLowLevelILInstruction() [2/2]

static void BinaryNinja::PluginCommand::RegisterForLowLevelILInstruction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, const LowLevelILInstruction &instr)> & action,
const std::function< bool(BinaryView *view, const LowLevelILInstruction &instr)> & isValid )
static

Register a command for a given BinaryView and a LowLevelILInstruction, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::RegisterForLowLevelILInstruction("MyPlugin\\MyLLILInstructionAction", "Perform an action",
{
// Perform an action on a view that requires it having symbols
},
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace,
// e.g. "void myCommand(BinaryView* view, LowLevelILInstruction* instr)"
void MyPlugin::MyCommand(BinaryView* view, LowLevelILInstruction* instr)
{
// Perform an action on a view
}
PluginCommand::RegisterForLowLevelILInstruction("MyPlugin\\MySecondLLILAction",
"Perform an action", MyPlugin::MyCommand,
[](BinaryView *view, LowLevelILInstruction* instr){ return view->HasSymbols(); });
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidExpression that returns whether the command is allowed to be performed.

◆ RegisterForMediumLevelILFunction() [1/2]

static void BinaryNinja::PluginCommand::RegisterForMediumLevelILFunction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, MediumLevelILFunction *func)> & action )
static

Register a command for a given BinaryView within a MediumLevelILFunction.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::RegisterForMediumLevelILFunction("MyPlugin\\MyMLILFunctionAction", "Perform an action on a mlil function",
{
// Perform an action on a view and function
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g.
// "void myCommand(BinaryView* view, MediumLevelILFunction* func)"
void MyPlugin::MyCommand(BinaryView* view, MediumLevelILFunction* func)
{
// Perform an action on a view
}
PluginCommand::RegisterForMediumLevelILFunction("MyPlugin\\MySecondMLILAction", "Perform an action", MyPlugin::MyCommand);
Definition binaryninjaapi.h:13048
static void RegisterForMediumLevelILFunction(const std::string &name, const std::string &description, const std::function< void(BinaryView *view, MediumLevelILFunction *func)> &action)
Register a command for a given BinaryView within a MediumLevelILFunction.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ RegisterForMediumLevelILFunction() [2/2]

static void BinaryNinja::PluginCommand::RegisterForMediumLevelILFunction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, MediumLevelILFunction *func)> & action,
const std::function< bool(BinaryView *view, MediumLevelILFunction *func)> & isValid )
static

Register a command for a given BinaryView and a Medium Level IL function, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::RegisterForMediumLevelILFunction("MyPlugin\\MyMLILFunctionAction", "Perform an action",
{
// Perform an action on a view that requires it having symbols
},
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace,
// e.g. "void myCommand(BinaryView* view, MediumLevelILFunction* func)"
void MyPlugin::MyCommand(BinaryView* view, MediumLevelILFunction* func)
{
// Perform an action on a view
}
PluginCommand::RegisterForMediumLevelILFunction("MyPlugin\\MySecondMLILAction", "Perform an action", MyPlugin::MyCommand,
[](BinaryView *view, MediumLevelILFunction* func){ return view->HasSymbols(); });
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidExpression that returns whether the command is allowed to be performed.

◆ RegisterForMediumLevelILInstruction() [1/2]

static void BinaryNinja::PluginCommand::RegisterForMediumLevelILInstruction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, const MediumLevelILInstruction &instr)> & action )
static

Register a command for a given BinaryView with a given MediumLevelILInstruction.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::RegisterForRegisterForMediumLevelILInstruction("MyPlugin\\MyMLILInstructionAction",
"Perform an action on an instruction",
{
// Perform an action on a view and a MediumLevelILInstruction
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g.
// "void myCommand(BinaryView* view, MediumLevelILInstruction* instr)"
void MyPlugin::MyCommand(BinaryView* view, MediumLevelILInstruction* instr)
{
// Perform an action on a view
}
PluginCommand::RegisterForMediumLevelILInstruction("MyPlugin\\MySecondMLILAction", "Perform an action", MyPlugin::MyCommand);
Definition mediumlevelilinstruction.h:567
static void RegisterForMediumLevelILInstruction(const std::string &name, const std::string &description, const std::function< void(BinaryView *view, const MediumLevelILInstruction &instr)> &action)
Register a command for a given BinaryView with a given MediumLevelILInstruction.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ RegisterForMediumLevelILInstruction() [2/2]

static void BinaryNinja::PluginCommand::RegisterForMediumLevelILInstruction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, const MediumLevelILInstruction &instr)> & action,
const std::function< bool(BinaryView *view, const MediumLevelILInstruction &instr)> & isValid )
static

Register a command for a given BinaryView and a MediumLevelILInstruction, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::RegisterForMediumLevelILInstruction("MyPlugin\\MyMLILInstructionAction", "Perform an action",
{
// Perform an action on a view that requires it having symbols
},
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace,
// e.g. "void myCommand(BinaryView* view, MediumLevelILInstruction* instr)"
void MyPlugin::MyCommand(BinaryView* view, MediumLevelILInstruction* instr)
{
// Perform an action on a view
}
"Perform an action", MyPlugin::MyCommand,
[](BinaryView *view, MediumLevelILInstruction* instr){ return view->HasSymbols(); });
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidExpression that returns whether the command is allowed to be performed.

◆ RegisterForHighLevelILFunction() [1/2]

static void BinaryNinja::PluginCommand::RegisterForHighLevelILFunction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, HighLevelILFunction *func)> & action )
static

Register a command for a given BinaryView within a HighLevelILFunction.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::RegisterForHighLevelILFunction("MyPlugin\\MyHLILFunctionAction", "Perform an action on a hlil function",
{
// Perform an action on a view and function
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g.
// "void myCommand(BinaryView* view, HighLevelILFunction* func)"
void MyPlugin::MyCommand(BinaryView* view, HighLevelILFunction* func)
{
// Perform an action on a view
}
PluginCommand::RegisterForMediumLevelILFunction("MyPlugin\\MySecondHLILAction", "Perform an action", MyPlugin::MyCommand);
Definition binaryninjaapi.h:13421
static void RegisterForHighLevelILFunction(const std::string &name, const std::string &description, const std::function< void(BinaryView *view, HighLevelILFunction *func)> &action)
Register a command for a given BinaryView within a HighLevelILFunction.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ RegisterForHighLevelILFunction() [2/2]

static void BinaryNinja::PluginCommand::RegisterForHighLevelILFunction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, HighLevelILFunction *func)> & action,
const std::function< bool(BinaryView *view, HighLevelILFunction *func)> & isValid )
static

Register a command for a given BinaryView and a High Level IL function, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::RegisterForHighLevelILFunction("MyPlugin\\MyHLILFunctionAction", "Perform an action",
{
// Perform an action on a view that requires it having symbols
},
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace,
// e.g. "void myCommand(BinaryView* view, HighLevelILFunction* func)"
void MyPlugin::MyCommand(BinaryView* view, HighLevelILFunction* func)
{
// Perform an action on a view
}
PluginCommand::RegisterForHighLevelILFunction("MyPlugin\\MySecondHLILAction", "Perform an action", MyPlugin::MyCommand,
[](BinaryView *view, HighLevelILFunction* func){ return view->HasSymbols(); });
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidExpression that returns whether the command is allowed to be performed.

◆ RegisterForHighLevelILInstruction() [1/2]

static void BinaryNinja::PluginCommand::RegisterForHighLevelILInstruction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, const HighLevelILInstruction &instr)> & action )
static

Register a command for a given BinaryView with a given HighLevelILInstruction.

This will appear in the top menu and the right-click context menu.

// Registering a command using a lambda expression
PluginCommand::RegisterForRegisterForHighLevelILInstruction("MyPlugin\\MyHLILInstructionAction",
"Perform an action on an instruction",
{
// Perform an action on a view and a HighLevelILInstruction
});
// Registering a command using a standard static function
// This also works with functions in the global namespace, e.g.
// "void myCommand(BinaryView* view, HighLevelILInstruction* instr)"
void MyPlugin::MyCommand(BinaryView* view, HighLevelILInstruction* instr)
{
// Perform an action on a view
}
PluginCommand::RegisterForHighLevelILInstruction("MyPlugin\\MySecondHLILAction", "Perform an action", MyPlugin::MyCommand);
Definition highlevelilinstruction.h:450
static void RegisterForHighLevelILInstruction(const std::string &name, const std::string &description, const std::function< void(BinaryView *view, const HighLevelILInstruction &instr)> &action)
Register a command for a given BinaryView with a given HighLevelILInstruction.
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform

◆ RegisterForHighLevelILInstruction() [2/2]

static void BinaryNinja::PluginCommand::RegisterForHighLevelILInstruction ( const std::string & name,
const std::string & description,
const std::function< void(BinaryView *view, const HighLevelILInstruction &instr)> & action,
const std::function< bool(BinaryView *view, const HighLevelILInstruction &instr)> & isValid )
static

Register a command for a given BinaryView and a HighLevelILInstruction, with a validity check.

This will appear in the top menu and the right-click context menu.

// Registering a command using lambda expressions
PluginCommand::RegisterForHighLevelILInstruction("MyPlugin\\MyHLILInstructionAction", "Perform an action",
{
// Perform an action on a view that requires it having symbols
},
{
return view->HasSymbols();
});
// Registering a command using a standard static function, and a lambda for the isValid check
// This also works with functions in the global namespace,
// e.g. "void myCommand(BinaryView* view, HighLevelILInstruction* instr)"
void MyPlugin::MyCommand(BinaryView* view, HighLevelILInstruction* instr)
{
// Perform an action on a view
}
PluginCommand::RegisterForHighLevelILInstruction("MyPlugin\\MySecondHLILAction",
"Perform an action", MyPlugin::MyCommand,
[](BinaryView *view, HighLevelILInstruction* instr){ return view->HasSymbols(); });
Parameters
name

Name of the command to register. This will appear in the top menu and the context menu.

You can register submenus to an item by separating names with a "\\". The base (farthest right) name will be the item which upon being clicked will perform the action.

descriptionDescription of the command
actionAction to perform
isValidExpression that returns whether the command is allowed to be performed.

◆ GetList()

vector< PluginCommand > PluginCommand::GetList ( )
static

Get the list of registered PluginCommands.

Returns
The list of registered PluginCommands

◆ GetValidList()

vector< PluginCommand > PluginCommand::GetValidList ( const PluginCommandContext & ctxt)
static

Get the list of valid PluginCommands for a given context.

Parameters
ctxtThe context to be used for the checks
Returns
The list of valid plugin commands.

◆ GetName()

std::string BinaryNinja::PluginCommand::GetName ( ) const
inline

Get the name for the registered PluginCommand.

Returns
The name for the registered PluginCommand

◆ GetDescription()

std::string BinaryNinja::PluginCommand::GetDescription ( ) const
inline

Get the description for the registered PluginCommand.

Returns
The description for the registered PluginCommand

◆ GetType()

BNPluginCommandType BinaryNinja::PluginCommand::GetType ( ) const
inline

Get the type of the registered PluginCommand.

Returns
The type of the registered PluginCommand

◆ GetObject()

const BNPluginCommand * BinaryNinja::PluginCommand::GetObject ( ) const
inline

◆ IsValid()

bool PluginCommand::IsValid ( const PluginCommandContext & ctxt) const

◆ Execute()

void PluginCommand::Execute ( const PluginCommandContext & ctxt) const

◆ BinaryNinja::MainThreadAction

class BinaryNinja::MainThreadAction

Public Member Functions

 MainThreadAction (BNMainThreadAction *action)
 
void Execute ()
 
bool IsDone () const
 
void Wait ()
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNMainThreadAction, BNNewMainThreadActionReference, BNFreeMainThreadAction >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNMainThreadActionGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Additional Inherited Members

- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNMainThreadAction, BNNewMainThreadActionReference, BNFreeMainThreadAction >
static BNMainThreadActionGetObject (CoreRefCountObject *obj)
 
static BNMainThreadActionGetObject (const CoreRefCountObject *obj)
 
- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNMainThreadAction, BNNewMainThreadActionReference, BNFreeMainThreadAction >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNMainThreadActionm_object
 

Constructor & Destructor Documentation

◆ MainThreadAction()

MainThreadAction::MainThreadAction ( BNMainThreadAction * action)

Member Function Documentation

◆ Execute()

void MainThreadAction::Execute ( )

◆ IsDone()

bool MainThreadAction::IsDone ( ) const

◆ Wait()

void MainThreadAction::Wait ( )

◆ BinaryNinja::MainThreadActionHandler

class BinaryNinja::MainThreadActionHandler

Public Member Functions

virtual void AddMainThreadAction (MainThreadAction *action)=0
 

Member Function Documentation

◆ AddMainThreadAction()

virtual void BinaryNinja::MainThreadActionHandler::AddMainThreadAction ( MainThreadAction * action)
pure virtual

◆ BinaryNinja::BackgroundTask

class BinaryNinja::BackgroundTask

Public Member Functions

 BackgroundTask (BNBackgroundTask *task)
 
 BackgroundTask (const std::string &initialText, bool canCancel)
 Provides a mechanism for reporting progress of an optionally cancelable task to the user via the status bar in the UI.
 
bool CanCancel () const
 
bool IsCancelled () const
 
bool IsFinished () const
 
std::string GetProgressText () const
 
uint64_t GetRuntimeSeconds () const
 
void Cancel ()
 
void Finish ()
 
void SetProgressText (const std::string &text)
 
- Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNBackgroundTask, BNNewBackgroundTaskReference, BNFreeBackgroundTask >
 CoreRefCountObject ()
 
virtual ~CoreRefCountObject ()
 
BNBackgroundTaskGetObject () const
 
void AddRef ()
 
void Release ()
 
void AddRefForRegistration ()
 
void ReleaseForRegistration ()
 
void AddRefForCallback ()
 
void ReleaseForCallback ()
 

Static Public Member Functions

static std::vector< Ref< BackgroundTask > > GetRunningTasks ()
 
- Static Public Member Functions inherited from BinaryNinja::CoreRefCountObject< BNBackgroundTask, BNNewBackgroundTaskReference, BNFreeBackgroundTask >
static BNBackgroundTaskGetObject (CoreRefCountObject *obj)
 
static BNBackgroundTaskGetObject (const CoreRefCountObject *obj)
 

Additional Inherited Members

- Public Attributes inherited from BinaryNinja::CoreRefCountObject< BNBackgroundTask, BNNewBackgroundTaskReference, BNFreeBackgroundTask >
std::atomic< int > m_refs
 
bool m_registeredRef
 
BNBackgroundTaskm_object
 

Constructor & Destructor Documentation

◆ BackgroundTask() [1/2]

BackgroundTask::BackgroundTask ( BNBackgroundTask * task)

◆ BackgroundTask() [2/2]

BinaryNinja::BackgroundTask::BackgroundTask ( const std::string & initialText,
bool canCancel )

Provides a mechanism for reporting progress of an optionally cancelable task to the user via the status bar in the UI.

If canCancel is is `True`, then the task can be cancelled either programmatically or by the user via the UI.

Note
This API does not provide a means to execute a task. The caller is responsible to execute (and possibly cancel) the task.
Parameters
initialTextText description of the progress of the background task (displayed in status bar of the UI)
canCancelWhether the task can be cancelled

Member Function Documentation

◆ CanCancel()

bool BackgroundTask::CanCancel ( ) const

◆ IsCancelled()

bool BackgroundTask::IsCancelled ( ) const

◆ IsFinished()

bool BackgroundTask::IsFinished ( ) const

◆ GetProgressText()

string BackgroundTask::GetProgressText ( ) const

◆ GetRuntimeSeconds()

uint64_t BackgroundTask::GetRuntimeSeconds ( ) const

◆ Cancel()

void BackgroundTask::Cancel ( )

◆ Finish()

void BackgroundTask::Finish ( )

◆ SetProgressText()

void BackgroundTask::SetProgressText ( const std::string & text)

◆ GetRunningTasks()

vector< Ref< BackgroundTask > > BackgroundTask::GetRunningTasks ( )
static