interaction module¶
Class | Description |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
AddressField¶
- classAddressField[source]¶
Bases:
objectAddressFieldprompts the user for an address. By passing the optional view and current_address parameters offsets can be used instead of just an address. The result is stored as in int in self.result.Note
This API currently functions differently on the command-line, as the view and current_address are disregarded. Additionally where as in the UI the result defaults to hexadecimal on the command-line 0x must be specified.
- __init__(prompt:str,view:BinaryView|None=None,current_address:int=0,default:int|None=None)[source]¶
- Parameters:
prompt (str) –
view (BinaryView |None) –
current_address (int) –
default (int |None) –
- propertycurrent_address¶
current address to use as a base for relative calculations
- propertyprompt¶
prompt to be presented to the user
- propertyresult¶
- propertyview¶
BinaryView for the address
CheckboxField¶
ChoiceField¶
DirectoryNameField¶
FlowGraphReport¶
HTMLReport¶
IntegerField¶
InteractionHandler¶
LabelField¶
MarkdownReport¶
MultilineTextField¶
OpenFileNameField¶
PlainTextReport¶
ReportCollection¶
SaveFileNameField¶
SeparatorField¶
TextLineField¶
get_address_input¶
get_checkbox_input¶
- classget_checkbox_input[source]¶
Bases:
get_checkbox_inputprompts the user for a checkbox input:param prompt: String to prompt with:param title: Title of the window when executed in the UI:param default: Optional default state for the checkbox (false == unchecked, true == checked), False if not set.:rtype: bool indicating the state of the checkbox
get_choice_input¶
- classget_choice_input[source]¶
Bases:
get_choice_inputprompts the user to select the one of the provided choicesNote
This API function differently on the command-line vs the UI. In the UI a pop-up is used. On the command-line a simple text prompt is used. The UI uses a combo box.
- Parameters:
- Return type:
integer array index of the selected option
- Example:
>>>get_choice_input("PROMPT>","choices",["Yes","No","Maybe"])choices1) Yes2) No3) MaybePROMPT> 10L
get_directory_name_input¶
- classget_directory_name_input[source]¶
Bases:
get_directory_name_inputprompts the user for a directory name to save as, optionally providing a default_nameNote
This API function differently on the command-line vs the UI. In the UI a pop-up is used. On the command-line a simple text prompt is used. The UI uses the native window pop-up for file selection.
get_form_input¶
- classget_form_input[source]¶
Bases:
get_from_inputPrompts the user for a set of inputs specified infieldswith given title. The fields parameter is a list which can contain the following types:FieldType
Description
str
an alias for LabelField
None
an alias for SeparatorField
LabelField
Text output
SeparatorField
Vertical spacing
TextLineField
Prompt for a string value
MultilineTextField
Prompt for multi-line string value
IntegerField
Prompt for an integer
AddressField
Prompt for an address
ChoiceField
Prompt for a choice from provided options
OpenFileNameField
Prompt for file to open
SaveFileNameField
Prompt for file to save to
DirectoryNameField
Prompt for directory name
CheckboxFormField
Prompt for a checkbox
This API is flexible and works both in the UI via a pop-up dialog and on the command-line.
Note
More complicated APIs should consider using the included pyside2 functionality in thebinaryninjaui module. Returns true or false depending on whether the user submitted responses or cancelled the dialog.
- Parameters:
fields (list(str) orlist(None) orlist(LabelField) orlist(SeparatorField) orlist(TextLineField) orlist(MultilineTextField) orlist(IntegerField) orlist(AddressField) orlist(ChoiceField) orlist(OpenFileNameField) orlist(SaveFileNameField) orlist(DirectoryNameField)) – A list containing these classes, strings or None
title (str) – The title of the pop-up dialog
- Return type:
- Example:
>>>int_f=IntegerField("Specify Integer")>>>tex_f=TextLineField("Specify name")>>>choice_f=ChoiceField("Options",["Yes","No","Maybe"])>>>get_form_input(["Get Data",None,int_f,tex_f,choice_f],"The options")Get Data<empty>Specify Integer 1337Specify name PeterThe options1) Yes2) No3) MaybeOptions 1>>>True>>>print(tex_f.result,int_f.result,choice_f.result)Peter 1337 0
get_int_input¶
get_large_choice_input¶
- classget_large_choice_input[source]¶
Bases:
get_large_choice_inputprompts the user to select the one of the provided choices from a large poolNote
This API function differently on the command-line vs the UI. In the UI a pop-up is used. On the command-line a text prompt is used. The UI uses a filterable list of entries
- Parameters:
- Return type:
integer array index of the selected option
- Example:
>>>get_large_choice_input("Select Function","Select a Function",[f.symbol.short_nameforfinbv.functions])
get_open_filename_input¶
- classget_open_filename_input[source]¶
Bases:
get_open_filename_inputprompts the user for a file name to openNote
This API functions differently on the command-line vs the UI. In the UI a pop-up is used. On the command-line a simple text prompt is used. The UI uses the native window pop-up for file selection.
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:
- Example:
>>>get_open_filename_input("filename:","*.py")'test.py'>>>get_open_filename_input("filename:","All Files (*)")'test.py'>>>get_open_filename_input("filename:","Executables (*.exe)")'foo.exe'>>>get_open_filename_input("filename:","Executables (*.exe *.com)")'foo.exe'>>>get_open_filename_input("filename:","Executables (*.exe *.com);;Python Files (*.py);;All Files (*)")'foo.exe'
get_save_filename_input¶
- classget_save_filename_input[source]¶
Bases:
get_save_filename_inputprompts the user for a file name to save as, optionally providing a file extension and default_nameNote
This API function differently on the command-line vs the UI. In the UI a pop-up is used. On the command-line a simple text prompt is used. The UI uses the native window pop-up for file selection.
- Parameters:
- Example:
>>>get_save_filename_input("filename:","*.py","test.py")filename: test.py'test.py'>>>get_save_filename_input("filename:","All Files (*)","test.py")filename: test.py'test.py'>>>get_save_filename_input("filename:","Executables (*.exe)","foo.exe")filename: foo.exe'foo.exe'>>>get_save_filename_input("filename:","Executables (*.exe *.com)","foo.exe")filename: foo.exe'foo.exe'>>>get_save_filename_input("filename:","Executables (*.exe *.com);;Python Files (*.py);;All Files (*)","foo.exe")filename: foo.exe'foo.exe'
get_text_line_input¶
markdown_to_html¶
open_url¶
run_progress_dialog¶
- classrun_progress_dialog[source]¶
Bases:
run_progress_dialogruns a given task in a background thread, showing an updatingprogress bar which the user can cancel.- Parameters:
title – Dialog title
can_cancel – If the task can be cancelled
task – Function to perform the task, taking as a parameter a function which should be called to report progress updates and check for cancellation. If the progress function returns false, the user has requested to cancel, and the task should handle this appropriately.
- Returns:
True if not cancelled
show_graph_report¶
- classshow_graph_report[source]¶
Bases:
show_graph_reportdisplays a flow graph in UI applications and nothing in command-line applications. This API doesn’t support clickable references into an existing BinaryView. Use theBinaryView.show_html_reportAPI if hyperlinking is needed.Note
This API function will have no effect outside the UI.
show_html_report¶
show_markdown_report¶
- classshow_markdown_report[source]¶
Bases:
show_markdown_reportdisplays the markdown contents in UI applications and plaintext in command-line applications. This API doesn’t support hyperlinking into the BinaryView, use theBinaryView.show_markdown_reportAPI if hyperlinking is needed.Note
This API function differently on the command-line vs the UI. In the UI a pop-up is used. On the command-line a simple text prompt is used.
show_message_box¶
- classshow_message_box[source]¶
Bases:
show_message_boxDisplays a configurable message box in the UI, or prompts on the console as appropriate- Note:
This uses a standard QDialog which means simple HTML will render as HTML, but links are not clickable and special characters need to be escaped.
- Parameters:
title (str) – Text title for the message box.
text (str) – Text for the main body of the message box.
buttons (MessageBoxButtonSet) – One of
MessageBoxButtonSeticon (MessageBoxIcon) – One of
MessageBoxIcon
- Returns:
Which button was selected
- Return type:
show_plain_text_report¶
show_report_collection¶
- classshow_report_collection[source]¶
Bases:
show_report_collectiondisplays multiple reports in UI applicationsNote
This API function will have no effect outside the UI.
- Parameters:
reports (ReportCollection) – Reports to display
- Return type:
None