mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-28 03:54:18 +01:00
ac5d88a83b
- IDA 6.0 support - Python CLI now prints expression evaluation result (no need to use print()) - Changed Alt-8 to Ctrl-F3 (because it conflicts with window switching key Alt+n) - Added get_highlighted_identifier() - Added PluginForm class to allow UI development with either PyQt4 or PySide - Added idautils.Entries() to enumerate entrypoints - idc / AddConst() was broken - Minor fixes
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import idaapi
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Using raw IDAAPI
|
|
def raw_main(p=True):
|
|
f = idaapi.get_func(here())
|
|
if not f:
|
|
return
|
|
|
|
q = idaapi.qflow_chart_t("The title", f, 0, 0, idaapi.FC_PREDS)
|
|
for n in xrange(0, q.size()):
|
|
b = q[n]
|
|
if p:
|
|
print "%x - %x [%d]:" % (b.startEA, b.endEA, n)
|
|
|
|
for ns in xrange(0, q.nsucc(n)):
|
|
if p:
|
|
print " %d->%d" % (n, q.succ(n, ns))
|
|
|
|
for ns in xrange(0, q.npred(n)):
|
|
if p:
|
|
print " %d->%d" % (n, q.pred(n, ns))
|
|
|
|
# -----------------------------------------------------------------------
|
|
# Using the class
|
|
def cls_main(p=True):
|
|
f = idaapi.FlowChart(idaapi.get_func(here()))
|
|
for block in f:
|
|
if p:
|
|
print "%x - %x [%d]:" % (block.startEA, block.endEA, block.id)
|
|
for succ_block in block.succs():
|
|
if p:
|
|
print " %x - %x [%d]:" % (succ_block.startEA, succ_block.endEA, succ_block.id)
|
|
|
|
for pred_block in block.preds():
|
|
if p:
|
|
print " %x - %x [%d]:" % (pred_block.startEA, pred_block.endEA, pred_block.id)
|
|
|
|
q = None
|
|
f = None
|
|
raw_main(False)
|
|
cls_main(True)
|
|
|