dissect.target.plugins.os.unix.locate.mlocate

Module Contents

Classes

MLocate

MLocateFile

mlocate file parser

MLocatePlugin

Unix mlocate plugin.

Attributes

dissect.target.plugins.os.unix.locate.mlocate.mlocate_def = Multiline-String
Show Value
"""
#define MAGIC 0x006d6c6f63617465             /* b'/x00mlocate' */

struct header_config {
    int32 conf_size;
    int8 version;                            /* file format version */
    int8 require_visibility;
    int8 pad0[2];                             /* 32-bit total alignment */
    char root_database;
    char config_block[conf_size];
    int8 pad1;
};

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[];
};
"""
class dissect.target.plugins.os.unix.locate.mlocate.MLocate
ts: datetime.datetime
ts_ns: int
parent: str
path: str
dbe_type: str
dissect.target.plugins.os.unix.locate.mlocate.MLocateRecord
dissect.target.plugins.os.unix.locate.mlocate.c_mlocate
class dissect.target.plugins.os.unix.locate.mlocate.MLocateFile(fh: BinaryIO)

mlocate file parser

Resources:
fh
header
__iter__() Iterable[MLocateFile]
class dissect.target.plugins.os.unix.locate.mlocate.MLocatePlugin(target: dissect.target.Target)

Bases: dissect.target.plugins.os.unix.locate.locate.BaseLocatePlugin

Unix mlocate plugin.

__namespace__ = 'mlocate'

Defines the plugin namespace.

path = '/var/lib/mlocate/mlocate.db'
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.

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: