show_selected_strings

summary: retrieve the selection from the “Strings” window

description:

In IDA it’s possible to write actions that can be applied even to core (i.e., “standard”) widgets. The actions in this example use the action “context” to know what the current selection is.

This example shows how you can either retrieve string literals data directly from the chooser (ida_kernwin.get_chooser_data), or by querying the IDB (ida_bytes.get_strlit_contents)

keywords: actions

see_also: list_strings

level: intermediate

Attributes

klasses

sw

sw

Classes

show_strings_base_ah_t

show_strings_using_get_chooser_data_ah_t

show_strings_using_get_strlist_item_ah_t

Module Contents

class show_selected_strings.show_strings_base_ah_t(use_get_chooser_data)

Bases: ida_kernwin.action_handler_t

use_get_chooser_data
activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

update(ctx)

Update an action. This is called when the context of the UI changed, and we need to let the action update some of its properties if needed (label, icon, …) In addition, this lets IDA know whether the action is enabled, and when it should be queried for availability again. Note: This callback is not meant to change anything in the application’s state, except by calling one (or many) of the “update_action_*()” functions on this very action.

class show_selected_strings.show_strings_using_get_chooser_data_ah_t

Bases: show_strings_base_ah_t

ACTION_NAME = 'test:show_string_using_get_chooser_data'
ACTION_LABEL = 'Show current string(s) using get_chooser_data()'
ACTION_SHORTCUT = 'Ctrl+Shift+S'
class show_selected_strings.show_strings_using_get_strlist_item_ah_t

Bases: show_strings_base_ah_t

ACTION_NAME = 'test:show_string_using_get_strlist_item'
ACTION_LABEL = 'Show current string(s) using get_strlist_item() + get_strlit_contents()'
ACTION_SHORTCUT = 'Ctrl+Shift+K'
show_selected_strings.klasses
show_selected_strings.sw
show_selected_strings.sw