dissect.target.loaders.dir#

Module Contents#

Classes#

DirLoader

Load a directory as a filesystem.

Functions#

find_entry_path

map_dirs

Map directories as filesystems into the given target.

find_and_map_dirs

Try to find and map directories as filesystems into the given target.

find_dirs

Try to find if path contains an operating system directory layout and return the OS type and detected

os_type_from_path

Try to detect what kind of operating system directory structure path contains.

is_drive_letter_path

Check if a path can be a drive letter, e.g. C or C:.

Attributes#

dissect.target.loaders.dir.PREFIXES = ['', 'fs']#
class dissect.target.loaders.dir.DirLoader(path: pathlib.Path, **kwargs)#

Bases: dissect.target.loader.Loader

Load a directory as a filesystem.

static detect(path: pathlib.Path) bool#

Detects wether this Loader class can load this specific path.

Parameters:

path – The target path to check.

Returns:

True if the path can be loaded by a Loader instance. False otherwise.

map(target: dissect.target.Target) None#

Maps the loaded path into a Target.

Parameters:

target – The target that we’re mapping into.

dissect.target.loaders.dir.find_entry_path(path: pathlib.Path) str | None#
dissect.target.loaders.dir.map_dirs(target: dissect.target.Target, dirs: list[pathlib.Path | tuple[str, pathlib.Path]], os_type: str, **kwargs) None#

Map directories as filesystems into the given target.

Parameters:
  • target – The target to map into.

  • dirs – The directories to map as filesystems. If a list member is a tuple, the first element is the drive letter.

  • os_type – The operating system type, used to determine how the filesystem should be mounted.

dissect.target.loaders.dir.find_and_map_dirs(target: dissect.target.Target, path: pathlib.Path, **kwargs) None#

Try to find and map directories as filesystems into the given target.

Parameters:
dissect.target.loaders.dir.find_dirs(path: pathlib.Path) tuple[str, list[pathlib.Path]]#

Try to find if path contains an operating system directory layout and return the OS type and detected directories.

In the case of a Windows layout, try to find if there are directories for each drive letter and return them all.

Parameters:

path – The path to check.

Returns:

A tuple consisting of the found operating system layout and a list of all detected directories.

dissect.target.loaders.dir.os_type_from_path(path: pathlib.Path) dissect.target.plugin.OperatingSystem#

Try to detect what kind of operating system directory structure path contains.

The operating system type is returned as a string.

Parameters:

path – The path to check.

Returns:

The detected operating system type.

dissect.target.loaders.dir.is_drive_letter_path(path: pathlib.Path) bool#

Check if a path can be a drive letter, e.g. C or C:.

Parameters:

path – The path to check.

Returns:

True if the path can be interpreted as a drive letter or False if it can’t.