Binary Ninja API C++: Interaction
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::GetCheckboxInput (int64_t &result, const std::string &prompt, const std::string &title, const int64_t &defaultChoice) |
| Prompts the user for a checkbox input. | |
| 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. | |
◆ 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="") |
| static FormInputField | Checkbox (const std::string &prompt, const bool &defaultChoice=false) |
Public Attributes | |
| BNFormInputFieldType | type |
| std::string | prompt |
| Ref< BinaryView > | view |
| 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 |
◆ Label()
|
static |
◆ Separator()
|
static |
◆ TextLine()
|
static |
◆ MultilineText()
|
static |
◆ Integer()
|
static |
◆ Address()
|
static |
◆ Choice()
|
static |
◆ OpenFileName()
|
static |
◆ SaveFileName()
|
static |
◆ DirectoryName()
|
static |
◆ Checkbox()
|
static |
◆ type
◆ prompt
std::string BinaryNinja::FormInputField::prompt
◆ 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 | GetCheckboxInput (int64_t &result, const std::string &prompt, const std::string &title, const int64_t &defaultChoice=0) |
| 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(ProgressFunction progress)> task)=0 |
◆ ShowPlainTextReport()
|
pure virtual |
◆ ShowMarkdownReport()
|
virtual |
◆ ShowHTMLReport()
|
virtual |
◆ ShowGraphReport()
|
virtual |
◆ ShowReportCollection()
|
virtual |
◆ GetTextLineInput()
|
pure virtual |
◆ GetIntegerInput()
|
virtual |
◆ GetAddressInput()
|
virtual |
◆ GetChoiceInput()
|
pure virtual |
◆ GetLargeChoiceInput()
|
pure virtual |
◆ GetOpenFileNameInput()
|
virtual |
◆ GetSaveFileNameInput()
|
virtual |
◆ GetDirectoryNameInput()
|
virtual |
◆ GetCheckboxInput()
|
virtual |
◆ GetFormInput()
|
pure virtual |
◆ ShowMessageBox()
◆ OpenUrl()
|
pure virtual |
◆ RunProgressDialog()
|
pure virtual |
◆ 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
-
title Title for the report contents Contents 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
-
title Title for the report contents Markdown contents of the report plainText Plaintext 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
-
title Title for the report contents HTML contents of the report plainText Plaintext 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
-
title Title for the report graph FlowGraph object to be rendered.
◆ ShowReportCollection()
| void BinaryNinja::ShowReportCollection | ( | const std::string & | title, |
| ReportCollection * | reports ) |
Show a collection of reports.
Thread Safe: - Yes
- Parameters
-
title Title for the collection of reports reports Collection 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] result Reference to the string the result will be copied to [in] prompt Prompt for the input [in] title Title 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] result Reference to the int64_t the result will be copied to [in] prompt Prompt for the input [in] title Title 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] result Reference to the uint64_t the result will be copied to [in] prompt Prompt for the input [in] title Title 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] idx Reference to the size_t the resulting index selected will be copied to [in] prompt Prompt for the input [in] title Title for the input popup when used in UI [in] choices List 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] idx Reference to the size_t the resulting index selected will be copied to [in] title Title for the input popup / prompt for headless [in] prompt Prompt for the input (shown on the 'Select' button in UI) [in] choices List 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] result Reference to the string the result will be copied to [in] prompt Prompt for the dialog [in] ext Optional, 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] result Reference to the string the result will be copied to [in] prompt Prompt for the dialog [in] ext Optional, file extension [in] defaultName Optional, 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] result Reference to the string the result will be copied to [in] prompt Prompt for the dialog [in] defaultName Optional, default directory name
- Returns
- Whether a directory was successfully received
◆ GetCheckboxInput()
| bool BinaryNinja::GetCheckboxInput | ( | int64_t & | result, |
| const std::string & | prompt, | ||
| const std::string & | title, | ||
| const int64_t & | defaultChoice ) |
Prompts the user for a checkbox input.
- Parameters
-
[out] result Reference to the integer the result will be copied to [in] prompt Prompt for the dialog [in] title Title for the input popup when used in UI [in] defaultChoice Default checkbox state (0 == unchecked, 1 == checked)
- Returns
- Whether a checkbox input 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] fields reference to a list containing FieldInputFields [in] title Title of the Form
- Returns
- Whether the form was successfully filled out
◆ ShowMessageBox()
Displays a configurable message box in the UI, or prompts on the console as appropriate.
Thread Safe: - Yes
- Parameters
-
title Title for the message box text Contents 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
icon Icons to display to the user
- Returns
- Which button was selected'
- Return values
-
NoButton No was clicked, or the box was closed and had type YesNoButtonSet YesButton Yes was clicked OKButton Ok Button was clicked, or the box was closed and had type OKButtonSet CancelButton Cancel 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
- Returns
- Whether a URL was successfully opened.