Пример #1
0
    def open_function(self):
        addresses = self.addresses
        if len(addresses) > 1:
            address = helper.choose_virtual_func_address(self.name)
            if not address:
                return
        elif len(addresses) == 1:
            address = addresses[0]
        else:
            return

        if helper.decompile_function(address):
            idaapi.open_pseudocode(address, 0)
        else:
            idaapi.jumpto(address)
Пример #2
0
    def _get_member(self, offset, cexpr, obj, tinfo=None, obj_ea=None):
        if offset < 0:
            logger.error(
                "Considered to be imposible: offset - {}, obj - {}".format(
                    offset, helper.to_hex(self._find_asm_address(cexpr))))
            raise AssertionError

        applicable = not self.crippled
        cexpr_ea = self._find_asm_address(cexpr)
        scan_obj = ScannedObject.create(obj, cexpr_ea, self.__origin,
                                        applicable)
        if obj_ea:
            if temporary_structure.VirtualTable.check_address(obj_ea):
                return temporary_structure.VirtualTable(
                    offset, obj_ea, scan_obj, self.__origin)
            if helper.is_code_ea(obj_ea):
                cfunc = helper.decompile_function(obj_ea)
                if cfunc:
                    tinfo = cfunc.type
                    tinfo.create_ptr(tinfo)
                else:
                    tinfo = const.DUMMY_FUNC
                return temporary_structure.Member(offset, tinfo, scan_obj,
                                                  self.__origin)
            # logger.warn("Want to see this ea - {},".format(Helper.to_hex(cexpr_ea)))

        if not tinfo or tinfo.equals_to(const.VOID_TINFO) or tinfo.equals_to(
                const.CONST_VOID_TINFO):
            return temporary_structure.VoidMember(offset, scan_obj,
                                                  self.__origin)

        if tinfo.equals_to(const.CHAR_TINFO):
            return temporary_structure.VoidMember(offset,
                                                  scan_obj,
                                                  self.__origin,
                                                  char=True)

        if tinfo.equals_to(const.CONST_PCHAR_TINFO):
            tinfo = const.PCHAR_TINFO
        elif tinfo.equals_to(const.CONST_PVOID_TINFO):
            tinfo = const.PVOID_TINFO
        else:
            tinfo.clr_const()
        return temporary_structure.Member(offset, tinfo, scan_obj,
                                          self.__origin)
Пример #3
0
 def __iter_callers(self):
     for ea in self.__callers_ea:
         cfunc = helper.decompile_function(ea)
         if cfunc:
             yield cfunc