Implementation:0xSteph Pentest ai Plugin Loader
| Knowledge Sources | |
|---|---|
| Domains | Plugins, YAML, Tool_Registration |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
Concrete tool for loading custom security tool definitions from YAML files in ~/.pentest-ai/plugins/ and registering them into the ToolRegistry, provided by the pentest-ai tools module.
Description
The plugin_loader module loads tool definitions from ~/.pentest-ai/plugins/*.yaml and returns them as plugin dicts. Each plugin YAML must have required fields: name, category, and command. Optional fields include description, install_cmd, install_method, and manual_url. Plugins are loaded at startup and registered into the ToolRegistry so custom tools coexist with built-in ones.
Usage
Import this module when you need to load custom tool plugins at startup. Used by the tool registry initialization.
Code Reference
Source Location
- Repository: 0xSteph_Pentest_ai
- File: tools/plugin_loader.py
- Lines: 1-71
Signature
DEFAULT_PLUGIN_DIR = Path.home() / ".pentest-ai" / "plugins"
REQUIRED_FIELDS = {"name", "category", "command"}
def load_plugins(plugin_dir: Path | None = None) -> list[dict[str, Any]]: ...
def _load_plugin_file(path: Path) -> dict[str, Any] | None: ...
Import
from tools.plugin_loader import load_plugins, DEFAULT_PLUGIN_DIR, REQUIRED_FIELDS
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| plugin_dir | None | No | Override plugin directory (default: ~/.pentest-ai/plugins) |
Outputs
| Name | Type | Description |
|---|---|---|
| plugins | list[dict] | List of plugin dicts with name, category, command, etc. |
Usage Examples
Load Custom Plugins
from tools.plugin_loader import load_plugins
# Load from default directory
plugins = load_plugins()
for p in plugins:
print(f" {p['name']} ({p['category']}): {p['command']}")
# Load from custom directory
from pathlib import Path
plugins = load_plugins(Path("/opt/custom-tools"))
Example Plugin YAML
# ~/.pentest-ai/plugins/my-scanner.yaml
name: my-scanner
category: web
command: my-scanner --target {target}
description: Custom web vulnerability scanner
install_cmd: ["pip", "install", "my-scanner"]
install_method: pip
manual_url: https://github.com/example/my-scanner