コード例 #1
0
 def __call__(self):
     cmts = ida_hexrays.user_cmts_new()
     for (tl_ea, tl_itp), cmt in self.cmts:
         tl = ida_hexrays.treeloc_t()
         tl.ea = tl_ea
         tl.itp = tl_itp
         cmts.insert(tl, ida_hexrays.citem_cmt_t(Event.encode(cmt)))
     ida_hexrays.save_user_cmts(self.ea, cmts)
     HexRaysEvent.refresh_pseudocode_view()
コード例 #2
0
ファイル: compat.py プロジェクト: angr/binsync
def set_decomp_comments(func_addr, cmt_dict: typing.Dict[int, str]):
    for addr in cmt_dict:
        ida_cmts = ida_hexrays.user_cmts_new()

        comment = cmt_dict[addr]
        tl = ida_hexrays.treeloc_t()
        tl.ea = addr
        # XXX: need a real value here at some point
        tl.itp = 90
        ida_cmts.insert(tl, ida_hexrays.citem_cmt_t(comment))

        ida_hexrays.save_user_cmts(func_addr, ida_cmts)
コード例 #3
0
    def get_cmt(self, ea, itp=None):
        """
            Allow to get a comment in the hexrays interface view.

            .. todo: doc & better (in particular itp)

            :param int ea: The address at which is the comment.
            :param int itp: The position at which the comment is.
                See ``item_tree_position`` in IDA, by default (None) at the
                semi-colon.
            :return: None if no comment at that position, the comment as
                a string if there is any
        """
        if itp is None:
            itp = ida_hexrays.ITP_SEMI
        tl = ida_hexrays.treeloc_t()
        tl.ea = ea
        tl.itp = itp
        try:
            return self._cfunc.user_cmts[tl].c_str()
        except KeyError:
            return None
コード例 #4
0
    def add_cmt(self, ea, value, itp=None):
        """
            Allow to add a comment in the hexrays interface view. 
            If a comment at the same position (ea and itp) exist it will be
            overwritten.

            .. todo: doc & better (in particular itp)

            :param int ea: The address at which add the comment. All ea
                address in the function will not be valid, only the one used
                for items in the ctree seems to be. 
            :param str value: The comment value.
            :param int itp: The position at which add the comment.
                See ``item_tree_position`` in IDA, by default (None) at the
                semi-colon
        """
        if itp is None:
            itp = ida_hexrays.ITP_SEMI
        tl = ida_hexrays.treeloc_t()
        tl.ea = ea
        tl.itp = itp
        self._cfunc.set_user_cmt(tl, value)
        self._cfunc.save_user_cmts()
コード例 #5
0
ファイル: ast_helper.py プロジェクト: xcode2010/HRAST
def make_comment(fcn, obj, comm):
    tl = ida_hexrays.treeloc_t()
    tl.ea = obj.ea
    tl.itp = ida_hexrays.ITP_SEMI
    fcn.set_user_cmt(tl, comm)
    fcn.save_user_cmts()
コード例 #6
0
# XXX - ExpandingStrucEvent
# XXX - SegmAddedEvent
# XXX - SegmDeletedEvent
# XXX - SegmStartChangedEvent
# XXX - SegmEndChangedEvent
# XXX - SegmNameChangedEvent
# XXX - SegmClassChangedEvent
# XXX - SegmAttrsUpdatedEvent
# XXX - SegmMoved

print("[+] Undefining string at 0x78DBDCB0 -> UndefinedEvent")
del_items(0x78DBDCB0)

# XXX - BytePatchedEvent
# XXX - SgrChanged

# XXX - UserLabelsEvent

print("[+] Defining 2 comments in HexRays window in function defined at 0x78DBB091 -> UserCmtsEvent")
list_comments = [((0x78DBB06A, 74), 'one comment in HexRays'), ((0x78DBB091, 74), 'another comment in HexRays')]
cmts = ida_hexrays.user_cmts_new()
for (tl_ea, tl_itp), cmt in list_comments:
    tl = ida_hexrays.treeloc_t()
    tl.ea = tl_ea
    tl.itp = tl_itp
    cmts.insert(tl, ida_hexrays.citem_cmt_t(cmt))
ida_hexrays.save_user_cmts(0x78DBB050, cmts)

# XXX - UserIflagsEvent
# XXX - UserLvarSettingsEvent
# XXX - UserNumformsEvent