Skip to content

Commit

Permalink
Allow DefaultOS to access all plugins (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
cecinestpasunepipe committed Sep 22, 2023
1 parent d3cd4b7 commit e388bb9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dissect/target/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from flow.record import Record, RecordDescriptor

import dissect.target.plugins.general as general
from dissect.target.exceptions import PluginError, UnsupportedPluginError
from dissect.target.helpers import cache
from dissect.target.helpers.record import EmptyRecord
Expand Down Expand Up @@ -527,7 +528,7 @@ def decorator(obj):
return decorator


def plugins(osfilter: str = None) -> Iterator[PluginDescriptor]:
def plugins(osfilter: Optional[type[OSPlugin]] = None) -> Iterator[PluginDescriptor]:
"""Retrieve all plugin descriptors.
Args:
Expand All @@ -553,6 +554,7 @@ def _walk(osfilter: str = None, root: dict = None) -> Iterator[PluginDescriptor]

if (
osfilter
and not isinstance(osfilter, general.default.DefaultPlugin)
and isinstance(osfilter, type)
and issubclass(osfilter, OSPlugin)
and osfilter.__module__.startswith(MODULE_PATH)
Expand Down Expand Up @@ -607,7 +609,7 @@ def lookup(func_name: str, osfilter: str = None) -> Iterator[PluginDescriptor]:
yield from get_plugins_by_namespace(func_name, osfilter=osfilter)


def get_plugins_by_func_name(func_name: str, osfilter: str = None) -> Iterator[PluginDescriptor]:
def get_plugins_by_func_name(func_name: str, osfilter: Optional[type[OSPlugin]] = None) -> Iterator[PluginDescriptor]:
"""Get a plugin descriptor by function name.
Args:
Expand All @@ -619,7 +621,7 @@ def get_plugins_by_func_name(func_name: str, osfilter: str = None) -> Iterator[P
yield plugin_desc


def get_plugins_by_namespace(namespace: str, osfilter: str = None) -> Iterator[PluginDescriptor]:
def get_plugins_by_namespace(namespace: str, osfilter: Optional[type[OSPlugin]] = None) -> Iterator[PluginDescriptor]:
"""Get a plugin descriptor by namespace.
Args:
Expand Down

0 comments on commit e388bb9

Please sign in to comment.