Loading...
Searching...
No Matches
Interaction

Detailed Description

Classes

struct  BinaryNinja::FormInputField
 
class  BinaryNinja::InteractionHandler
 

Functions

void BinaryNinja::ShowPlainTextReport (const std::string &title, const std::string &contents)
 Displays contents to the user in the UI or on the command-line.
 
void BinaryNinja::ShowMarkdownReport (const std::string &title, const std::string &contents, const std::string &plainText="")
 Displays markdown contents to the user in the UI or on the command-line.
 
void BinaryNinja::ShowHTMLReport (const std::string &title, const std::string &contents, const std::string &plainText="")
 Displays HTML contents to the user in the UI or on the command-line.
 
void BinaryNinja::ShowGraphReport (const std::string &title, FlowGraph *graph)
 Displays a flow graph in UI applications and nothing in command-line applications.
 
void BinaryNinja::ShowReportCollection (const std::string &title, ReportCollection *reports)
 Show a collection of reports.
 
bool BinaryNinja::GetTextLineInput (std::string &result, const std::string &prompt, const std::string &title)
 Prompts the user to input a string with the given prompt and title.
 
bool BinaryNinja::GetIntegerInput (int64_t &result, const std::string &prompt, const std::string &title)
 Prompts the user to input an integer with the given prompt and title.
 
bool BinaryNinja::GetAddressInput (uint64_t &result, const std::string &prompt, const std::string &title)
 Prompts the user to input an unsigned integer with the given prompt and title.
 
bool BinaryNinja::GetChoiceInput (size_t &idx, const std::string &prompt, const std::string &title, const std::vector< std::string > &choices)
 Prompts the user to select the one of the provided choices.
 
bool BinaryNinja::GetLargeChoiceInput (size_t &idx, const std::string &title, const std::string &prompt, const std::vector< std::string > &choices)
 Prompts the user to select the one of the provided choices out of a large list, with the option to filter choices.
 
bool BinaryNinja::GetOpenFileNameInput (std::string &result, const std::string &prompt, const std::string &ext="")
 Prompts the user for a file name to open.
 
bool BinaryNinja::GetSaveFileNameInput (std::string &result, const std::string &prompt, const std::string &ext="", const std::string &defaultName="")
 Prompts the user for a file name to save as, optionally providing a file extension and defaultName.
 
bool BinaryNinja::GetDirectoryNameInput (std::string &result, const std::string &prompt, const std::string &defaultName="")
 Prompts the user for a directory name to save as, optionally providing a default_name.
 
bool BinaryNinja::GetFormInput (std::vector< FormInputField > &fields, const std::string &title)
 Prompts the user for a set of inputs specified in `fields` with given title.
 
BNMessageBoxButtonResult BinaryNinja::ShowMessageBox (const std::string &title, const std::string &text, BNMessageBoxButtonSet buttons=OKButtonSet, BNMessageBoxIcon icon=InformationIcon)
 Displays a configurable message box in the UI, or prompts on the console as appropriate.
 
bool BinaryNinja::OpenUrl (const std::string &url)
 Opens a given url in the user's web browser, if available.
 

Class Documentation

◆ BinaryNinja::FormInputField

struct BinaryNinja::FormInputField

Static Public Member Functions

static FormInputField Label (const std::string &text)
 
static FormInputField Separator ()
 
static FormInputField TextLine (const std::string &prompt)
 
static FormInputField MultilineText (const std::string &prompt)
 
static FormInputField Integer (const std::string &prompt)
 
static FormInputField Address (const std::string &prompt, BinaryView *view=nullptr, uint64_t currentAddress=0)
 
static FormInputField Choice (const std::string &prompt, const std::vector< std::string > &choices)
 
static FormInputField OpenFileName (const std::string &prompt, const std::string &ext)
 
static FormInputField SaveFileName (const std::string &prompt, const std::string &ext, const std::string &defaultName="")
 
static FormInputField DirectoryName (const std::string &prompt, const std::string &defaultName="")
 

Public Attributes

BNFormInputFieldType type
 
std::string prompt
 
