:py:mod:`dissect.target.filesystems.zip` ======================================== .. py:module:: dissect.target.filesystems.zip Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.target.filesystems.zip.ZipFilesystem dissect.target.filesystems.zip.ZipFilesystemEntry Attributes ~~~~~~~~~~ .. autoapisummary:: dissect.target.filesystems.zip.log .. py:data:: log .. py:class:: ZipFilesystem(fh: BinaryIO, base: str | None = None, *args, **kwargs) Bases: :py:obj:`dissect.target.filesystem.Filesystem` Filesystem implementation for zip files. Python does not have symlink support in the zipfile module, so that's not currently supported. See https://github.com/python/cpython/issues/82102 for more information. .. py:attribute:: __type__ :value: 'zip' A short string identifying the type of filesystem. .. py:attribute:: zip .. py:attribute:: base :value: '' .. py:method:: get(path: str, relentry: dissect.target.filesystem.FilesystemEntry = None) -> dissect.target.filesystem.FilesystemEntry Returns a ZipFilesystemEntry object corresponding to the given path. .. py:class:: ZipFilesystemEntry(fs: ZipFilesystem, path: str, entry: zipfile.ZipInfo) Bases: :py:obj:`dissect.target.filesystem.VirtualDirectory` Virtual directory implementation. Backed by a dict. .. py:attribute:: fs :type: ZipFilesystem .. py:attribute:: entry :type: zipfile.ZipInfo .. py:method:: open() -> BinaryIO Open this filesystem entry. :returns: A file-like object. Resolves symlinks when possible .. py:method:: scandir() -> collections.abc.Iterator[dissect.target.filesystem.DirEntry] Iterate over the contents of a directory, yields :class:`FilesystemEntry`. :returns: An iterator of :class:`FilesystemEntry`. .. py:method:: is_dir(follow_symlinks: bool = True) -> bool Determine if this entry is a directory. :param follow_symlinks: Whether to resolve the entry if it is a symbolic link. :returns: ``True`` if the entry is a directory or a symbolic link to a directory, return ``False`` otherwise. If ``follow_symlinks`` is ``False``, return ``True`` only if the entry is a directory (without following symlinks). .. py:method:: is_file(follow_symlinks: bool = True) -> bool Determine if this entry is a file. :param follow_symlinks: Whether to resolve the entry if it is a symbolic link. :returns: ``True`` if the entry is a file or a symbolic link to a file, return ``False`` otherwise. If ``follow_symlinks`` is ``False``, return ``True`` only if the entry is a file (without following symlinks). .. py:method:: is_symlink() -> bool Determine whether this entry is a symlink. :returns: ``True`` if the entry is a symbolic link, ``False`` otherwise. .. py:method:: readlink() -> str Read the link where this entry points to, return the resulting path as string. If it is a symlink and returns the entry that corresponds to that path. This means it follows the path a link points to, it tries to do it recursively. :returns: The path the link points to. .. py:method:: readlink_ext() -> dissect.target.filesystem.FilesystemEntry Read the link where this entry points to, return the resulting path as :class:`FilesystemEntry`. If it is a symlink and returns the string that corresponds to that path. This means it follows the path a link points to, it tries to do it recursively. :returns: The filesystem entry the link points to. .. py:method:: stat(follow_symlinks: bool = True) -> dissect.target.helpers.fsutil.stat_result Determine the stat information of this entry. If the entry is a symlink and ``follow_symlinks`` is ``True``, it gets resolved, attempting to stat the path where it points to. :param follow_symlinks: Whether to resolve the symbolic link if this entry is a symbolic link. :returns: The stat information of this entry. .. py:method:: lstat() -> dissect.target.helpers.fsutil.stat_result Return the stat information of the given path, without resolving links.