mirror of
https://github.com/cemu-project/idapython.git
synced 2024-12-28 02:31:53 +01:00
109158fabb
- Added AskUsingForm() with embedded forms support (check ex_askusingform.py example and formchooser.py in the SDK) - Added idautils.DecodePreviousInstruction() / DecodePrecedingInstruction() - Added idc.BeginTypeUpdating() / EndTypeUpdating() for fast batch type update operations - Added more IDP callbacks - Added UI_Hooks with a few notification events - Added idaapi.process_ui_action() / idc.ProcessUiAction() - Added netnode.index() to get netnode number - Better handling of ea_t values with bitwise negation - Execute statement hotkey (Ctrl-F3), script timeout, and other options are now configurable with Python.cfg - bugfix: idaapi.msg() / error() and warning() so they don't accept vararg - bugfix: processor_t.id constants were incorrect - bugfix: get_debug_names() was broken with IDA64 - Various bugfixes
53 lines
1.1 KiB
Python
53 lines
1.1 KiB
Python
"""
|
|
|
|
This script shows how to send debugger commands and use the result in IDA
|
|
|
|
Copyright (c) 1990-2009 Hex-Rays
|
|
ALL RIGHTS RESERVED.
|
|
|
|
"""
|
|
|
|
import idc
|
|
import re
|
|
|
|
# class to store parsed results
|
|
class exchain:
|
|
def __init__(self, m):
|
|
self.name = m.group(1)
|
|
self.addr = int(m.group(2), 16)
|
|
|
|
def __str__(self):
|
|
return "%x: %s" % (self.addr, self.name)
|
|
|
|
# Chooser class
|
|
class MyChoose(Choose):
|
|
def __init__(self, list, title):
|
|
Choose.__init__(self, list, title)
|
|
self.width = 250
|
|
|
|
def enter(self, n):
|
|
o = self.list[n-1]
|
|
idc.Jump(o.addr)
|
|
|
|
# main
|
|
def main():
|
|
s = idc.Eval('SendDbgCommand("!exchain")')
|
|
if "IDC_FAILURE" in s:
|
|
return (False, "Cannot execute the command")
|
|
|
|
matches = re.finditer(r'[^:]+: ([^\(]+) \(([^\)]+)\)\n', s)
|
|
L = []
|
|
for x in matches:
|
|
L.append(exchain(x))
|
|
if not L:
|
|
return (False, "Nothing to display: Could parse the result!")
|
|
|
|
# Get a Choose instance
|
|
chooser = MyChoose(L, "Exchain choose")
|
|
# Run the chooser
|
|
chooser.choose()
|
|
return (True, "Success!")
|
|
ok, r = main()
|
|
if not ok:
|
|
print r
|