How to use the dfvfs.resolver.context function in dfvfs

To help you get started, we’ve selected a few dfvfs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github log2timeline / dfvfs / tests / file_io / fake_file_io.py View on Github external
def setUp(self):
    """Sets up the needed objects used throughout the test."""
    self._resolver_context = context.Context()
github log2timeline / dfvfs / tests / vfs / cpio_file_entry.py View on Github external
def setUp(self):
    """Sets up the needed objects used throughout the test."""
    self._resolver_context = context.Context()
    test_file = self._GetTestFilePath(['syslog.bin.cpio'])
    self._SkipIfPathNotExists(test_file)

    self._os_path_spec = os_path_spec.OSPathSpec(location=test_file)
    self._cpio_path_spec = cpio_path_spec.CPIOPathSpec(
        location='/syslog', parent=self._os_path_spec)

    self._file_system = cpio_file_system.CPIOFileSystem(self._resolver_context)
    self._file_system.Open(self._cpio_path_spec)
github log2timeline / dfvfs / tests / vfs / data_range_file_system.py View on Github external
def setUp(self):
    """Sets up the needed objects used throughout the test."""
    self._resolver_context = context.Context()
    test_file = self._GetTestFilePath(['syslog'])
    self._SkipIfPathNotExists(test_file)

    path_spec = os_path_spec.OSPathSpec(location=test_file)
    self._data_range_path_spec = (
        data_range_path_spec.DataRangePathSpec(
            range_offset=0x1c0, range_size=0x41, parent=path_spec))
github log2timeline / dfvfs / tests / vfs / encrypted_stream_file_entry.py View on Github external
def setUp(self):
    """Sets up the needed objects used throughout the test."""
    self._resolver_context = context.Context()
    test_file = self._GetTestFilePath(['syslog.rc4'])
    self._SkipIfPathNotExists(test_file)

    path_spec = os_path_spec.OSPathSpec(location=test_file)
    self._encrypted_stream_path_spec = (
        encrypted_stream_path_spec.EncryptedStreamPathSpec(
            encryption_method=definitions.ENCRYPTION_METHOD_RC4,
            parent=path_spec))
    resolver.Resolver.key_chain.SetCredential(
        self._encrypted_stream_path_spec, 'key', self._RC4_KEY)

    self._file_system = (
        encrypted_stream_file_system.EncryptedStreamFileSystem(
            self._resolver_context))
    self._file_system.Open(self._encrypted_stream_path_spec)
github log2timeline / dfvfs / tests / file_io / os_file_io.py View on Github external
def setUp(self):
    """Sets up the needed objects used throughout the test."""
    self._resolver_context = context.Context()
    test_file = self._GetTestFilePath(['password.txt'])
    self._SkipIfPathNotExists(test_file)

    self._path_spec1 = os_path_spec.OSPathSpec(location=test_file)

    test_file = self._GetTestFilePath(['another_file'])
    self._SkipIfPathNotExists(test_file)

    self._path_spec2 = os_path_spec.OSPathSpec(location=test_file)
github log2timeline / dfvfs / tests / vfs / apfs_container_file_entry.py View on Github external
def setUp(self):
    """Sets up the needed objects used throughout the test."""
    self._resolver_context = context.Context()
    test_file = self._GetTestFilePath(['apfs.raw'])
    self._SkipIfPathNotExists(test_file)

    path_spec = os_path_spec.OSPathSpec(location=test_file)
    self._raw_path_spec = raw_path_spec.RawPathSpec(parent=path_spec)
    self._apfs_container_path_spec = (
        apfs_container_path_spec.APFSContainerPathSpec(
            location='/', parent=self._raw_path_spec))

    self._file_system = apfs_container_file_system.APFSContainerFileSystem(
        self._resolver_context)
    self._file_system.Open(self._apfs_container_path_spec)
github log2timeline / dfvfs / tests / file_io / data_range_io.py View on Github external
def setUp(self):
    """Sets up the needed objects used throughout the test."""
    self._resolver_context = context.Context()
    test_file = self._GetTestFilePath(['syslog'])
    self._SkipIfPathNotExists(test_file)

    self._os_path_spec = os_path_spec.OSPathSpec(location=test_file)
    self._data_range_path_spec = data_range_path_spec.DataRangePathSpec(
        range_offset=167, range_size=1080, parent=self._os_path_spec)
github log2timeline / dfvfs / tests / file_io / apfs_file_io.py View on Github external
def setUp(self):
    """Sets up the needed objects used throughout the test."""
    super(APFSFileTest, self).setUp()
    self._resolver_context = context.Context()
    test_path = self._GetTestFilePath(['apfs.raw'])
    self._SkipIfPathNotExists(test_path)

    test_os_path_spec = path_spec_factory.Factory.NewPathSpec(
        definitions.TYPE_INDICATOR_OS, location=test_path)
    test_raw_path_spec = path_spec_factory.Factory.NewPathSpec(
        definitions.TYPE_INDICATOR_RAW, parent=test_os_path_spec)
    self._apfs_container_path_spec = path_spec_factory.Factory.NewPathSpec(
        definitions.TYPE_INDICATOR_APFS_CONTAINER, location='/apfs1',
        parent=test_raw_path_spec)
github log2timeline / dfvfs / tests / vfs / bde_file_entry.py View on Github external
def setUp(self):
    """Sets up the needed objects used throughout the test."""
    self._resolver_context = context.Context()
    test_file = self._GetTestFilePath(['bdetogo.raw'])
    self._SkipIfPathNotExists(test_file)

    path_spec = os_path_spec.OSPathSpec(location=test_file)
    self._bde_path_spec = bde_path_spec.BDEPathSpec(parent=path_spec)
    resolver.Resolver.key_chain.SetCredential(
        self._bde_path_spec, 'password', self._BDE_PASSWORD)

    self._file_system = bde_file_system.BDEFileSystem(self._resolver_context)
    self._file_system.Open(self._bde_path_spec)
github log2timeline / dfvfs / dfvfs / resolver / resolver.py View on Github external
"""The path specification resolver."""

from __future__ import unicode_literals

from dfvfs.credentials import keychain
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.mount import manager as mount_manager
from dfvfs.path import path_spec
from dfvfs.resolver import context


class Resolver(object):
  """Path specification resolver."""

  _resolver_context = context.Context()
  _resolver_helpers_manager = None

  key_chain = keychain.KeyChain()

  @classmethod
  def _GetResolverHelper(cls, type_indicator):
    """Retrieves the path specification resolver helper for the specified type.

    Args:
      type_indicator (str): type indicator.

    Returns:
      ResolverHelper: a resolver helper.
    """
    if not cls._resolver_helpers_manager:
      # Delay the import of the resolver helpers manager to prevent circular