# -*- coding: utf-8 -*- """The RAW storage media image file-like object implementation.""" import pysmraw from dfvfs import dependencies from dfvfs.file_io import file_object_io from dfvfs.lib import errors from dfvfs.lib import raw from dfvfs.resolver import resolver dependencies.CheckModuleVersion(u'pysmraw') class RawFile(file_object_io.FileObjectIO): """Class that implements a file-like object using pysmraw.""" def __init__(self, resolver_context, file_object=None): """Initializes the file-like object. Args: resolver_context: the resolver context (instance of resolver.Context). file_object: optional file-like object. The default is None. Raises: ValueError: when file_object is set. """ if file_object: raise ValueError(u'File object value set.') super(RawFile, self).__init__(resolver_context) self._file_objects = []
"""The Volume Shadow Snapshots (VSS) file system implementation.""" import pyvshadow # This is necessary to prevent a circular import. import dfvfs.vfs.vshadow_file_entry from dfvfs import dependencies from dfvfs.lib import definitions from dfvfs.lib import errors from dfvfs.lib import vshadow from dfvfs.path import vshadow_path_spec from dfvfs.resolver import resolver from dfvfs.vfs import file_system dependencies.CheckModuleVersion(u'pyvshadow') class VShadowFileSystem(file_system.FileSystem): """Class that implements a file system object using pyvshadow.""" LOCATION_ROOT = u'/' TYPE_INDICATOR = definitions.TYPE_INDICATOR_VSHADOW def __init__(self, resolver_context): """Initializes the file system object. Args: resolver_context: the resolver context (instance of resolver.Context). """ super(VShadowFileSystem, self).__init__(resolver_context)
# -*- coding: utf-8 -*- """The NTFS file-like object implementation.""" import os from dfvfs import dependencies from dfvfs.file_io import file_io from dfvfs.resolver import resolver dependencies.CheckModuleVersion(u'pyfsntfs') class NTFSFile(file_io.FileIO): """Class that implements a file-like object using pyfsntfs.""" def __init__(self, resolver_context): """Initializes the file-like object. Args: resolver_context: the resolver context (instance of resolver.Context). """ super(NTFSFile, self).__init__(resolver_context) self._file_system = None self._fsntfs_data_stream = None self._fsntfs_file_entry = None def _Close(self): """Closes the file-like object.""" self._fsntfs_data_stream = None self._fsntfs_file_entry = None
# -*- coding: utf-8 -*- """The format analyzer.""" import pysigscan from dfvfs import dependencies from dfvfs.analyzer import specification from dfvfs.lib import definitions from dfvfs.resolver import resolver dependencies.CheckModuleVersion(u'pysigscan') class Analyzer(object): """Class that implements the format analyzer.""" _SCAN_BUFFER_SIZE = 33 * 1024 _analyzer_helpers = {} # The archive format category analyzer helpers that do not have # a format specification. _archive_remainder_list = None # The archive format category signature scanner. _archive_scanner = None # The archive format category specification store. _archive_store = None # The compressed stream format category analyzer helpers that do not have
# -*- coding: utf-8 -*- """The operating system file-like object implementation.""" import stat import os import pysmdev from dfvfs import dependencies from dfvfs.file_io import file_io from dfvfs.lib import errors from dfvfs.lib import py2to3 dependencies.CheckModuleVersion(u'pysmdev') class OSFile(file_io.FileIO): """Class that implements a file-like object using os.""" def __init__(self, resolver_context): """Initializes the file-like object. Args: resolver_context: the resolver context (instance of resolver.Context). """ super(OSFile, self).__init__(resolver_context) self._file_object = None self._size = 0 def _Close(self): """Closes the file-like object.
# -*- coding: utf-8 -*- """The FileVault Drive Encryption (FVDE) file-like object.""" import pyfvde from dfvfs import dependencies from dfvfs.file_io import file_object_io from dfvfs.lib import fvde from dfvfs.lib import errors from dfvfs.resolver import resolver dependencies.CheckModuleVersion(u'pyfvde') class FVDEFile(file_object_io.FileObjectIO): """Class that implements a file-like object using pyfvde.""" def _OpenFileObject(self, path_spec): """Opens the file-like object defined by path specification. Args: path_spec (PathSpec): path specification. Returns: A file-like object. Raises: PathSpecError: if the path specification is incorrect. """ if not path_spec.HasParent(): raise errors.PathSpecError( u'Unsupported path specification without parent.')
# -*- coding: utf-8 -*- """The QCOW image file-like object.""" import pyqcow from dfvfs import dependencies from dfvfs.file_io import file_object_io from dfvfs.lib import errors from dfvfs.resolver import resolver dependencies.CheckModuleVersion(u'pyqcow') class QcowFile(file_object_io.FileObjectIO): """Class that implements a file-like object using pyqcow.""" def _OpenFileObject(self, path_spec): """Opens the file-like object defined by path specification. Args: path_spec: the path specification (instance of path.PathSpec). Returns: A file-like object. Raises: PathSpecError: if the path specification is incorrect. """ if not path_spec.HasParent(): raise errors.PathSpecError(
# -*- coding: utf-8 -*- """The VHD image file-like object.""" import pyvhdi from dfvfs import dependencies from dfvfs.file_io import file_object_io from dfvfs.lib import errors from dfvfs.resolver import resolver dependencies.CheckModuleVersion(u'pyvhdi') class VhdiFile(file_object_io.FileObjectIO): """Class that implements a file-like object using pyvhdi.""" def _OpenFileObject(self, path_spec): """Opens the file-like object defined by path specification. Args: path_spec: the path specification (instance of path.PathSpec). Returns: A file-like object. Raises: PathSpecError: if the path specification is incorrect. """ if not path_spec.HasParent(): raise errors.PathSpecError(
def testCheckModuleVersion(self): """Tests the CheckModuleVersion function.""" dependencies.CheckModuleVersion(u'dfdatetime') with self.assertRaises(ImportError): dependencies.CheckModuleVersion(u'bogus')
"""The Logical Volume Manager (LVM) file system implementation.""" import pyvslvm # This is necessary to prevent a circular import. import dfvfs.vfs.lvm_file_entry from dfvfs import dependencies from dfvfs.lib import definitions from dfvfs.lib import errors from dfvfs.lib import lvm from dfvfs.path import lvm_path_spec from dfvfs.resolver import resolver from dfvfs.vfs import file_system dependencies.CheckModuleVersion(u'pyvslvm') class LVMFileSystem(file_system.FileSystem): """Class that implements a file system object using pyvslvm.""" TYPE_INDICATOR = definitions.TYPE_INDICATOR_LVM def __init__(self, resolver_context): """Initializes a file system object. Args: resolver_context: the resolver context (instance of Context). """ super(LVMFileSystem, self).__init__(resolver_context) self._file_object = None
# -*- coding: utf-8 -*- """The EWF image file-like object.""" import pyewf from dfvfs import dependencies from dfvfs.file_io import file_object_io from dfvfs.lib import errors from dfvfs.lib import ewf from dfvfs.resolver import resolver dependencies.CheckModuleVersion(u'pyewf') class EWFFile(file_object_io.FileObjectIO): """Class that implements a file-like object using pyewf.""" def __init__(self, resolver_context, file_object=None): """Initializes the file-like object. Args: resolver_context: the resolver context (instance of resolver.Context). file_object: optional file-like object. Raises: ValueError: when file_object is set. """ if file_object: raise ValueError(u'File object value set.')
# -*- coding: utf-8 -*- """The VMDK image file-like object.""" import pyvmdk from dfvfs import dependencies from dfvfs.file_io import file_object_io from dfvfs.lib import errors from dfvfs.path import factory as path_spec_factory from dfvfs.resolver import resolver dependencies.CheckModuleVersion(u'pyvmdk') class VMDKFile(file_object_io.FileObjectIO): """Class that implements a file-like object using pyvmdk.""" def _OpenFileObject(self, path_spec): """Opens the file-like object defined by path specification. Args: path_spec: the path specification (instance of PathSpec). Returns: A file-like object. Raises: IOError: if the file-like object could not be opened. PathSpecError: if the path specification is incorrect. """ if not path_spec.HasParent(): raise errors.PathSpecError(