Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow all plugins to access a drop folder from the log loader #399

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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