Ref< BinaryViewview
 
uint64_t currentAddress
 
std::vector< std::string > choices
 
std::string ext
 
std::string defaultName
 
int64_t intResult
 
uint64_t addressResult
 
std::string stringResult
 
size_t indexResult
 
bool hasDefault
 
int64_t intDefault
 
uint64_t addressDefault
 
std::string stringDefault
 
size_t indexDefault
 

Member Function Documentation

◆ Label()

FormInputField FormInputField::Label ( const std::string & text)
static

◆ Separator()

FormInputField FormInputField::Separator ( )
static

◆ TextLine()

FormInputField FormInputField::TextLine ( const std::string & prompt)
static

◆ MultilineText()

FormInputField FormInputField::MultilineText ( const std::string & prompt)
static

◆ Integer()

FormInputField FormInputField::Integer ( const std::string & prompt)
static

◆ Address()

FormInputField FormInputField::Address ( const std::string & prompt,
BinaryView * view = nullptr,
uint64_t currentAddress = 0 )
static

◆ Choice()

FormInputField FormInputField::Choice ( const std::string & prompt,
const std::vector< std::string > & choices )
static

◆ OpenFileName()

FormInputField FormInputField::OpenFileName ( const std::string & prompt,
const std::string & ext )
static

◆ SaveFileName()

FormInputField FormInputField::SaveFileName ( const std::string & prompt,
const std::string & ext,
const std::string & defaultName = "" )
static

◆ DirectoryName()

FormInputField FormInputField::DirectoryName ( const std::string & prompt,
const std::string & defaultName = "" )
static

Member Data Documentation

◆ type

BNFormInputFieldType BinaryNinja::FormInputField::type

◆ prompt

std::string BinaryNinja::FormInputField::prompt

◆ view

Ref<BinaryView> BinaryNinja::FormInputField::view

◆ currentAddress

uint64_t BinaryNinja::FormInputField::currentAddress

◆ choices

std::vector<std::string> BinaryNinja::FormInputField::choices

◆ ext

std::string BinaryNinja::FormInputField::ext

◆ defaultName

std::string BinaryNinja::FormInputField::defaultName

◆ intResult

int64_t BinaryNinja::FormInputField::intResult

◆ addressResult

uint64_t BinaryNinja::FormInputField::addressResult

◆ stringResult

std::string BinaryNinja::FormInputField::stringResult

◆ indexResult

size_t BinaryNinja::FormInputField::indexResult

◆ hasDefault

bool BinaryNinja::FormInputField::hasDefault

◆ intDefault

int64_t BinaryNinja::FormInputField::intDefault

◆ addressDefault

uint64_t BinaryNinja::FormInputField::addressDefault

◆ stringDefault

std::string BinaryNinja::FormInputField::stringDefault

◆ indexDefault

size_t BinaryNinja::FormInputField::indexDefault

◆ BinaryNinja::InteractionHandler

class BinaryNinja::InteractionHandler

Public Member Functions

virtual void ShowPlainTextReport (Ref< BinaryView > view, const std::string &title, const std::string &contents)=0
 
virtual void ShowMarkdownReport (Ref< BinaryView > view, const std::string &title, const std::string &contents, const std::string &plainText)
 
virtual void ShowHTMLReport (Ref< BinaryView > view, const std::string &title, const std::string &contents, const std::string &plainText)
 
virtual void ShowGraphReport (Ref< BinaryView > view, const std::string &title, Ref< FlowGraph > graph)
 
virtual void ShowReportCollection (const std::string &title, Ref< ReportCollection > reports)
 
virtual bool GetTextLineInput (std::string &result, const std::string &prompt, const std::string &title)=0
 
virtual bool GetIntegerInput (int64_t &result, const std::string &prompt, const std::string &title)
 
virtual bool GetAddressInput (uint64_t &result, const std::string &prompt, const std::string &title, Ref< BinaryView > view, uint64_t currentAddr)
 
virtual bool GetChoiceInput (size_t &idx, const std::string &prompt, const std::string &title, const std::vector< std::string > &choices)=0
 
