mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-28 12:04:19 +01:00
1258fab948
- IDA Pro 6.2 support - added set_idc_func_ex(): it is now possible to add new IDC functions using Python - added visit_patched_bytes() (see ex_patch.py) - added support for the multiline text input control in the Form class - added support for the editable/readonly dropdown list control in the Form class - added execute_sync() to register a function call into the UI message queue - added execute_ui_requests() / check ex_uirequests.py - added add_hotkey() / del_hotkey() to bind Python methods to hotkeys - added register_timer()/unregister_timer(). Check ex_timer.py - added the IDC (Arrays) netnode manipulation layer into idc.py - added idautils.Structs() and StructMembers() generator functions - removed the "Run Python Statement" menu item. IDA now has a unified dialog. Use RunPlugin("python", 0) to invoke it manually. - better error messages for script plugins, loaders and processor modules - bugfix: Dbg_Hooks.dbg_run_to() was receiving wrong input - bugfix: A few Enum related functions were not properly working in idc.py - bugfix: GetIdaDirectory() and GetProcessName() were broken in idc.py - bugfix: idaapi.get_item_head() / idc.ItemHead() were not working
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
#---------------------------------------------------------------------
|
|
# Chooser test
|
|
#
|
|
# This script demonstrates the usage of the class-based chooser.
|
|
#
|
|
# Author: Gergely Erdelyi <gergely.erdelyi@d-dome.net>
|
|
#---------------------------------------------------------------------
|
|
from idaapi import Choose
|
|
|
|
#
|
|
# Modal chooser
|
|
#
|
|
|
|
# Get a modal Choose instance
|
|
chooser = Choose([], "MyChooser", 1)
|
|
# List to choose from
|
|
chooser.list = [ "First", "Second", "Third" ]
|
|
# Set the width
|
|
chooser.width = 50
|
|
# Run the chooser
|
|
ch = chooser.choose()
|
|
# Print the results
|
|
if ch > 0:
|
|
print "You chose %d which is %s" % (ch, chooser.list[ch-1])
|
|
else:
|
|
print "Escape from chooser"
|
|
|
|
#
|
|
# Normal chooser
|
|
#
|
|
class MyChoose(Choose):
|
|
"""
|
|
You have to subclass Chooser to override the enter() method
|
|
"""
|
|
def __init__(self, list=[], name="Choose"):
|
|
Choose.__init__(self, list, name)
|
|
# Set the width
|
|
self.width = 50
|
|
self.deflt = 1
|
|
|
|
def enter(self, n):
|
|
print "Enter called. Do some stuff here."
|
|
print "The chosen item is %d = %s" % (n, self.list[n-1])
|
|
print "Now press ESC to leave."
|
|
|
|
# Get a Choose instance
|
|
chooser = MyChoose([ "First", "Second", "Third" ], "MyChoose")
|
|
|
|
# Run the chooser
|
|
ch = chooser.choose()
|