Skip to content

Commit

Permalink
Allow all plugins to access a drop folder from the log loader
Browse files Browse the repository at this point in the history
  • Loading branch information
cecinestpasunepipe committed Sep 15, 2023
1 parent 0ed80a0 commit b77ccf2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dissect/target/loaders/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
from dissect.target.filesystem import VirtualFilesystem
from dissect.target.loader import Loader

DROP_FILE_DIR = "sysvol/drop/"


def dropfolder(target: Target, pattern: str):
"""Convience function, usage:
for data_file in dropfolder(target, "*.data"):
self._plugin_files.append(data_file)
"""
return target.fs.path(DROP_FILE_DIR).glob(pattern)

Check warning on line 18 in dissect/target/loaders/log.py

View check run for this annotation

Codecov / codecov/patch

dissect/target/loaders/log.py#L18

Added line #L18 was not covered by tests


class LogLoader(Loader):
LOGS_DIRS = {
Expand All @@ -29,7 +40,7 @@ def map(self, target: Target) -> None:
vfs = VirtualFilesystem(case_sensitive=False)
for entry in self.path.parent.glob(self.path.name):
ext = self.options.get("hint", entry.suffix.lower()).strip(".")
if (mapping := self.LOGS_DIRS.get(ext, None)) is None:
if (mapping := self.LOGS_DIRS.get(ext, DROP_FILE_DIR)) is None:
continue
mapping = str(Path(mapping).joinpath(entry.name))
vfs.map_file(mapping, str(entry))
Expand Down

0 comments on commit b77ccf2

Please sign in to comment.