Esempio n. 1
0
    def visit_expr(self, cexpr):
        if self._skip:
            if self._is_initial_object(cexpr):
                self._skip = False
            else:
                return 0

        if cexpr.op != idaapi.cot_asg:
            return 0

        x_cexpr = cexpr.x
        if cexpr.y.op == idaapi.cot_cast:
            y_cexpr = cexpr.y.x
        else:
            y_cexpr = cexpr.y

        for obj in self._objects:
            if obj.is_target(x_cexpr):
                if self.__is_object_overwritten(x_cexpr, obj, y_cexpr):
                    logger.info("Removed object {} from scanning at {}".format(
                        obj,
                        to_hex(helper.find_asm_address(x_cexpr,
                                                       self.parents))))
                    self._objects.remove(obj)
                return 0
            elif obj.is_target(y_cexpr):
                new_obj = ScanObject.create(self._cfunc, x_cexpr)
                if new_obj:
                    self._objects.append(new_obj)
                return 0
        return 0
Esempio n. 2
0
 def _is_initial_object(self, cexpr):
     if cexpr.op == idaapi.cot_asg:
         cexpr = cexpr.y
         if cexpr.op == idaapi.cot_cast:
             cexpr = cexpr.x
     return self._init_obj.is_target(cexpr) and helper.find_asm_address(
         cexpr, self.parents) == self._start_ea
Esempio n. 3
0
 def _is_initial_object(self, cexpr):
     return self._init_obj.is_target(cexpr) and helper.find_asm_address(
         cexpr, self.parents) == self._start_ea
Esempio n. 4
0
 def __manipulate(self, cexpr, obj):
     logger.debug("Expression {} at {} Id - {}".format(
         cexpr.opname, to_hex(helper.find_asm_address(cexpr, self.parents)),
         obj.id))