:py:mod:`dissect.target.loaders.res` ==================================== .. py:module:: dissect.target.loaders.res Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.target.loaders.res.ResLoader dissect.target.loaders.res.ResFile dissect.target.loaders.res.ResOSPlugin dissect.target.loaders.res.UPR dissect.target.loaders.res.UPF dissect.target.loaders.res.File dissect.target.loaders.res.Folder Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: dissect.target.loaders.res.find_pwr_dir dissect.target.loaders.res.reverse_search Attributes ~~~~~~~~~~ .. autoapisummary:: dissect.target.loaders.res.EXTENSIONS dissect.target.loaders.res.PATH_REPLACEMENTS dissect.target.loaders.res.fname .. py:data:: EXTENSIONS :value: ('upr', 'upf', 'upr.zip', 'upf.zip') .. py:data:: PATH_REPLACEMENTS .. py:function:: find_pwr_dir(path) .. py:class:: ResLoader(path: pathlib.Path, **kwargs) Bases: :py:obj:`dissect.target.loader.Loader` A base class for loading a specific path and coupling it to a :class:`Target `. Implementors of this class are responsible for mapping any type of source data to a :class:`Target `. Whether that's to map all VMDK files from a VMX or mapping the contents of a zip file to a virtual filesystem, if it's something that can be translated to a "disk", "volume" or "filesystem", you can write a loader that maps it into a target. You can do anything you want to manipulate the :class:`Target ` object in your ``map`` function, but generally you do one of the following: * open a :class:`Container ` and add it to ``target.disks``. * open a :class:`Volume ` and add it to ``target.volumes``. * open a :class:`VirtualFilesystem `, add your files into it and add it to ``target.filesystems``. You don't need to manually parse volumes or filesystems in your loader, just add the highest level object you have (e.g. a :class:`Container ` of a VMDK file) to the target. However, sometimes you need to get creative. Take a look at the :class:`ITunesLoader ` and :class:`TarLoader ` for some creative examples. :param path: The target path to load. .. py:method:: detect(path) :staticmethod: Detects wether this ``Loader`` class can load this specific ``path``. :param path: The target path to check. :returns: ``True`` if the ``path`` can be loaded by a ``Loader`` instance. ``False`` otherwise. .. py:method:: map(target) Maps the loaded path into a ``Target``. :param target: The target that we're mapping into. .. py:class:: ResFile(fs, path, entry, **kwargs) Bases: :py:obj:`dissect.target.filesystem.VirtualFile` Virtual file backed by a file-like object. .. py:method:: stat() 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() 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. .. py:method:: open() Open this filesystem entry. :returns: A file-like object. Resolves symlinks when possible .. py:class:: ResOSPlugin(target: dissect.target.Target) Bases: :py:obj:`dissect.target.plugin.OSPlugin` Base class for OS plugins. This provides a base class for certain common functions of OS's, which each OS plugin has to implement separately. For example, it provides an interface for retrieving the hostname and users of a target. All derived classes MUST implement ALL the classmethods and exported methods with the same ``@classmethod`` or ``@export(...)`` annotation. .. py:method:: detect(target) :classmethod: Provide detection of this OSPlugin on a given filesystem. :param fs: :class:`~dissect.target.filesystem.Filesystem` to detect the OS on. :returns: The root filesystem / sysvol when found. .. py:method:: create(target, sysvol) :classmethod: Initiate this OSPlugin with the given target and detected filesystem. :param target: The :class:`~dissect.target.target.Target` object. :param sysvol: The filesystem that was detected in the ``detect()`` function. :returns: An instantiated version of the OSPlugin. .. py:method:: hostname() Return the target's hostname. :returns: The hostname as string. .. py:method:: ips() Return the IP addresses configured in the target. :returns: The IPs as list. .. py:method:: version() Return the target's OS version. :returns: The OS version as string. .. py:method:: users() Return the users available in the target. :returns: A list of user records. .. py:method:: os() Return a slug of the target's OS name. :returns: A slug of the OS name, e.g. 'windows' or 'linux'. .. py:class:: UPR(fh) .. py:method:: open() .. py:class:: UPF(fh) .. py:method:: folders() .. py:method:: files() .. py:class:: File(upf, elem) .. py:property:: path .. py:method:: open() .. py:method:: __repr__() Return repr(self). .. py:class:: Folder(upf, elem, parent=None) .. py:property:: path .. py:method:: __repr__() Return repr(self). .. py:function:: reverse_search(fh, needle) .. py:data:: fname