def __init__(self, base=None, session=None, profile=None, **_): """Base is the AS we will be stacking on top of, opts are options which we may use. Args: base: A base address space to stack on top of (i.e. delegate to it for satisfying read requests). session: An optional session object. profile: An optional profile to use for parsing the address space (e.g. needed for hibernation, crash etc.) """ if session is None and base is not None: session = base.session self.base = base if base: self.volatile = self.base.volatile self.profile = profile self.session = session if session is None: raise RuntimeError("Session must be provided.") # This is a short lived cache. If we use a static image, this cache need # not expire, however, when analysing a live system we need to flush the # cache frequently. self.cache = utils.AgeBasedCache(max_age=20)
def __init__(self, base=None, session=None, write=False, profile=None, **_): """Base is the AS we will be stacking on top of, opts are options which we may use. Args: base: A base address space to stack on top of (i.e. delegate to it for satisfying read requests). session: An optional session object. write: Should writing be allowed? Not currently implemented. profile: An optional profile to use for parsing the address space (e.g. needed for hibernation, crash etc.) """ if session is None and base is not None: session = base.session self.base = base if base: self.volatile = self.base.volatile # This is the base address space which this address space reads from. In # this context, this address space is used to read physical addresses as # obtained from get_available_addresses(). NOTE: This is a weak # reference to avoid creating a cycle. self.phys_base = weakref.proxy(self) self.profile = profile self.session = session if session is None: raise RuntimeError("Session must be provided.") self.writeable = (self.session and self.session.writable_address_space or write) # This is a short lived cache. If we use a static image, this cache need # not expire, however, when analysing a live system we need to flush the # cache frequently. self.cache = utils.AgeBasedCache(max_age=20)