virtual bool GetLargeChoiceInput (size_t &idx, const std::string &prompt, const std::string &title, const std::vector< std::string > &choices)=0
 
virtual bool GetOpenFileNameInput (std::string &result, const std::string &prompt, const std::string &ext="")
 
virtual bool GetSaveFileNameInput (std::string &result, const std::string &prompt, const std::string &ext="", const std::string &defaultName="")
 
virtual bool GetDirectoryNameInput (std::string &result, const std::string &prompt, const std::string &defaultName="")
 
virtual bool GetFormInput (std::vector< FormInputField > &fields, const std::string &title)=0
 
virtual BNMessageBoxButtonResult ShowMessageBox (const std::string &title, const std::string &text, BNMessageBoxButtonSet buttons=OKButtonSet, BNMessageBoxIcon icon=InformationIcon)=0
 
virtual bool OpenUrl (const std::string &url)=0
 
virtual bool RunProgressDialog (const std::string &title, bool canCancel, std::function< void(std::function< bool(size_t, size_t)> progress)> task)=0
 

Member Function Documentation

◆ ShowPlainTextReport()

virtual void BinaryNinja::InteractionHandler::ShowPlainTextReport ( Ref< BinaryView > view,
const std::string & title,
const std::string & contents )
pure virtual

◆ ShowMarkdownReport()

void InteractionHandler::ShowMarkdownReport ( Ref< BinaryView > view,
const std::string & title,
const std::string & contents,
const std::string & plainText )
virtual

◆ ShowHTMLReport()

void InteractionHandler::ShowHTMLReport ( Ref< BinaryView > view,
const std::string & title,
const std::string & contents,
const std::string & plainText )
virtual

◆ ShowGraphReport()

void InteractionHandler::ShowGraphReport ( Ref< BinaryView > view,
const std::string & title,
Ref< FlowGraph > graph )
virtual

◆ ShowReportCollection()

void InteractionHandler::ShowReportCollection ( const std::string & title,
Ref< ReportCollection > reports )
virtual

◆ GetTextLineInput()

virtual bool BinaryNinja::InteractionHandler::GetTextLineInput ( std::string & result,
const std::string & prompt,
const std::string & title )
pure virtual

◆ GetIntegerInput()

bool InteractionHandler::GetIntegerInput ( int64_t & result,
const std::string & prompt,
const std::string & title )
virtual

◆ GetAddressInput()

bool InteractionHandler::GetAddressInput ( uint64_t & result,
const std::string & prompt,
const std::string & title,
Ref< BinaryView > view,
uint64_t currentAddr )
virtual

◆ GetChoiceInput()

virtual bool BinaryNinja::InteractionHandler::GetChoiceInput ( size_t & idx,
const std::string & prompt,
const std::string & title,
const std::vector< std::string > & choices )
pure virtual

◆ GetLargeChoiceInput()

virtual bool BinaryNinja::InteractionHandler::GetLargeChoiceInput ( size_t & idx,
const std::string & prompt,
const std::string & title,
const std::vector< std::string > & choices )
pure virtual

◆ GetOpenFileNameInput()

bool InteractionHandler::GetOpenFileNameInput ( std::string & result,
const std::string & prompt,
const std::string & ext = "" )
virtual

◆ GetSaveFileNameInput()

bool InteractionHandler::GetSaveFileNameInput ( std::string & result,
const std::string & prompt,
const std::string & ext = "",
const std::string & defaultName = "" )
virtual

◆ GetDirectoryNameInput()

bool InteractionHandler::GetDirectoryNameInput ( std::string & result,
const std::string & prompt,
const std::string & defaultName = "" )
virtual

◆ GetFormInput()

virtual bool BinaryNinja::InteractionHandler::GetFormInput ( std::vector< FormInputField > & fields,
const std::string & title )
pure virtual

◆ ShowMessageBox()

virtual BNMessageBoxButtonResult BinaryNinja::InteractionHandler::ShowMessageBox ( const std::string & title,
const std::string & text,
BNMessageBoxButtonSet buttons = OKButtonSet,
BNMessageBoxIcon icon = InformationIcon )
pure virtual

