mirror of
https://github.com/cemu-project/idapython.git
synced 2024-12-01 05:24:18 +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
86 lines
2.2 KiB
Python
86 lines
2.2 KiB
Python
import idaapi
|
|
from idaapi import Choose2
|
|
|
|
class MyChoose2(Choose2):
|
|
|
|
def __init__(self, title, nb = 5, deflt=1):
|
|
Choose2.__init__(self, title, [ ["Address", 10], ["Name", 30] ])
|
|
self.n = 0
|
|
self.items = [ self.make_item() for x in xrange(0, nb+1) ]
|
|
self.icon = 5
|
|
self.selcount = 0
|
|
self.deflt = deflt
|
|
self.popup_names = ["Inzert", "Del leet", "Ehdeet", "Ree frech"]
|
|
print("created %s" % str(self))
|
|
|
|
def OnClose(self):
|
|
print "closed", str(self)
|
|
|
|
def OnEditLine(self, n):
|
|
self.items[n][1] = self.items[n][1] + "*"
|
|
print("editing %d" % n)
|
|
|
|
def OnInsertLine(self):
|
|
self.items.append(self.make_item())
|
|
print("insert line")
|
|
|
|
def OnSelectLine(self, n):
|
|
self.selcount += 1
|
|
Warning("[%02d] selectline '%s'" % (self.selcount, n))
|
|
|
|
def OnGetLine(self, n):
|
|
print("getline %d" % n)
|
|
return self.items[n]
|
|
|
|
def OnGetSize(self):
|
|
n = len(self.items)
|
|
print("getsize -> %d" % n)
|
|
return n
|
|
|
|
def OnDeleteLine(self, n):
|
|
print("del %d " % n)
|
|
del self.items[n]
|
|
return n
|
|
|
|
def OnRefresh(self, n):
|
|
print("refresh %d" % n)
|
|
return n
|
|
|
|
def OnCommand(self, n, cmd_id):
|
|
if cmd_id == self.cmd_a:
|
|
print "command A selected @", n
|
|
elif cmd_id == self.cmd_b:
|
|
print "command B selected @", n
|
|
else:
|
|
print "Unknown command:", cmd_id, "@", n
|
|
return 1
|
|
|
|
def OnGetIcon(self, n):
|
|
r = self.items[n]
|
|
t = self.icon + r[1].count("*")
|
|
print "geticon", n, t
|
|
return t
|
|
|
|
def show(self):
|
|
t = self.Show()
|
|
if t < 0:
|
|
return False
|
|
self.cmd_a = self.AddCommand("command A")
|
|
self.cmd_b = self.AddCommand("command B")
|
|
return True
|
|
|
|
def make_item(self):
|
|
r = [str(self.n), "func_%04d" % self.n]
|
|
self.n += 1
|
|
return r
|
|
|
|
def OnGetLineAttr(self, n):
|
|
print("getlineattr %d" % n)
|
|
if n == 1:
|
|
return [0xFF0000, 0]
|
|
|
|
for i in xrange(1, 5+1):
|
|
c = MyChoose2("choose2 - sample %d" % i, i*2, deflt=i)
|
|
r = c.show()
|
|
print r
|