dissect.target.filesystems.tar#

Module Contents#

Classes#

TarFilesystem

Filesystem implementation for tar files.

TarFilesystemEntry

Virtual file backed by a file-like object.

TarFilesystemDirectoryEntry

Virtual directory implementation. Backed by a dict.

Attributes#

log

dissect.target.filesystems.tar.log#
class dissect.target.filesystems.tar.TarFilesystem(fh: BinaryIO, base: str | None = None, tarinfo: tarfile.TarInfo | None = None, *args, **kwargs)#

Bases: dissect.target.filesystem.Filesystem

Filesystem implementation for tar files.

__type__ = 'tar'#
get(path: str, relentry: dissect.target.filesystem.FilesystemEntry | None = None) dissect.target.filesystem.FilesystemEntry#

Returns a TarFilesystemEntry object corresponding to the given path.

class dissect.target.filesystems.tar.TarFilesystemEntry(fs: Filesystem, path: str, entry: Any)#

Bases: dissect.target.filesystem.VirtualFile

Virtual file backed by a file-like object.

open() BinaryIO#

Returns file handle (file-like object).

iterdir() Iterator[str]#

Iterate over the contents of a directory, return them as strings.

Returns:

An iterator of directory entries as path strings.

scandir() Iterator[dissect.target.filesystem.FilesystemEntry]#

Iterate over the contents of a directory, return them as FilesystemEntry’s.

Returns:

An iterator of directory entries as FilesystemEntry’s.

is_dir(follow_symlinks: bool = True) bool#

Return whether this entry is a directory.

is_file(follow_symlinks: bool = True) bool#

Return whether this entry is a file.

Return whether this entry is a link.

Read the link if this entry is a symlink. Returns a string.

Read the link if this entry is a symlink. Returns a filesystem entry.

stat(follow_symlinks: bool = True) dissect.target.helpers.fsutil.stat_result#

Return the stat information of this entry.

lstat() dissect.target.helpers.fsutil.stat_result#

Return the stat information of the given path, without resolving links.

class dissect.target.filesystems.tar.TarFilesystemDirectoryEntry(fs: TarFilesystem, path: str, entry: tarfile.TarInfo)#

Bases: dissect.target.filesystem.VirtualDirectory

Virtual directory implementation. Backed by a dict.

stat(follow_symlinks: bool = True) dissect.target.helpers.fsutil.stat_result#

Return the stat information of this entry.

lstat() dissect.target.helpers.fsutil.stat_result#

Return the stat information of the given path, without resolving links.