def has_bookmark(self, bookmark, addr): for i in xrange(1, 1024): ea = idc.GetMarkedPos(i) self.assertNotEqual(ea, idaapi.BADADDR) if ea != addr: continue self.assertEqual(idc.GetMarkComment(i), bookmark) return True return False
def marks(): '''returns all the known marked positions in an .idb''' index = 1 while True: ea = idc.GetMarkedPos(index) if ea == 0xffffffff: break comment = idc.GetMarkComment(index) yield ea, comment index += 1 return
def _get_marked_gadgets(self): rop_gadgets = {} for i in range(1, 1024): marked_pos = idc.get_bookmark(i) if marked_pos != idc.BADADDR: marked_comment = idc.GetMarkComment(i) if marked_comment and marked_comment.lower().startswith("rop"): rop_gadgets[marked_comment] = marked_pos else: break return rop_gadgets