Classes | |
class | BinaryNinja::AnalysisContext |
class | BinaryNinja::Activity |
class | BinaryNinja::Workflow |
Workflows are represented as Directed Acyclic Graphs (DAGs), where each node corresponds to an Activity (an individual analysis or action). More... | |
class BinaryNinja::AnalysisContext |
Public Member Functions | |
AnalysisContext (BNAnalysisContext *analysisContext) | |
virtual | ~AnalysisContext () |
Ref< BinaryView > | GetBinaryView () |
Get the BinaryView for the current AnalysisContext. | |
Ref< Function > | GetFunction () |
Get the Function for the current AnalysisContext. | |
Ref< LowLevelILFunction > | GetLowLevelILFunction () |
Get the low level IL function for the current AnalysisContext. | |
Ref< MediumLevelILFunction > | GetMediumLevelILFunction () |
Get the medium level IL function for the current AnalysisContext. | |
Ref< HighLevelILFunction > | GetHighLevelILFunction () |
Get the high level IL function for the current AnalysisContext. | |
void | SetBasicBlockList (std::vector< Ref< BasicBlock > > basicBlocks) |
Set a new BasicBlock list for the current analysis context. | |
void | SetLiftedILFunction (Ref< LowLevelILFunction > liftedIL) |
Set new lifted IL for the current analysis context. | |
void | SetLowLevelILFunction (Ref< LowLevelILFunction > lowLevelIL) |
Set the new Low Level IL for the current analysis context. | |
void | SetMediumLevelILFunction (Ref< MediumLevelILFunction > mediumLevelIL) |
Set the new Medium Level IL for the current analysis context. | |
void | SetHighLevelILFunction (Ref< HighLevelILFunction > highLevelIL) |
Set the new High Level IL for the current analysis context. | |
bool | Inform (const std::string &request) |
![]() | |
CoreRefCountObject () | |
virtual | ~CoreRefCountObject () |
BNAnalysisContext * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | ReleaseForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Additional Inherited Members | |
![]() | |
static BNAnalysisContext * | GetObject (CoreRefCountObject *obj) |
static BNAnalysisContext * | GetObject (const CoreRefCountObject *obj) |
![]() | |
std::atomic< int > | m_refs |
bool | m_registeredRef |
BNAnalysisContext * | m_object |
AnalysisContext::AnalysisContext | ( | BNAnalysisContext * | analysisContext | ) |
|
virtual |
Ref< BinaryView > AnalysisContext::GetBinaryView | ( | ) |
Get the BinaryView for the current AnalysisContext.
Get the Function for the current AnalysisContext.
Ref< LowLevelILFunction > AnalysisContext::GetLowLevelILFunction | ( | ) |
Get the low level IL function for the current AnalysisContext.
Ref< MediumLevelILFunction > AnalysisContext::GetMediumLevelILFunction | ( | ) |
Get the medium level IL function for the current AnalysisContext.
Ref< HighLevelILFunction > AnalysisContext::GetHighLevelILFunction | ( | ) |
Get the high level IL function for the current AnalysisContext.
void AnalysisContext::SetBasicBlockList | ( | std::vector< Ref< BasicBlock > > | basicBlocks | ) |
Set a new BasicBlock list for the current analysis context.
basicBlocks | The new list of BasicBlocks |
void AnalysisContext::SetLiftedILFunction | ( | Ref< LowLevelILFunction > | liftedIL | ) |
Set new lifted IL for the current analysis context.
liftedIL | The new lifted IL |
void AnalysisContext::SetLowLevelILFunction | ( | Ref< LowLevelILFunction > | lowLevelIL | ) |
Set the new Low Level IL for the current analysis context.
lowLevelIL | the new Low Level IL |
void AnalysisContext::SetMediumLevelILFunction | ( | Ref< MediumLevelILFunction > | mediumLevelIL | ) |
Set the new Medium Level IL for the current analysis context.
mediumLevelIL | the new Medium Level IL |
void AnalysisContext::SetHighLevelILFunction | ( | Ref< HighLevelILFunction > | highLevelIL | ) |
Set the new High Level IL for the current analysis context.
highLevelIL | the new High Level IL |
bool AnalysisContext::Inform | ( | const std::string & | request | ) |
class BinaryNinja::Activity |
Public Member Functions | |
Activity (const std::string &configuration, const std::function< void(Ref< AnalysisContext >)> &action, const std::function< bool(Ref< Activity >, Ref< AnalysisContext >)> &eligibility=nullptr) | |
Activity (BNActivity *activity) | |
virtual | ~Activity () |
std::string | GetName () const |
Get the Activity name. | |
![]() | |
CoreRefCountObject () | |
virtual | ~CoreRefCountObject () |
BNActivity * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | ReleaseForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Static Protected Member Functions | |
static void | RunAction (void *ctxt, BNAnalysisContext *analysisContext) |
static bool | CheckEligibility (void *ctxt, BNActivity *activity, BNAnalysisContext *analysisContext) |
Protected Attributes | |
std::function< void(Ref< AnalysisContext > analysisContext)> | m_action |
std::function< bool(Ref< Activity >, Ref< AnalysisContext >)> | m_eligibility |
Additional Inherited Members | |
![]() | |
static BNActivity * | GetObject (CoreRefCountObject *obj) |
static BNActivity * | GetObject (const CoreRefCountObject *obj) |
![]() | |
std::atomic< int > | m_refs |
bool | m_registeredRef |
BNActivity * | m_object |
BinaryNinja::Activity::Activity | ( | const std::string & | configuration, |
const std::function< void(Ref< AnalysisContext >)> & | action, | ||
const std::function< bool(Ref< Activity >, Ref< AnalysisContext >)> & | eligibility = nullptr ) |
configuration | a JSON representation of the activity configuration |
action | Workflow action, a function taking a Ref<AnalysisContext> as an argument. |
eligibility | A function that determines whether the activity is eligible to run |
Activity::Activity | ( | BNActivity * | activity | ) |
|
virtual |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
class BinaryNinja::Workflow |
Workflows are represented as Directed Acyclic Graphs (DAGs), where each node corresponds to an Activity (an individual analysis or action).
Workflows are used to tailor the analysis process for :class:`BinaryView` or :class:`Function` objects, providing granular control over analysis tasks at module or function levels.
A Workflow starts in an unregistered state, either by creating a new empty Workflow or by cloning an existing one. While unregistered, it is possible to add and remove Activity objects, as well as modify the execution strategy. To apply a Workflow to a binary, it must be registered. Once registered, the Workflow becomes immutable and is available for use.
Public Member Functions | |
Workflow (const std::string &name="") | |
Workflow (BNWorkflow *workflow) | |
Workflow (BNWorkflow *workflow, Ref< BinaryView > view) | |
Workflow (BNWorkflow *workflow, Ref< Function > function) | |
virtual | ~Workflow () |
Ref< Workflow > | Clone (const std::string &name="", const std::string &activity="") |
Clone a workflow, copying all Activities and the execution strategy. | |
Ref< Activity > | RegisterActivity (const std::string &configuration, const std::function< void(Ref< AnalysisContext >)> &action, const std::vector< std::string > &subactivities={}) |
Register an Activity with this Workflow. | |
Ref< Activity > | RegisterActivity (Ref< Activity > activity, const std::vector< std::string > &subactivities={}) |
Register an Activity with this Workflow. | |
bool | Contains (const std::string &activity) |
Determine if an Activity exists in this Workflow. | |
std::string | GetConfiguration (const std::string &activity="") |
Retrieve the configuration as an adjacency list in JSON for the Workflow, or if specified just for the given ``activity``. | |
std::string | GetName () const |
Get the workflow name. | |
bool | IsRegistered () const |
Check whether the workflow is registered. | |
size_t | Size () const |
Get the amount of registered activities for this Workflow. | |
Ref< Activity > | GetActivity (const std::string &activity) |
Retrieve an activity by name. | |
std::vector< std::string > | GetActivityRoots (const std::string &activity="") |
Retrieve the list of activity roots for the Workflow, or if specified just for the given `activity`. | |
std::vector< std::string > | GetSubactivities (const std::string &activity="", bool immediate=true) |
Retrieve the list of all activities, or optionally a filtered list. | |
bool | AssignSubactivities (const std::string &activity, const std::vector< std::string > &subactivities={}) |
Assign the list of `activities` as the new set of children for the specified `activity`. | |
bool | Clear () |
Remove all activity nodes from this Workflow. | |
bool | Insert (const std::string &activity, const std::string &newActivity) |
Insert an activity before the specified activity and at the same level. | |
bool | Insert (const std::string &activity, const std::vector< std::string > &activities) |
Insert a list of activities before the specified activity and at the same level. | |
bool | InsertAfter (const std::string &activity, const std::string &newActivity) |
Insert an activity after the specified activity and at the same level. | |
bool | InsertAfter (const std::string &activity, const std::vector< std::string > &activities) |
Insert a list of activities after the specified activity and at the same level. | |
bool | Remove (const std::string &activity) |
Remove an activity by name. | |
bool | Replace (const std::string &activity, const std::string &newActivity) |
Replace the activity name. | |
Ref< FlowGraph > | GetGraph (const std::string &activity="", bool sequential=false) |
Generate a FlowGraph object for the current Workflow. | |
void | ShowReport (const std::string &name) |
std::vector< std::string > | GetEligibilitySettings () |
WorkflowMachine * | GetWorkflowMachine () const |
![]() | |
CoreRefCountObject () | |
virtual | ~CoreRefCountObject () |
BNWorkflow * | GetObject () const |
void | AddRef () |
void | Release () |
void | AddRefForRegistration () |
void | ReleaseForRegistration () |
void | AddRefForCallback () |
void | ReleaseForCallback () |
Static Public Member Functions | |
static std::vector< Ref< Workflow > > | GetList () |
Get a list of all workflows. | |
static Ref< Workflow > | Instance (const std::string &name="") |
Get an instance of a workflow by name. | |
static bool | RegisterWorkflow (Ref< Workflow > workflow, const std::string &description="") |
Register a workflow, making it immutable and available for use. | |
![]() | |
static BNWorkflow * | GetObject (CoreRefCountObject *obj) |
static BNWorkflow * | GetObject (const CoreRefCountObject *obj) |
Additional Inherited Members | |
![]() | |
std::atomic< int > | m_refs |
bool | m_registeredRef |
BNWorkflow * | m_object |
BinaryNinja::Workflow::Workflow | ( | const std::string & | name = "" | ) |
Workflow::Workflow | ( | BNWorkflow * | workflow | ) |
Workflow::Workflow | ( | BNWorkflow * | workflow, |
Ref< BinaryView > | view ) |
Workflow::Workflow | ( | BNWorkflow * | workflow, |
Ref< Function > | function ) |
|
inlinevirtual |
Get a list of all workflows.
|
static |
Register a workflow, making it immutable and available for use.
workflow | The workflow to register |
description | A JSON description of the Workflow |
Ref< Activity > BinaryNinja::Workflow::RegisterActivity | ( | const std::string & | configuration, |
const std::function< void(Ref< AnalysisContext >)> & | action, | ||
const std::vector< std::string > & | subactivities = {} ) |
bool Workflow::Contains | ( | const std::string & | activity | ) |
string Workflow::GetConfiguration | ( | const std::string & | activity = "" | ) |
Retrieve the configuration as an adjacency list in JSON for the Workflow, or if specified just for the given ``activity``.
activity | If specified, return the configuration for the ``activity`` |
string Workflow::GetName | ( | ) | const |
Get the workflow name.
bool Workflow::IsRegistered | ( | ) | const |
Check whether the workflow is registered.
size_t Workflow::Size | ( | ) | const |
Get the amount of registered activities for this Workflow.
vector< string > Workflow::GetActivityRoots | ( | const std::string & | activity = "" | ) |
Retrieve the list of activity roots for the Workflow, or if specified just for the given `activity`.
activity | If specified, return the roots for `activity` |
vector< string > Workflow::GetSubactivities | ( | const std::string & | activity = "", |
bool | immediate = true ) |
Retrieve the list of all activities, or optionally a filtered list.
activity | If specified, return the direct children and optionally the descendants of the `activity` (includes `activity`) |
immediate | whether to include only direct children of `activity` or all descendants |
bool Workflow::AssignSubactivities | ( | const std::string & | activity, |
const std::vector< std::string > & | subactivities = {} ) |
Assign the list of `activities` as the new set of children for the specified `activity`.
activity | The activity node to assign children |
subactivities | the list of Activities to assign |
bool Workflow::Clear | ( | ) |
Remove all activity nodes from this Workflow.
bool BinaryNinja::Workflow::Insert | ( | const std::string & | activity, |
const std::string & | newActivity ) |
Insert an activity before the specified activity and at the same level.
activity | Name of the activity to insert the new one before |
newActivity | Name of the new activity to be inserted |
bool BinaryNinja::Workflow::Insert | ( | const std::string & | activity, |
const std::vector< std::string > & | activities ) |
Insert a list of activities before the specified activity and at the same level.
activity | Name of the activity to insert the new one before |
newActivity | Name of the new activities to be inserted |
bool BinaryNinja::Workflow::InsertAfter | ( | const std::string & | activity, |
const std::string & | newActivity ) |
Insert an activity after the specified activity and at the same level.
activity | Name of the activity to insert the new one after |
newActivity | Name of the new activity to be inserted |
bool BinaryNinja::Workflow::InsertAfter | ( | const std::string & | activity, |
const std::vector< std::string > & | activities ) |
Insert a list of activities after the specified activity and at the same level.
activity | Name of the activity to insert the new one after |
newActivity | Name of the new activities to be inserted |
bool Workflow::Remove | ( | const std::string & | activity | ) |
Remove an activity by name.
activity | Name of the activity to remove |
bool Workflow::Replace | ( | const std::string & | activity, |
const std::string & | newActivity ) |
Replace the activity name.
activity | Name of the activity to replace |
newActivity | Name of the new activity |
void Workflow::ShowReport | ( | const std::string & | name | ) |
vector< string > Workflow::GetEligibilitySettings | ( | ) |
|
inline |