joxeankoret icon

IDAPython script to get pseudocode comments

joxeankoret | PRO | 01/02/18 07:02:20 PM UTC | 0 ⭐ | 674 👁️ | Never ⏰ | []
Python |

420 B

|

None

|

0 👍

/

0 👎

"""
IDAPython script to get pseudocode comments
"""
 
ea = idaapi.get_screen_ea()
cfunc = idaapi.decompile(ea)
sv = cfunc.get_pseudocode()
 
cmts = idaapi.restore_user_cmts(cfunc.entry_ea)
if cmts is not None:
  for tl, cmt in cmts.iteritems():
    print "0x%08x: %s " % (tl.ea, str(cmt))
 
index = 0
for item in cfunc.treeitems:
  if item.ea != BADADDR:
    print index, hex(item.ea), item.index
    index += 1

Comments