chooser_with_folders

summary: showing tabular data in a flat, or tree-like fashion

description:

By adding the necessary bits to a ida_kernwin.Choose subclass, IDA can show the otherwise tabular data, in a tree-like fashion.

The important bits to enable this are:

  • ida_dirtree.dirspec_t (and my_dirspec_t)

  • ida_kernwin.CH_HAS_DIRTREE

  • ida_kernwin.Choose.OnGetDirTree

  • ida_kernwin.Choose.OnIndexToInode

keywords: chooser, folders, actions

see_also: choose, choose_multi

level: advanced

Attributes

ALTVAL_NEW_ORDINAL_TAG

ALTVAL_ORDINAL_TAG

ALTVAL_INODE_TAG

SUPVAL_COL0_DATA_TAG

SUPVAL_COL1_DATA_TAG

SUPVAL_COL2_DATA_TAG

form

Classes

my_dirspec_t

base_idapython_tree_view_t

Chooser wrapper class.

idapython_tree_view_t

Chooser wrapper class.

Module Contents

class chooser_with_folders.my_dirspec_t(chooser)

Bases: ida_dirtree.dirspec_t

chooser
id = '$ my dirtree'
log_frame()
get_name(inode, flags)

get the entry name. for example, the structure name

Parameters:
  • inode – inode number of the entry

  • name_flags – how exactly the name should be retrieved. combination of bits for get_…name() methods bits

Returns:

false if the entry does not exist.

get_inode(dirpath, name)

get the entry inode in the specified directory

Parameters:
  • dirpath – the absolute directory path with trailing slash

  • name – the entry name in the directory

Returns:

the entry inode

get_size(inode)
get_attrs(inode)
rename_inode(inode, newname)

rename the entry

Returns:

success

event: unlinked an inode

chooser_with_folders.ALTVAL_NEW_ORDINAL_TAG = 'L'
chooser_with_folders.ALTVAL_ORDINAL_TAG = 'O'
chooser_with_folders.ALTVAL_INODE_TAG = 'I'
chooser_with_folders.SUPVAL_COL0_DATA_TAG = '0'
chooser_with_folders.SUPVAL_COL1_DATA_TAG = '1'
chooser_with_folders.SUPVAL_COL2_DATA_TAG = '2'
class chooser_with_folders.base_idapython_tree_view_t(title, nitems=100, dirspec_log=True, flags=0)

Bases: ida_kernwin.Choose

Chooser wrapper class.

Some constants are defined in this class. Please refer to kernwin.hpp for more information.

debug_items = False
dirspec_log = True
dirtree = None
dirspec = None
netnode
OnGetLine(n)

Get data for an element

This callback is mandatory

Parameters:

n – the index to fetch data for

Returns:

a list of strings

OnGetSize()

Get the number of elements in the chooser.

This callback is mandatory

Returns:

the number of elements

OnGetDirTree()

Deprecated

OnIndexToInode(n)

Deprecated

OnSelectionChange(sel)

Selection changed

Parameters:

sel – the new selection

OnSelectLine(sel)

User pressed the enter key, or double-clicked a selection

Parameters:

sel – the current selection

Returns:

a tuple (changed, selection)

class chooser_with_folders.idapython_tree_view_t(title, nitems=100, dirspec_log=True, flags=0)

Bases: base_idapython_tree_view_t

Chooser wrapper class.

Some constants are defined in this class. Please refer to kernwin.hpp for more information.

OnInsertLine(sel)

User asked to insert an element

Parameters:

sel – the current selection

Returns:

a tuple (changed, selection)

OnDeleteLine(sel)

User deleted an element

Parameters:

sel – the current selection

Returns:

a tuple (changed, selection)

OnEditLine(sel)

User asked to edit an element.

Parameters:

sel – the current selection

Returns:

a tuple (changed, selection)

chooser_with_folders.form