This guide provides step-by-step instructions for developing and integrating plugins into PANTHER. Plugins extend the functionality of PANTHER by implementing new protocols, environments, or service behaviors.
- Define the behavior of network protocols (e.g., QUIC).
- Path:
plugins/services/{protocol_name}/
.
- Manage the test environment (e.g., Docker Compose, Shadow).
- Path:
plugins/environments/{environment_type}/
.
- Implement the logic for individual services.
- Path:
plugins/services/{service_type}/{service_name}/
.
Each plugin must include:
config_schema.py
:- Defines the configuration schema for the plugin.
- Example:
from dataclasses import dataclass @dataclass class MyPluginConfig: param1: str param2: int
implementation.py
:- Implements the plugin's main functionality.
- Example:
from plugins.plugin_interface import IPlugin class MyPlugin(IPlugin): def execute(self): print("Executing MyPlugin")
config.yaml
:- Provides default or example configurations for the plugin.
Dockerfile
: For environment plugins requiring Docker integration.README.md
: Documentation specific to the plugin.
- Navigate to the appropriate plugin type directory (e.g.,
plugins/services/
). - Create a new folder for your plugin:
mkdir -p plugins/services/my_service
-
Create
config_schema.py
:from dataclasses import dataclass @dataclass class MyServiceConfig: name: str version: str param1: int
-
Ensure the schema includes all necessary parameters for your plugin.
-
Create
implementation.py
:from plugins.plugin_interface import IPlugin class MyService(IPlugin): def __init__(self, config): self.config = config def execute(self): print(f"Executing service: {self.config.name}")
-
Implement required methods or extend base functionality from
IPlugin
.
-
Create
config.yaml
:my_service: name: "ExampleService" version: "1.0" param1: 42
-
Include any Docker-related configurations if applicable.
- Create a
Dockerfile
in the plugin's directory:FROM python:3.9-slim COPY . /app WORKDIR /app RUN pip install -r requirements.txt CMD ["python", "main.py"]
Run the following command to validate your plugin configuration:
panther validate-config --plugin my_plugin_name
PANTHER automatically discovers plugins placed in the appropriate directory. Ensure the plugin directory is correctly structured.
- Directory:
plugins/services/quic/
- Schema (
config_schema.py
):from dataclasses import dataclass @dataclass class QuicConfig: role: str # Options: client, server version: str # QUIC protocol version
- Implementation (
implementation.py
):from plugins.plugin_interface import IPlugin class Quic(IPlugin): def execute(self): print("Running QUIC implementation")
- Directory:
plugins/environments/docker_compose/
- Schema:
from dataclasses import dataclass @dataclass class DockerComposeConfig: version: str services: dict
- Dockerfile:
FROM docker/compose:latest
-
Plugin Not Found:
- Verify the directory and file structure.
- Ensure the plugin is placed in the correct type directory.
-
Validation Errors:
- Check
config_schema.py
for missing or incorrect parameters. - Use
panther validate-config
for debugging.
- Check
-
Docker Build Fails:
- Confirm the
Dockerfile
path inconfig.yaml
is correct. - Check logs for build-specific errors.
- Confirm the
- Modular Design: Keep your plugin logic decoupled from the core system.
- Comprehensive Testing: Write unit tests for your plugin’s functionality.
- Documentation: Include a
README.md
in the plugin directory to guide users.
For additional support, refer to the Main README or contact the development team.