示例#1
0
    def __init__(self,
                 parser,
                 path,
                 index=None,
                 offset=0,
                 block_size=BLOCK_SIZE,
                 read_write=False,
                 vstype='',
                 disk_mounter='auto',
                 volume_detector='auto'):
        """Instantiation of this class does not automatically mount, detect or analyse the disk. You will need the
        :func:`init` method for this.

        Only use arguments offset and further as keyword arguments.

        :param parser: the parent parser
        :type parser: :class:`ImageParser`
        :param str path: the path of the Disk
        :param str index: the base index of this Disk
        :param int offset: offset of the disk where the volume (system) resides
        :param int block_size:
        :param bool read_write: indicates whether the disk should be mounted with a read-write cache enabled
        :param str vstype: the volume system type to use.
        :param str disk_mounter: the method to mount the base image with
        :param str volume_detector: the volume system detection method to use
        """

        self.parser = parser

        # Find the type and the paths
        path = os.path.expandvars(os.path.expanduser(path))
        self.paths = sorted(_util.expand_path(path))

        self.offset = offset
        self.block_size = block_size
        self.read_write = read_write
        self.disk_mounter = disk_mounter or 'auto'
        self.index = index

        self._name = os.path.split(path)[1]
        self._paths = {}
        self.rwpath = ""
        self.mountpoint = ""
        self.volumes = VolumeSystem(parent=self,
                                    volume_detector=volume_detector,
                                    vstype=vstype)

        self.was_mounted = False
        self.is_mounted = False

        self._disktype = defaultdict(dict)
示例#2
0
    def __init__(
        self,
        parser,
        path,
        index=None,
        offset=0,
        block_size=BLOCK_SIZE,
        read_write=False,
        vstype="",
        disk_mounter="auto",
        volume_detector="auto",
    ):
        """Instantiation of this class does not automatically mount, detect or analyse the disk. You will need the
        :func:`init` method for this.

        Only use arguments offset and further as keyword arguments.

        :param parser: the parent parser
        :type parser: :class:`ImageParser`
        :param str path: the path of the Disk
        :param str index: the base index of this Disk
        :param int offset: offset of the disk where the volume (system) resides
        :param int block_size:
        :param bool read_write: indicates whether the disk should be mounted with a read-write cache enabled
        :param str vstype: the volume system type to use.
        :param str disk_mounter: the method to mount the base image with
        :param str volume_detector: the volume system detection method to use
        """

        self.parser = parser

        # Find the type and the paths
        path = os.path.expandvars(os.path.expanduser(path))
        self.paths = sorted(_util.expand_path(path))

        self.offset = offset
        self.block_size = block_size
        self.read_write = read_write
        self.disk_mounter = disk_mounter or "auto"
        self.index = index

        self._name = os.path.split(path)[1]
        self._paths = {}
        self.rwpath = ""
        self.mountpoint = ""
        self.volumes = VolumeSystem(parent=self, volume_detector=volume_detector, vstype=vstype)

        self.was_mounted = False
        self.is_mounted = False

        self._disktype = defaultdict(dict)
示例#3
0
    def __init__(self, parser, path, offset=0, vstype='detect', read_write=False, method='auto', detection='auto',
                 multifile=True, index=None, mount_directories=True, **args):
        """Instantiation of this class does not automatically mount, detect or analyse the disk. You will need the
        :func:`init` method for this.

        :param parser: the parent parser
        :type parser: :class:`ImageParser`
        :param int offset: offset of the disk where the volume (system) resides
        :param str vstype: the volume system type
        :param bool read_write: indicates whether the disk should be mounted with a read-write cache enabled
        :param str method: the method to mount the base image with
        :param str detection: the method to detect volumes in the volume system with
        :param bool multifile: indicates whether :func:`mount` should attempt to call the underlying mount method with
                all files of a split file when passing a single file does not work
        :param str index: the base index of this Disk
        :param bool mount_directories: indicates whether directories should also be 'mounted'
        :param args: arguments that should be passed down to :class:`Volume` objects
        """

        self.parser = parser

        # Find the type and the paths
        path = os.path.expandvars(os.path.expanduser(path))
        if _util.is_encase(path):
            self.type = 'encase'
        elif _util.is_vmware(path):
            self.type = 'vmdk'
        elif _util.is_compressed(path):
            self.type = 'compressed'
        else:
            self.type = 'dd'
        self.paths = sorted(_util.expand_path(path))

        self.offset = offset
        self.vstype = vstype.lower()

        self.block_size = BLOCK_SIZE

        self.read_write = read_write

        self.method = method

        if detection == 'auto':
            if _util.module_exists('pytsk3'):
                self.detection = 'pytsk3'
            elif _util.command_exists('mmls'):
                self.detection = 'mmls'
            else:
                self.detection = 'parted'
        else:
            self.detection = detection

        self.read_write = read_write
        self.rwpath = ""
        self.multifile = multifile
        self.index = index
        self.mount_directories = mount_directories
        self.args = args

        self.name = os.path.split(path)[1]
        self.mountpoint = ''
        self.avfs_mountpoint = ''
        self.volumes = []
        self.volume_source = ""

        self._disktype = defaultdict(dict)

        self.loopback = ""
        self.md_device = ""