Skip to main content

Getting started

Create a new repository from the C++ plugin template by clicking Use this template on GitHub. Clone your new repository and rename the project in CMakeLists.txt and plugin.toml to match your plugin name.The template gives you a working plugin with CMake configuration, a plugin.toml manifest, example source code, and CI already set up.

Prerequisites

  • C++20 compiler (GCC 11+, Clang 13+, or MSVC 2019 16.10+)
  • CMake 3.20+

Project structure

CMakeLists.txt

plugin.toml

Every plugin needs a plugin.toml manifest alongside its binary. This tells the daemon how to manage your plugin.
See the Plugin Configuration Reference for the full field list, defaults, and validation rules.

src/main.cpp

Handler methods

Override virtual methods on the malbox::HostPlugin base class:

Pushing results

Results are pushed to the daemon via the ResultSink obtained from ctx.results(). You can call push methods multiple times to stream results incrementally:
Each result name should match an entry in your plugin.toml under [results.*].

Reports

For structured analysis output with verdicts, indicators, TTPs, and frontend-renderable sections, use the ReportBuilder to construct a Report and push it as a result. Reports support:
  • Verdicts with classification (clean/suspicious/malicious/unknown), confidence, and score
  • Indicators (IOCs) with open-vocabulary types like sha256, ipv4, domain
  • TTPs referencing MITRE ATT&CK techniques
  • Artifact references linking to sibling PluginResult entries
  • Presentation sections with typed blocks (markdown, tables, code, hex dumps, graphs, timelines, and more)
See the results and reports reference for the complete type catalog, or the SDK reference for builder API methods.

Handling errors

Plugin methods can throw malbox::Error to signal failures. The SDK catches exceptions at the FFI boundary and reports them to the runtime.
SDK methods like ctx.task().sample_bytes() also throw malbox::Error on failure.

Subscribing to events

Override on_event to react to system-wide or plugin lifecycle events:
See the Events Reference for the full list of available events.

Thread safety

When using ExecutionContext::Parallel, multiple on_task calls may execute concurrently. Protect shared mutable state with std::mutex or similar. Health checks may also arrive on a different thread regardless of execution context.

Build

Linux

Host plugins always target Linux (they run on the daemon machine). Guest plugins targeting a Linux guest VM also use this.

Deploy

Place the compiled binary and plugin.toml in a subdirectory of the daemon’s plugin directory. The daemon discovers plugins automatically on startup.
~/.config/malbox/plugins/
my-host-plugin-bin
plugin.toml

Examples

See the example plugins on GitHub.