:py:mod:`dissect.target.plugins.os.unix.locate.mlocate` ======================================================= .. py:module:: dissect.target.plugins.os.unix.locate.mlocate Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.target.plugins.os.unix.locate.mlocate.MLocate dissect.target.plugins.os.unix.locate.mlocate.MLocateFile dissect.target.plugins.os.unix.locate.mlocate.MLocatePlugin Attributes ~~~~~~~~~~ .. autoapisummary:: dissect.target.plugins.os.unix.locate.mlocate.mlocate_def dissect.target.plugins.os.unix.locate.mlocate.MLocateRecord dissect.target.plugins.os.unix.locate.mlocate.c_mlocate .. py:data:: mlocate_def :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ #define MAGIC 0x006d6c6f63617465 /* b'/x00mlocate' */ struct header_config { int32 conf_size; int8 version; /* file format version */ int8 require_visibility; int8 pad[2]; /* 32-bit total alignment */ char root_database; char config_block[conf_size]; int8 pad; }; enum DBE_TYPE: uint8 { /* database entry type */ FILE = 0x0, /* file */ DIRECTORY = 0x1, /* directory */ END = 0x2 /* end of directory */ }; struct directory_entry { /* time is the 'maximum of st_ctime and st_mtime of the directory' according to docs */ int64 time_seconds; int32 time_nanoseconds; int32 padding; char path[]; }; struct entry { char path[]; }; """ .. raw:: html
.. py:class:: MLocate .. py:attribute:: ts :type: datetime.datetime .. py:attribute:: ts_ns :type: int .. py:attribute:: parent :type: str .. py:attribute:: path :type: str .. py:attribute:: dbe_type :type: str .. py:data:: MLocateRecord .. py:data:: c_mlocate .. py:class:: MLocateFile(fh: BinaryIO) mlocate file parser Resources: - https://manpages.debian.org/testing/mlocate/mlocate.db.5.en.html .. py:method:: __iter__() -> Iterable[MLocateFile] .. py:class:: MLocatePlugin(target: dissect.target.Target) Bases: :py:obj:`dissect.target.plugins.os.unix.locate.locate.BaseLocatePlugin` Base class for plugins. Plugins can optionally be namespaced by specifying the ``__namespace__`` class attribute. Namespacing results in your plugin needing to be prefixed with this namespace when being called. For example, if your plugin has specified ``test`` as namespace and a function called ``example``, you must call your plugin with ``test.example``:: A ``Plugin`` class has the following private class attributes: - ``__namespace__`` - ``__record_descriptors__`` With the following three being assigned in :func:`register`: - ``__plugin__`` - ``__functions__`` - ``__exports__`` Additionally, the methods and attributes of :class:`Plugin` receive more private attributes by using decorators. The :func:`export` decorator adds the following private attributes - ``__exported__`` - ``__output__``: Set with the :func:`export` decorator. - ``__record__``: Set with the :func:`export` decorator. The :func:`internal` decorator and :class:`InternalPlugin` set the ``__internal__`` attribute. Finally. :func:`args` decorator sets the ``__args__`` attribute. :param target: The :class:`~dissect.target.target.Target` object to load the plugin for. .. py:attribute:: __namespace__ :value: 'mlocate' .. py:attribute:: path :value: '/var/lib/mlocate/mlocate.db' .. py:method:: check_compatible() -> None Perform a compatibility check with the target. This function should return ``None`` if the plugin is compatible with the current target (``self.target``). For example, check if a certain file exists. Otherwise it should raise an ``UnsupportedPluginError``. :raises UnsupportedPluginError: If the plugin could not be loaded. .. py:method:: locate() -> Iterator[MLocateRecord] Yield file and directory names from mlocate.db file. ``mlocate`` is a new implementation of GNU locate, but has been deprecated since Ubuntu 22. Resources: - https://manpages.debian.org/testing/mlocate/mlocate.db.5.en.html