コード例 #1
0
ファイル: win7heapwalker.py プロジェクト: sulik011/forum
    def _make_dual_arch_ctypes(self):
        # dual arch
        module_name_32 = 'haystack.allocators.win32.win7_32'
        _win7_32 = target.TargetPlatform.make_target_win_32('win7')
        _model_32 = model.Model(_win7_32.get_target_ctypes())
        _win7_32_module = _model_32.import_module(module_name_32)
        # TODO make dual optional
        module_name_64 = 'haystack.allocators.win32.win7_64'
        _win7_64 = target.TargetPlatform.make_target_win_64('win7')
        _model_64 = model.Model(_win7_64.get_target_ctypes())
        _win7_64_module = _model_64.import_module(module_name_64)

        # different arch have different recors types.
        parser = constraints.ConstraintsConfigHandler()
        constraint_filename = os.path.join(os.path.dirname(sys.modules[__name__].__file__), 'win7heap32.constraints')
        _constraints_32 = parser.read(constraint_filename)
        constraint_filename = os.path.join(os.path.dirname(sys.modules[__name__].__file__), 'win7heap64.constraints')
        _constraints_64 = parser.read(constraint_filename)

        # KERNEL AS
        kas32 = (0x8000000, 0xFFFFFFFF)
        kas64 = (0xFFFF080000000000, 0xFFFFFFFFFFFFFFFF)

        _cpu = dict()
        _cpu[32] = {'model': _model_32, 'target': _win7_32, 'module': _win7_32_module,
                    'constraints': _constraints_32, 'signature_offset': 100, 'kernel_as': kas32}
        _cpu[64] = {'model': _model_64, 'target': _win7_64, 'module': _win7_64_module,
                    'constraints': _constraints_64, 'signature_offset': 160, 'kernel_as': kas64}
        return _cpu
コード例 #2
0
ファイル: base.py プロジェクト: sulik011/forum
    def __init__(self, mapping_list, _target, name):
        """Set the list of IMemoryMapping and the ITargetPlatform

        :param mapping_list: list of IMemoryMapping
        :param _target: the ITargetPlatform
        :return: IMemoryHandler, self
        :rtype: IMemoryHandler
        """
        if not isinstance(mapping_list, list):
            raise TypeError('Please feed me a list of IMemoryMapping')
        if not isinstance(_target, interfaces.ITargetPlatform):
            raise TypeError('Please feed me a ITargetPlatform')
        self._mappings = sorted(mapping_list)
        self._target = _target
        for m in mapping_list:
            m.set_ctypes(self._target.get_target_ctypes())
        self._utils = self._target.get_target_ctypes_utils()
        self.__name = name
        # book register to keep references to ctypes memory buffers
        self.__book = _book()
        self.__user_model = model.Model(self._target.get_target_ctypes())
        self.__internal_model = model.Model(self._target.get_target_ctypes())
        # FIXME reduce open files.
        self.__required_maps = []
        # finish initialization
        self._heap_finder = None
        self.__optim_get_mapping_for_address()
        self.__context = None
コード例 #3
0
ファイル: test_model.py プロジェクト: yep0/python-haystack
 def setUpClass(cls):
     cls.memory_handler = process.read_local_process_mappings()
     cls.my_target = cls.memory_handler.get_target_platform()
     cls.my_model = model.Model(cls.memory_handler)