◆ OpenUrl()

virtual bool BinaryNinja::InteractionHandler::OpenUrl ( const std::string & url)
pure virtual

◆ RunProgressDialog()

virtual bool BinaryNinja::InteractionHandler::RunProgressDialog ( const std::string & title,
bool canCancel,
std::function< void(std::function< bool(size_t, size_t)> progress)> task )
pure virtual

Function Documentation

◆ ShowPlainTextReport()

void BinaryNinja::ShowPlainTextReport ( const std::string & title,
const std::string & contents )

Displays contents to the user in the UI or on the command-line.

Thread Safe:
Yes
Note
This API functions differently on the command-line vs the UI. In the UI, it will be rendered in a new tab. From the command line, a simple text prompt is used.
Parameters
titleTitle for the report
contentsContents of the report

◆ ShowMarkdownReport()

void BinaryNinja::ShowMarkdownReport ( const std::string & title,
const std::string & contents,
const std::string & plainText = "" )

Displays markdown contents to the user in the UI or on the command-line.

Thread Safe:
Yes
Note
This API functions differently on the command-line vs the UI. In the UI, it will be rendered in a new tab. From the command line, a simple text prompt is used.
Parameters
titleTitle for the report
contentsMarkdown contents of the report
plainTextPlaintext contents of the report (used on the command line)

◆ ShowHTMLReport()

void BinaryNinja::ShowHTMLReport ( const std::string & title,
const std::string & contents,
const std::string & plainText = "" )

Displays HTML contents to the user in the UI or on the command-line.

Thread Safe:
Yes
Note
This API functions differently on the command-line vs the UI. In the UI, it will be rendered in a new tab. From the command line, a simple text prompt is used.
This API doesn't support clickable references into an existing BinaryView.
Parameters
titleTitle for the report
contentsHTML contents of the report
plainTextPlaintext contents of the report (used on the command line)

◆ ShowGraphReport()

void BinaryNinja::ShowGraphReport ( const std::string & title,
FlowGraph * graph )

Displays a flow graph in UI applications and nothing in command-line applications.

Thread Safe:
Yes
Note
This API doesn't support clickable references into an existing BinaryView.
This API has no effect outside of the UI
Parameters
titleTitle for the report
graphFlowGraph object to be rendered.

◆ ShowReportCollection()

void BinaryNinja::ShowReportCollection ( const std::string & title,
ReportCollection * reports )

Show a collection of reports.

Thread Safe:
Yes
Parameters
titleTitle for the collection of reports
reportsCollection of reports to show

◆ GetTextLineInput()

bool BinaryNinja::GetTextLineInput ( std::string & result,
const std::string & prompt,
const std::string & title )

Prompts the user to input a string with the given prompt and title.

Thread Safe:
Yes
Parameters
[out]resultReference to the string the result will be copied to
[in]promptPrompt for the input
[in]titleTitle for the input popup when used in UI
Returns
Whether a line was successfully received

◆ GetIntegerInput()

bool BinaryNinja::GetIntegerInput ( int64_t & result,
const std::string & prompt,
const std::string & title )

Prompts the user to input an integer with the given prompt and title.

Thread Safe:
Yes
Parameters
[out]resultReference to the int64_t the result will be copied to
[in]promptPrompt for the input
[in]titleTitle for the input popup when used in UI
Returns
Whether an integer was successfully received

◆ GetAddressInput()

bool BinaryNinja::GetAddressInput ( uint64_t & result,
const std::string & prompt,
const std::string & title )

Prompts the user to input an unsigned integer with the given prompt and title.

Thread Safe:
Yes
Parameters
[out]resultReference to the uint64_t the result will be copied to
[in]promptPrompt for the input
[in]titleTitle for the input popup when used in UI
Returns
Whether an integer was successfully received

◆ GetChoiceInput()

bool BinaryNinja::GetChoiceInput ( size_t & idx,
const std::string & prompt,
const std::string & title,
const std::vector< std::string > & choices )

Prompts the user to select the one of the provided choices.

