.. py:module:: ui ui -- User Interface module =========================== This module exposes a number of tools and class definitions for interacting with IDA's user interface. This includes things such as getting the current state of user input, information about windows that are in use as well as utilities for simplifying the customization of the interface. There are a few namespaces that are provided in order to get the current state. The :py:obj:`ui.current` namespace allows for one to get the current address, function, segment, window, as well as a number of other things. A number of namespaces defined within this module also allows a user to interact with the different windows that are currently in use. This can allow for one to automatically show or hide a window that they wish to expose to the user. -------------- Namespace list -------------- These are the namespaces available within this module. Namespaces group similar functions that can be used typically for the same concept. Please see :ref:`multicase-namespaces` for more information on namespaces. For more information on multicase functions or aliases, please see :ref:`multicase-functions` or :ref:`multicase-aliases`. .. _ns-ui-application: ************** ui.application ************** This namespace is for getting information about the application user-interface. .. py:function:: application() Return the current instance of the application. .. py:function:: application\.beep() Beep using the application interface. Aliases: :py:func:`ui.beep` .. py:function:: application\.window() Return the current window for the application. .. py:function:: application\.windows() Return all of the top-level windows for the application. .. _ns-ui-appwindow: ************ ui.appwindow ************ Base namespace used for interacting with the windows provided by IDA. .. py:function:: appwindow\.close() Close or hide the window belonging to the namespace. .. py:function:: appwindow\.open(\*args) Open or show the window belonging to the namespace. :param \*args: any options or arguments to pass to the windows open function .. _ns-ui-ask: ****** ui.ask ****** This namespace contains utilities for asking the user for some particular type of information. These will typically require a user-interface of some sort and will block while waiting for the user to respond. If the ``default`` parameter is specified to any of the functions within this namespace, then its value will be used by default in the inbox that is displayed to the user. .. py:function:: ask(\*\*default) Request the user choose from the options "yes", "no", or "cancel". :param \*\*default: if ``yes``, ``no``, or ``cancel`` is set to true, then use that value as the default .. py:function:: ask(message, \*\*default) Request the user choose from the options "yes", "no", or "cancel" using the specified ``message`` as the prompt. :param message: the message to display when asking the user for input :param \*\*default: if ``yes``, ``no``, or ``cancel`` is set to true, then use that value as the default .. py:function:: ask\.address(\*\*default) Request the user provide an address. :param \*\*default: the default address for the user to change. if one was not specified, then use the current address. .. py:function:: ask\.address(message, \*\*default) Request the user provide an address using the specified ``message`` as the prompt. If the ``valid`` parameter is specified, then verify that the address is within the bounds of the database. If the ``bounds`` parameter is specified, then verify that the address chosen by the user is within the provided bounds. :param message: the message to display when asking the user for input :param \*\*default: the default address for the user to change. if one was not specified, then use the current address. .. py:function:: ask\.integer(\*\*default) Request the user provide an integer. :param \*\*default: the default integer for the user to change. if one was not specified, then use the previous integer that the user input. .. py:function:: ask\.integer(message, \*\*default) Request the user provide an integer using the specified ``message`` as the prompt. :param message: the message to display when asking the user for input :param \*\*default: the default integer for the user to change. if one was not specified, then use the previous integer that the user input. .. py:function:: ask\.note(\*\*default) Request the user provide a multi-lined string. :param \*\*default: the default string for the user to change .. py:function:: ask\.note(message, \*\*default) Request the user provide a multi-lined string using the specified ``message`` as the prompt. If the ``length`` parameter is provided as an integer, then constrain the length of the user's input to the integer that was specified. :param message: the message to display when asking the user for input :param \*\*default: the default string for the user to change .. py:function:: ask\.segment(\*\*default) Request the user provide a segment. :param \*\*default: the default segment for the user to change. if one was not specified, then use the address of the current segment. .. py:function:: ask\.segment(message, \*\*default) Request the user provide a segment using the specified ``message`` as the prompt. :param message: the message to display when asking the user for input :param \*\*default: the default segment for the user to change. if one was not specified, then use the address of the current segment. .. py:function:: ask\.string(\*\*default) Request the user provide a string. :param \*\*default: the default string for the user to change .. py:function:: ask\.string(message, \*\*default) Request the user provide a string using the specified ``message`` as the prompt. :param message: the message to display when asking the user for input :param \*\*default: the default string for the user to change .. py:function:: ask\.yn(\*\*default) Request the user choose from the options "yes", "no", or "cancel". :param \*\*default: .. py:function:: ask\.yn(message, \*\*default) Request the user choose from the options "yes", "no", or "cancel" using the specified ``message`` as the prompt. If any of the options are specified as a boolean, then it is assumed that this option will be the default. If the user chooses "cancel", then this value will be returned instead of the value :py:obj:`None`. :param message: the message to display when asking the user for input :param \*\*default: if ``yes``, ``no``, or ``cancel`` is set to true, then use that value as the default .. _ns-ui-breakpoints: ************** ui.breakpoints ************** This namespace is for interacting with the Breakpoints window. Bases: :ref:`ui.appwindow` .. _ns-ui-calls: ******** ui.calls ******** This namespace is for interacting with the (Function) Calls window. Bases: :ref:`ui.appwindow` .. _ns-ui-clipboard: ************ ui.clipboard ************ This namespace is for interacting with the current clipboard state. .. py:function:: clipboard() Return the current clipboard. .. _ns-ui-current: ********** ui.current ********** This namespace contains tools for fetching information about the current selection state. This can be used to get the state of thigns that are currently selected such as the address, function, segment, clipboard, widget, or even the current window in use. .. py:function:: current\.address() Return the current address. .. py:function:: current\.color() Return the color of the current item. .. py:function:: current\.function() Return the current function. .. py:function:: current\.operand() Return the currently selected operand number. Aliases: :py:func:`ui.current.opnum` .. py:function:: current\.segment() Return the current segment. .. py:function:: current\.selection() Return the current address range of whatever is selected Aliases: :py:func:`ui.current.selected` .. py:function:: current\.status() Return the IDA status. .. py:function:: current\.symbol() Return the current highlighted symbol name or register. .. py:function:: current\.viewer() Return the current viewer that is being used. .. py:function:: current\.widget() Return the current widget that is being used. .. py:function:: current\.window() Return the current window that is being used. .. _ns-ui-disassembly: ************** ui.disassembly ************** This namespace is for interacting with the Disassembly window. Bases: :ref:`ui.appwindow` .. py:function:: disassembly\.refresh() Refresh the main IDA disassembly view. .. _ns-ui-dump: ******* ui.dump ******* This namespace is for interacting with the (Hex) Dump window. Bases: :ref:`ui.appwindow` .. _ns-ui-enumerations: *************** ui.enumerations *************** This namespace is for interacting with the Enumerations window. Bases: :ref:`ui.appwindow` .. _ns-ui-exports: ********** ui.exports ********** This namespace is for interacting with the Exports window. Bases: :ref:`ui.appwindow` .. _ns-ui-frame: ******** ui.frame ******** This namespace is for interacting with the (Function) Frame window. Bases: :ref:`ui.appwindow` .. _ns-ui-functions: ************ ui.functions ************ This namespace is for interacting with the Functions window. Bases: :ref:`ui.appwindow` .. _ns-ui-imports: ********** ui.imports ********** This namespace is for interacting with the Imports window. Bases: :ref:`ui.appwindow` .. _ns-ui-keyboard: *********** ui.keyboard *********** Base namespace for interacting with the keyboard input. .. py:function:: keyboard\.input() Return the current keyboard input context. .. py:function:: keyboard\.list() Display the current list of keyboard combinations that are mapped along with the callable each one is attached to. .. py:function:: keyboard\.map(key, callable) Map the specified ``key`` combination to a python ``callable`` in IDA. If the provided ``key`` is being re-mapped due to the mapping already existing, then return the previous callable that it was assigned to. Aliases: :py:func:`ui.keyboard.add` :param key: the key to map :param callable: a python callable to execute when the specified key is pressed .. py:function:: keyboard\.modifiers() Return the current keyboard modifiers that are being used. .. py:function:: keyboard\.unmap(key) Unmap the specified ``key`` from IDA and return the callable that it was assigned to. Aliases: :py:func:`ui.keyboard.rm` :param key: the key mapping to unmap .. _ns-ui-libraries: ************ ui.libraries ************ This namespace is for interacting with the (Type) Libraries window. Bases: :ref:`ui.appwindow` .. _ns-ui-menu: ******* ui.menu ******* This namespace is for registering items in IDA's menu system. .. py:function:: menu\.add(path, name, callable, hotkey='', flags=0, args=()) Register a ``callable`` as a menu item at the specified ``path`` with the provided ``name``. :param path: the menu path to add the item to :param name: the name of the item to add :param callable: the callable to execute when the item is clicked :param hotkey: the key mapping to map the menu item to :param flags: any extra flags to pass to :py:obj:`idaapi.add_menu_item` :param args: any parameters to pass to the callable .. py:function:: menu\.reset() Remove all currently registered menu items. .. py:function:: menu\.rm(path, name) Remove the menu item at the specified ``path`` with the provided ``name``. :param path: the menu path containing the item to remove :param name: the name of the item to remove .. _ns-ui-message: ********** ui.message ********** This namespace is for displaying a modal dialog box with the different icons that are available from IDA's user interface. The functions within will block IDA from being interacted with while their dialog is displayed. .. py:function:: message(message, \*\*icon) Display a modal information dialog box using the provided ``message``. :param message: the message to display in the dialog box :param \*\*icon: a boolean specifying the icon to include in the dialog which can be either ``information`` or ``warning`` .. py:function:: message\.error(message) Display a modal error dialog box using the provided ``message``. :param message: the message to display in the dialog box .. py:function:: message\.information(message) Display a modal information dialog box using the provided ``message``. Aliases: :py:func:`ui.message.info` :param message: the message to display in the dialog box .. py:function:: message\.warning(message) Display a modal warning dialog box using the provided ``message``. Aliases: :py:func:`ui.message.warn` :param message: the message to display in the dialog box .. _ns-ui-modules: ********** ui.modules ********** This namespace is for interacting with the Modules window. Bases: :ref:`ui.appwindow` .. _ns-ui-mouse: ******** ui.mouse ******** Base namespace for interacting with the mouse input. .. py:function:: mouse\.buttons() Return the current mouse buttons that are being clicked. .. py:function:: mouse\.position() Return the current ``(x, y)`` position of the cursor. .. _ns-ui-names: ******** ui.names ******** This namespace is for interacting with the Names window. Bases: :ref:`ui.appwindow` .. py:function:: names\.at(index) Return the address and the symbol name of the specified ``index``. :param index: the index in the list to return .. py:function:: names\.contains(ea) Return whether the address ``ea`` is referenced in the names list. :param ea: the address of the symbol to check .. py:function:: names\.ea(index) Return the address at the specified ``index``. :param index: the index in the list to return .. py:function:: names\.iterate() Iterate through all of the address and symbols in the names list. .. py:function:: names\.name(index) Return the name at the specified ``index``. :param index: the index in the list to return .. py:function:: names\.refresh() Refresh the names list. .. py:function:: names\.search(ea) Return the index of the address ``ea`` in the names list. :param ea: the address of the symbol to return the index for .. py:function:: names\.size() Return the number of elements in the names list. .. _ns-ui-navigation: ************* ui.navigation ************* This namespace is for updating the state of the colored navigation band. .. py:function:: navigation\.analyze(ea) :param ea: the address to set the auto-analysis analyze address to on the navigation bar .. py:function:: navigation\.auto(ea, \*\*type) Set the auto-analysis address and type on the navigation bar to ``ea``. If ``type`` is specified, then update using the specified auto-analysis type. :param ea: the address to set the auto-analysis address to on the navigation bar :param \*\*type: if ``type`` is specified as an :py:obj:`idaapi.AU_\*`, then use this as the navigation type .. py:function:: navigation\.code(ea) :param ea: the address to set the auto-analysis code address to on the navigation bar .. py:function:: navigation\.final(ea) :param ea: the address to set the auto-analysis final address to on the navigation bar .. py:function:: navigation\.procedure(ea) :param ea: the address to set the auto-analysis procedure address to on the navigation bar .. py:function:: navigation\.set(ea) Set the auto-analysis address on the navigation bar to ``ea``. :param ea: the address to set the navigation bar pointer to .. py:function:: navigation\.signature(ea) :param ea: the address to set the auto-analysis signature address to on the navigation bar .. py:function:: navigation\.stackpointer(ea) :param ea: the address to set the auto-analysis stackpointer address to on the navigation bar .. py:function:: navigation\.tail(ea) :param ea: the address to set the auto-analysis tail address to on the navigation bar .. py:function:: navigation\.type(ea) :param ea: the address to set the auto-analysis type address to on the navigation bar .. py:function:: navigation\.unknown(ea) :param ea: the address to set the auto-analysis unknown address to on the navigation bar .. py:function:: navigation\.weak(ea) :param ea: the address to set the auto-analysis weak address to on the navigation bar .. _ns-ui-notepad: ********** ui.notepad ********** This namespace is for interacting with the Notepad window. Bases: :ref:`ui.appwindow` .. py:function:: notepad\.append(string) Append the provided ``string`` to the current text that is stored within the notepad window. :param string: the text to append to the contents of the notepad window .. py:function:: notepad\.close() Close or hide the notepad window. .. py:function:: notepad\.count() Return the number of lines that are currently stored within the notepad window. .. py:function:: notepad\.cursor() Return the :py:obj:`QtGui.QTextCursor` used by the notepad window. .. py:function:: notepad\.cursor(cursor) Set the :py:obj:`QtGui.QTextCursor` for the notepad window to ``cursor``. :param cursor: the ``QtGui.QTextCursor`` to assign to the notepad window .. py:function:: notepad\.get() Return the string that is currently stored within the notepad window. .. py:function:: notepad\.open(\*args) Open or show the notepad window and return its UI widget that can be used to modify it. :param \*args: .. py:function:: notepad\.set(string) Set the text that is currently stored within the notepad window to ``string``. :param string: the string to assign to the contents of the notepad window .. py:function:: notepad\.set(items) Set each line that is currently stored within the notepad window to ``items``. :param items: the list to assign to each row of the notepad window .. py:function:: notepad\.size() Return the number of characters that are currently stored within the notepad window. .. _ns-ui-problems: *********** ui.problems *********** This namespace is for interacting with the Problems window. Bases: :ref:`ui.appwindow` .. _ns-ui-references: ************* ui.references ************* This namespace is for interacting with the Cross-References window. Bases: :ref:`ui.appwindow` .. _ns-ui-segmentregisters: ******************* ui.segmentregisters ******************* This namespace is for interacting with the Segments window. Bases: :ref:`ui.appwindow` .. _ns-ui-segments: *********** ui.segments *********** This namespace is for interacting with the Segments window. Bases: :ref:`ui.appwindow` .. _ns-ui-selectors: ************ ui.selectors ************ This namespace is for interacting with the Selectors window. Bases: :ref:`ui.appwindow` .. _ns-ui-signatures: ************* ui.signatures ************* This namespace is for interacting with the Signatures window. Bases: :ref:`ui.appwindow` .. _ns-ui-stack: ******** ui.stack ******** This namespace is for interacting with the (Call) Stack window. Bases: :ref:`ui.appwindow` .. _ns-ui-state: ******** ui.state ******** This namespace is for fetching or interacting with the current state of IDA's interface. These are things such as waiting for IDA's analysis queue, or determining whether the function is being viewed in graph view or not. .. py:function:: state\.graphview() Returns true if the current function is being viewed in graph view mode. .. py:function:: state\.wait() Wait until IDA's autoanalysis queues are empty. Aliases: :py:func:`ui.wait` .. _ns-ui-strings: ********** ui.strings ********** This namespace is for interacting with the Strings window. Bases: :ref:`ui.appwindow` .. py:function:: strings\.at(index) Return the :py:obj:`idaapi.string_info_t` for the specified ``index`` in the strings list. :param index: the index of the string item to return .. py:function:: strings\.get(index) Return the address and its bytes representing the string at the specified ``index``. :param index: the index of the string to return .. py:function:: strings\.iterate() Iterate through all of the addresses and items in the strings list. .. py:function:: strings\.refresh() Refresh the strings list. .. py:function:: strings\.size() Return the number of items available in the strings list. .. _ns-ui-structures: ************* ui.structures ************* This namespace is for interacting with the Structures window. Bases: :ref:`ui.appwindow` .. _ns-ui-threads: ********** ui.threads ********** This namespace is for interacting with the Threads window. Bases: :ref:`ui.appwindow` .. _ns-ui-timer: ******** ui.timer ******** This namespace is for registering a python callable to a timer in IDA. .. py:function:: timer\.register(id, interval, callable) Register the specified ``callable`` with the requested ``id`` to be called at every ``interval``. :param id: a unique id used to refer to the callable being registered in the timer :param interval: what interval to execute the callable at :param callable: a python callable to execute when the timer ticks .. py:function:: timer\.reset() Remove all the registered timers. .. py:function:: timer\.unregister(id) Unregister the specified ``id``. :param id: the unique id of the callable to unregister .. _ns-ui-tracing: ********** ui.tracing ********** This namespace is for interacting with the Tracing window. Bases: :ref:`ui.appwindow` .. _ns-ui-types: ******** ui.types ******** This namespace is for interacting with the Types window. Bases: :ref:`ui.appwindow` .. _ns-ui-widget: ********* ui.widget ********* This namespace is for interacting with any of the widgets associated with the native user-interface. .. py:function:: widget() Return the widget that is currently being used. .. py:function:: widget(xy) Return the widget at the specified (``x``, ``y``) coordinate within the ``xy`` tuple. :param xy: a tuple composed of the X and Y coordinates of a widget .. py:function:: widget(title) Return the widget that is using the specified ``title``. :param title: a string containing the widget title .. py:function:: widget\.at(xy) Return the widget at the specified (``x``, ``y``) coordinate within the ``xy`` tuple. :param xy: a tuple composed of the X and Y coordinates of a widget .. py:function:: widget\.by(title) Return the widget associated with the given window ``title``. :param title: the title of the desired widget to return .. py:function:: widget\.close(widget, flags) Close the ``widget`` using the specified :py:obj:`idaapi.WCLS_` flags. :param widget: the widget to close :param flags: the specified flags to use when closing the widget .. py:function:: widget\.focus(widget) Activate the specified ``widget`` and put it in focus. :param widget: the widget to put into focus .. py:function:: widget\.form(widget) Return the IDA form for the UI ``widget`` that is provided. :param widget: the user-interface widget to convert to an IDA plugin form .. py:function:: widget\.isinstance(object) Return whether the given ``object`` is of the correct type for the UI. :param object: the object to check the instance of .. py:function:: widget\.of(form) Return the UI widget for the IDA ``form`` that is provided. :param form: the IDA plugin form to convert to a user-interface widget .. py:function:: widget\.open(widget, flags, \*\*target) Open the ``widget`` using the specified :py:obj:`idaapi.WOPN_` flags. :param widget: the widget to open :param flags: the specified flags to use when opening the widget :param \*\*target: .. py:function:: widget\.show(widget) Display the specified ``widget`` without putting it in focus. :param widget: the widget to show .. py:function:: widget\.title(widget) Return the window title for the given ``widget``. :param widget: the widget to return the title from .. py:function:: widget\.type(widget) Return the :py:obj:`idaapi.twidget_type_t` for the given ``widget``. :param widget: the widget to return the type of .. _ns-ui-window: ********* ui.window ********* This namespace is for interacting with a specific window. .. py:function:: window() Return the currently active window. .. py:function:: window\.at(cls, xy) Return the widget at the specified (``x``, ``y``) coordinate within the ``xy`` tuple. :param cls: :param xy: a tuple composed of the X and Y coordinates of a window .. _ns-ui-windows: ********** ui.windows ********** This namespace is for interacting with any or all of the windows for the application. .. py:function:: windows() Return all of the top-level windows. .. py:function:: windows\.refresh() Refresh all of lists and choosers within the application. Aliases: :py:func:`ui.refresh` ---------- Class list ---------- Classes provide the definition necessary to instantiate an object. In most cases, a class is returned when calling one of the prior listed functions and thus have no need to be manually instantiated. Classes may also have aliases defined for them. Please refer to the documentation for the class to see what is available. For more information on aliases, please see :ref:`multicase-aliases`. *************** ConsoleProgress *************** .. py:class:: ConsoleProgress Helper class used to simplify the showing of a progress bar in IDA's console. .. py:method:: close(self) Close the current progress bar. .. py:method:: open(self, width=0.8, height=0.1) Open a progress bar with the specified ``width`` and ``height`` relative to the dimensions of IDA's window. :param width: the percentage of IDA's dimensions to set the width to :param height: the percentange of IDA's dimensions to set the height to .. py:method:: update(self, \*\*options) Update the current state of the progress bar. :param \*\*options: The options to update the progress bar with. Some of these options are: - ``minimum`` - the minimum value on the progress bar - ``maximum`` - the maximum value on the progress bar - ``text`` - the current text to display - ``title`` - the title of the progress bar - ``tooltip`` - what to emit when the user hovers over the progress bar ******** InputBox ******** .. py:class:: InputBox Bases: :py:class:`idaapi.PluginForm` A class designed to be inherited from that can be used to interact with the user. .. py:method:: OnClose(self, form) A method to overload to be notified when the plugin form is destroyed. :param form: an :py:obj:`idaapi.PluginForm` that is created .. py:method:: OnCreate(self, form) A method to overload to be notified when the plugin form is created. :param form: an :py:obj:`idaapi.PluginForm` that is created .. py:method:: Show(self, caption, options=0) Show the form with the specified ``caption`` and ``options``. :param caption: the title of the form to show :param options: any flags to show the form with ******** Progress ******** .. py:class:: Progress The default progress bar in with which to show progress. This class will automatically determine which progress bar (Console or UI) to instantiate based on what is presently available. .. py:method:: __new__(cls, \*args, \*\*kwargs) Figure out which progress bar to use and instantiate it with the provided parameters ``args`` and ``kwargs``. :param \*args: any variable arguments to pass to the determined progress bar :param \*\*kwargs: any keyword arguments to pass to the determined progress bar ********** UIProgress ********** .. py:class:: UIProgress Helper class used to simplify the showing of a progress bar in IDA's UI. .. py:attribute:: canceled :param getter: :param setter: :param set: .. py:method:: close(self) Close the current progress bar. .. py:method:: open(self, width=0.8, height=0.1) Open a progress bar with the specified ``width`` and ``height`` relative to the dimensions of IDA's window. :param width: the percentage of IDA's dimensions to set the width to :param height: the percentange of IDA's dimensions to set the height to .. py:method:: update(self, \*\*options) Update the current state of the progress bar. :param \*\*options: The options to update the progress bar with. Some of these options are: - ``minimum`` - the minimum value on the progress bar - ``maximum`` - the maximum value on the progress bar - ``text`` - the current text to display - ``title`` - the title of the progress bar - ``tooltip`` - what to emit when the user hovers over the progress bar