interaction module¶
binaryninja.interaction.AddressField (prompt) |
AddressField prompts the user for an address. By passing the optional view and current_address parameters |
binaryninja.interaction.ChoiceField (prompt, ...) |
ChoiceField prompts the user to choose from the list of strings provided in choices . Result is stored |
binaryninja.interaction.DirectoryNameField (prompt) |
DirectoryNameField prompts the user to specify a directory name to open. Result is stored in self.result as |
binaryninja.interaction.IntegerField (prompt) |
IntegerField add prompt for integer. Result is stored in self.result as an int. |
binaryninja.interaction.InteractionHandler () |
|
binaryninja.interaction.LabelField (text) |
LabelField adds a text label to the display. |
binaryninja.interaction.MultilineTextField (prompt) |
MultilineTextField add multi-line text string input field. Result is stored in self.result |
binaryninja.interaction.OpenFileNameField (prompt) |
OpenFileNameField prompts the user to specify a file name to open. Result is stored in self.result as a string. |
binaryninja.interaction.SaveFileNameField (prompt) |
SaveFileNameField prompts the user to specify a file name to save. Result is stored in self.result as a string. |
binaryninja.interaction.SeparatorField |
SeparatorField adds vertical separation to the display. |
binaryninja.interaction.TextLineField (prompt) |
TextLineField Adds prompt for text string input. Result is stored in self.result as a string on completion. |
binaryninja.interaction.get_address_input (...) |
get_address_input prompts the user for an address with the given prompt and title. |
binaryninja.interaction.get_choice_input (...) |
get_choice_input prompts the user to select the one of the provided choices. |
binaryninja.interaction.get_directory_name_input (prompt) |
get_directory_name_input prompts the user for a directory name to save as, optionally providing a default_name. |
binaryninja.interaction.get_form_input (...) |
get_from_input Prompts the user for a set of inputs specified in fields with given title. |
binaryninja.interaction.get_int_input (...) |
get_int_input prompts the user to input a integer with the given prompt and title. |
binaryninja.interaction.get_open_filename_input (prompt) |
get_open_filename_input prompts the user for a file name to open. |
binaryninja.interaction.get_save_filename_input (prompt) |
get_save_filename_input prompts the user for a file name to save as, optionally providing a file extension and |
binaryninja.interaction.get_text_line_input (...) |
get_text_line_input prompts the user to input a string with the given prompt and title. |
binaryninja.interaction.markdown_to_html (...) |
markdown_to_html converts the provided markdown to HTML. |
binaryninja.interaction.range (*args) |
A Python2 and Python3 Compatible Range Generator |
binaryninja.interaction.show_html_report (...) |
show_html_report displays the html contents in UI applications and plaintext in command line |
binaryninja.interaction.show_markdown_report (...) |
show_markdown_report displays the markdown contents in UI applications and plaintext in command line |
binaryninja.interaction.show_message_box (...) |
show_message_box Displays a configurable message box in the UI, or prompts on the console as appropriate |
binaryninja.interaction.show_plain_text_report (...) |
show_plain_text_report displays contents to the user in the UI or on the command line. |
-
class
binaryninja.interaction.
AddressField
(prompt, view=None, current_address=0)[source]¶ Bases:
object
AddressField
prompts 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 currenlty functions differently on the command line, as the view and current_address are
- disregarded. Additionally where as in the ui the result defaults to hexidecimal on the command line 0x must be specified.
-
class
binaryninja.interaction.
ChoiceField
(prompt, choices)[source]¶ Bases:
object
ChoiceField
prompts the user to choose from the list of strings provided inchoices
. Result is stored in self.result as an index in to the choices array.Attr str prompt: prompt to be presented to the user Attr list(str) choices: list of choices to choose from
-
class
binaryninja.interaction.
DirectoryNameField
(prompt, default_name='')[source]¶ Bases:
object
DirectoryNameField
prompts the user to specify a directory name to open. Result is stored in self.result as a string.
-
class
binaryninja.interaction.
IntegerField
(prompt)[source]¶ Bases:
object
IntegerField
add prompt for integer. Result is stored in self.result as an int.
-
class
binaryninja.interaction.
LabelField
(text)[source]¶ Bases:
object
LabelField
adds a text label to the display.
-
class
binaryninja.interaction.
MultilineTextField
(prompt)[source]¶ Bases:
object
MultilineTextField
add multi-line text string input field. Result is stored in self.result as a string. This option is not supported on the command line.
-
class
binaryninja.interaction.
OpenFileNameField
(prompt, ext='')[source]¶ Bases:
object
OpenFileNameField
prompts the user to specify a file name to open. Result is stored in self.result as a string.
-
class
binaryninja.interaction.
SaveFileNameField
(prompt, ext='', default_name='')[source]¶ Bases:
object
SaveFileNameField
prompts the user to specify a file name to save. Result is stored in self.result as a string.
-
class
binaryninja.interaction.
SeparatorField
[source]¶ Bases:
object
SeparatorField
adds vertical separation to the display.
-
class
binaryninja.interaction.
TextLineField
(prompt)[source]¶ Bases:
object
TextLineField
Adds prompt for text string input. Result is stored in self.result as a string on completion.
-
binaryninja.interaction.
get_address_input
(prompt, title)[source]¶ get_address_input
prompts the user for an address with the given prompt and title.- Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline
- a simple text prompt is used.
Parameters: Return type: integer value input by the user.
Example: >>> get_address_input("PROMPT>", "getinfo") PROMPT> 10 10L
-
binaryninja.interaction.
get_choice_input
(prompt, title, choices)[source]¶ get_choice_input
prompts the user to select the one of the provided choices.- Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline
- 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"]) choices 1) Yes 2) No 3) Maybe PROMPT> 1 0L
-
binaryninja.interaction.
get_directory_name_input
(prompt, default_name='')[source]¶ get_directory_name_input
prompts the user for a directory name to save as, optionally providing a default_name.Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline a simple text prompt is used. The ui uses the native window popup for file selection.
Parameters: Return type: Example: >>> get_directory_name_input("prompt") prompt dirname 'dirname'
-
binaryninja.interaction.
get_form_input
(fields, title)[source]¶ get_from_input
Prompts the user for a set of inputs specified infields
with given title. The fields parameter is a list which can contain the following types:- 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
This API is flexible and works both in the UI via a popup dialog and on the command line. :params list fields: A list containing of the above specified classes, strings or None :params str title: The title of the popup dialog. :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
Specify Integer 1337 Specify name Peter The options 1) Yes 2) No 3) Maybe Options 1 >>> True >>> print(tex_f.result, int_f.result, choice_f.result) Peter 1337 0
-
binaryninja.interaction.
get_int_input
(prompt, title)[source]¶ get_int_input
prompts the user to input a integer with the given prompt and title.- Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline
- a simple text prompt is used.
Parameters: Return type: integer value input by the user.
Example: >>> get_int_input("PROMPT>", "getinfo") PROMPT> 10 10
-
binaryninja.interaction.
get_open_filename_input
(prompt, ext='')[source]¶ get_open_filename_input
prompts the user for a file name to open.- Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline
- a simple text prompt is used. The ui uses the native window popup for file selection.
Parameters: Example: >>> get_open_filename_input("filename:", "exe") filename: foo.exe 'foo.exe'
-
binaryninja.interaction.
get_save_filename_input
(prompt, ext='', default_name='')[source]¶ get_save_filename_input
prompts the user for a file name to save as, optionally providing a file extension and default_name.- Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline
- a simple text prompt is used. The ui uses the native window popup for file selection.
Parameters: Example: >>> get_save_filename_input("filename:", "exe", "foo.exe") filename: foo.exe 'foo.exe'
-
binaryninja.interaction.
get_text_line_input
(prompt, title)[source]¶ get_text_line_input
prompts the user to input a string with the given prompt and title.- Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline
- a simple text prompt is used.
Parameters: Return type: string containing the input without trailing newline character.
Example: >>> get_text_line_input("PROMPT>", "getinfo") PROMPT> Input! 'Input!'
-
binaryninja.interaction.
markdown_to_html
(contents)[source]¶ markdown_to_html
converts the provided markdown to HTML.Parameters: contents (string) – Markdown contents to convert to HTML.
Return type: Example: >>> markdown_to_html("##Yay") '<h2>Yay</h2>'
-
binaryninja.interaction.
show_html_report
(title, contents, plaintext='')[source]¶ show_html_report
displays the html contents in UI applications and plaintext in command line applications.- Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline
- a simple text prompt is used.
Parameters: Return type: Example: >>> show_html_report("title", "<h1>Contents</h1>", "Plain text contents") Plain text contents
-
binaryninja.interaction.
show_markdown_report
(title, contents, plaintext='')[source]¶ show_markdown_report
displays the markdown contents in UI applications and plaintext in command line applications.- Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline
- a simple text prompt is used.
Parameters: Return type: Example: >>> show_markdown_report("title", "##Contents", "Plain text contents") Plain text contents
-
binaryninja.interaction.
show_message_box
(title, text, buttons=<MessageBoxButtonSet.OKButtonSet: 0>, icon=<MessageBoxIcon.InformationIcon: 0>)[source]¶ show_message_box
Displays a configurable message box in the UI, or prompts on the console as appropriate retrieves a list of all Symbol objects of the provided symbol type in the optionally provided range.Parameters: - title (str) – Text title for the message box.
- text (str) – Text for the main body of the message box.
- buttons (MessageBoxButtonSet) – One of
MessageBoxButtonSet
- icon (MessageBoxIcon) – One of
MessageBoxIcon
Returns: Which button was selected
Return type:
-
binaryninja.interaction.
show_plain_text_report
(title, contents)[source]¶ show_plain_text_report
displays contents to the user in the UI or on the command line.- Note: This API function differently on the command line vs. the UI. In the UI a popup is used. On the commandline
- a simple text prompt is used.
Parameters: Return type: Example: >>> show_plain_text_report("title", "contents") contents