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

Multiple plugins inside same file not registered #974

Open
JSCU-CNI opened this issue Dec 10, 2024 · 1 comment
Open

Multiple plugins inside same file not registered #974

JSCU-CNI opened this issue Dec 10, 2024 · 1 comment

Comments

@JSCU-CNI
Copy link
Contributor

JSCU-CNI commented Dec 10, 2024

Given the following setup:

dissect/target/plugins/apps/nsexample/
├── foobar.py
├── __init__.py
└── nsexample.py

*nsexample/nsexample.py*

from dissect.target.plugin import NamespacePlugin


class ExampleNamespacePlugin(NamespacePlugin):
    """example namespace plugin"""
    __namespace__ = "nsexample"

*nsexample/foobar.py*

from typing import Iterator
from dissect.target.plugin import export
from dissect.target.plugins.apps.nsexample.nsexample import ExampleNamespacePlugin


class FooPlugin(ExampleNamespacePlugin):
    """Foo plugin."""

    __namespace__ = "foo"

    @export(output="yield")
    def hello(self) -> Iterator[str]:
        """hello from foo.example"""
        yield "hello from foo.example"


class BarPlugin(ExampleNamespacePlugin):
    """Bar plugin."""

    __namespace__ = "bar"

    @export(output="yield")
    def hello(self) -> Iterator[str]:
        """hello from bar.example"""
        yield "hello from bar.example"

We would expect both foo.hello and bar.hello to be registered as plugins. However it seems only bar.hello is registered. the namespace plugin nsexample.hello does seem to pick up foo.hello.

$ target-query -l | grep hello
bar.hello - hello from bar.example (output: lines)
nsexample.hello - Return hello for: foo,bar (output: records)
@Schamper
Copy link
Member

I wonder if #763 already has any impact on this. At least it will be a requirement before touching this.

I'll try and rebase that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants