/usr/lib/python2.7/dist-packages/rekall/session_test.py is in python-rekall-core 1.6.0+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | from rekall import addrspace
from rekall import testlib
from rekall import session
class CustomAddressSpace(addrspace.BaseAddressSpace):
def ConfigureSession(self, session_obj):
session_obj.SetCache("foo", "bar", volatile=False)
class SessionTest(testlib.RekallBaseUnitTestCase):
"""Test the RunBasedAddressSpace implementation."""
def setUp(self):
self.session = session.Session()
self.physical_AS = CustomAddressSpace(session=self.session)
def testSessionCache(self):
"""Make sure session gets the correct cache."""
with self.session:
self.session.SetParameter("cache", "memory")
# Set something in the session cache.
self.session.SetCache("a", "b")
# Make sure it is set.
self.assertEqual(self.session.GetParameter("a"), "b")
self.physical_AS.volatile = False
self.session.physical_address_space = self.physical_AS
# None volatile physical address space should use the user specified
# cache type.
self.assertEqual(self.session.cache.__class__.__name__, "Cache")
# Assigning the physical address space causes the cache to be
# purged. The cache is allowed to be purged at any time (it is only a
# cache).
self.assertEqual(self.session.GetParameter("a"), None)
# Volatile physical address space forces a TimedCache
self.physical_AS.volatile = True
self.session.physical_address_space = self.physical_AS
self.assertEqual(self.session.cache.__class__.__name__, "TimedCache")
# Any parameters set by the address space should be present in the
# session cache.
self.assertEqual(self.session.GetParameter("foo"), "bar")
|