dissect.target.filesystems.config
#
Module Contents#
Classes#
Base class for filesystems. |
|
Base class for filesystem entries. |
Attributes#
- dissect.target.filesystems.config.log#
- class dissect.target.filesystems.config.ConfigurationFilesystem(target: dissect.target.Target, path: str, **kwargs)#
Bases:
dissect.target.filesystem.VirtualFilesystem
Base class for filesystems.
- __fstype__: str = 'META:configuration'#
- get(path: str, relentry: dissect.target.filesystem.FilesystemEntry | None = None, *args, **kwargs) dissect.target.filesystem.FilesystemEntry | ConfigurationEntry #
Retrieve a
FilesystemEntry
from the filesystem.- Parameters:
path – The path which we want to retrieve.
- Returns:
A
FilesystemEntry
for the path.
- class dissect.target.filesystems.config.ConfigurationEntry(fs: dissect.target.filesystem.Filesystem, path: str, entry: dissect.target.filesystem.FilesystemEntry, parser_items: dict | Any | None = None)#
Bases:
dissect.target.filesystem.FilesystemEntry
Base class for filesystem entries.
- __getitem__(item: str) ConfigurationEntry #
- get(path: str | None = None) ConfigurationEntry #
Retrieve a FilesystemEntry relative to this entry.
- Parameters:
path – The path relative to this filesystem entry.
- Returns:
A relative FilesystemEntry.
- open() BinaryIO #
Open this filesystem entry.
- Returns:
A file-like object. Resolves symlinks when possible
- 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[ConfigurationEntry] #
Iterate over the contents of a directory, return them as FilesystemEntry’s.
- Returns:
An iterator of directory entries as FilesystemEntry’s.
- is_file(follow_symlinks: bool = True) bool #
Determine if this entry is a file.
- Parameters:
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, returnFalse
otherwise. Iffollow_symlinks
isFalse
, returnTrue
only if the entry is a file (without following symlinks).
- is_dir(follow_symlinks: bool = True) bool #
Determine if this entry is a directory.
- Parameters:
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, returnFalse
otherwise. Iffollow_symlinks
isFalse
, returnTrue
only if the entry is a directory (without following symlinks).
- is_symlink() bool #
Determine whether this entry is a symlink.
- Returns:
True
if the entry is a symbolic link,False
otherwise.
- exists(path: str) bool #
Determines whether a
path
, relative to this entry, exists.If the path is a symbolic link, it will attempt to resolve it to find the FilesystemEntry it points to.
- Parameters:
path – The path relative to this entry.
- Returns:
True
if the path exists,False
otherwise.
- 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
isTrue
, it gets resolved, attempting to stat the path where it points to.- Parameters:
follow_symlinks – Whether to resolve the symbolic link if this entry is a symbolic link.
- Returns:
The stat information of this entry.
- lstat() dissect.target.helpers.fsutil.stat_result #
Determine the stat information of this entry, without resolving the symlinks.
When it detects a symlink, it will stat the information of the symlink, not the path it points to.
- Returns:
The stat information of this entry.
- as_dict() dict #