Thread Safe:
Yes
Parameters
[out]idxReference to the size_t the resulting index selected will be copied to
[in]promptPrompt for the input
[in]titleTitle for the input popup when used in UI
[in]choicesList of string choices for the user to select from
Returns
Whether a choice was successfully picked

◆ GetLargeChoiceInput()

bool BinaryNinja::GetLargeChoiceInput ( size_t & idx,
const std::string & title,
const std::string & prompt,
const std::vector< std::string > & choices )

Prompts the user to select the one of the provided choices out of a large list, with the option to filter choices.

Parameters
[out]idxReference to the size_t the resulting index selected will be copied to
[in]titleTitle for the input popup / prompt for headless
[in]promptPrompt for the input (shown on the 'Select' button in UI)
[in]choicesList of string choices for the user to select from
Returns
Whether a choice was successfully picked

◆ GetOpenFileNameInput()

bool BinaryNinja::GetOpenFileNameInput ( std::string & result,
const std::string & prompt,
const std::string & ext = "" )

Prompts the user for a file name to open.

Thread Safe:
Yes

Multiple file selection groups can be included if separated by two semicolons. Multiple file wildcards may be specified by using a space within the parenthesis.

Also, a simple selector of "\*.extension" by itself may also be used instead of specifying the description.

Parameters
[out]resultReference to the string the result will be copied to
[in]promptPrompt for the dialog
[in]extOptional, file extension
Returns
Whether a filename was successfully received

◆ GetSaveFileNameInput()

bool BinaryNinja::GetSaveFileNameInput ( std::string & result,
const std::string & prompt,
const std::string & ext = "",
const std::string & defaultName = "" )

Prompts the user for a file name to save as, optionally providing a file extension and defaultName.

Thread Safe:
Yes
Parameters
[out]resultReference to the string the result will be copied to
[in]promptPrompt for the dialog
[in]extOptional, file extension
[in]defaultNameOptional, default filename
Returns
Whether a filename was successfully received

◆ GetDirectoryNameInput()

bool BinaryNinja::GetDirectoryNameInput ( std::string & result,
const std::string & prompt,
const std::string & defaultName = "" )

Prompts the user for a directory name to save as, optionally providing a default_name.

Thread Safe:
Yes
Parameters
[out]resultReference to the string the result will be copied to
[in]promptPrompt for the dialog
[in]defaultNameOptional, default directory name
Returns
Whether a directory was successfully received

◆ GetFormInput()

bool BinaryNinja::GetFormInput ( std::vector< FormInputField > & fields,
const std::string & title )

Prompts the user for a set of inputs specified in `fields` with given title.

The fields parameter is a list containing FieldInputFields

Thread Safe:
Yes
Parameters
[in,out]fieldsreference to a list containing FieldInputFields
[in]titleTitle of the Form
Returns
Whether the form was successfully filled out

◆ ShowMessageBox()

BNMessageBoxButtonResult BinaryNinja::ShowMessageBox ( const std::string & title,
const std::string & text,
BNMessageBoxButtonSet buttons = OKButtonSet,
BNMessageBoxIcon icon = InformationIcon )

Displays a configurable message box in the UI, or prompts on the console as appropriate.

Thread Safe:
Yes
Parameters
titleTitle for the message box
textContents of the message box
buttons

Button Set type to display to the user

OKButtonSet - Displays only an OK button YesNoButtonSet - Displays a Yes and a No button YesNoCancelButtonSet - Displays a Yes, No, and Cancel button

iconIcons to display to the user
Returns
Which button was selected'
Return values
NoButtonNo was clicked, or the box was closed and had type YesNoButtonSet
YesButtonYes was clicked
OKButtonOk Button was clicked, or the box was closed and had type OKButtonSet
CancelButtonCancel button was clicked or the dialog box was closed and had type YesNoCancelButtonSet

◆ OpenUrl()

bool BinaryNinja::OpenUrl ( const std::string & url)

Opens a given url in the user's web browser, if available.

Thread Safe:
Yes
Parameters
urlURL to open
Returns
Whether a URL was successfully opened.