Extending
Add an integration
An "integration" is a module: a small piece of code that watches some event types and produces others. Adding a data source — a new API, a new technique — is almost always just a new module. This page shows the whole path, from idea to a submitted pull request.
1. Decide what it watches and produces
Two questions define a module:
- What does it consume? The event types it reacts to, e.g.
DOMAIN_NAMEorIP_ADDRESS. Runspiderfootplus typesfor the full list. - What does it emit? The event types it creates. Reuse existing types where you can — findings and correlation rules are built on them.
If your source needs a new kind of fact that no type covers, add it to
data/event_types.json first.
2. Write the module
Native modules live in crates/spiderfootplus-modules/src/. A module is a struct that
implements the Module trait. Here is a complete, minimal example:
use crate::module_meta;
use async_trait::async_trait;
use spiderfootplus_core::{Event, Module, ModuleCtx, ModuleMeta, UseCase};
use once_cell::sync::Lazy;
pub struct ExampleRep;
static META: Lazy<ModuleMeta> = Lazy::new(|| {
module_meta! {
name: "example_rep",
summary: "Reputation lookup for a domain via example.com's API",
categories: ["Reputation"],
use_cases: [UseCase::Footprint, UseCase::Investigate],
flags: ["apikey"], // mark it if it needs a key
watched: ["DOMAIN_NAME"],
produced: ["MALICIOUS_INTERNET_NAME", "RAW_RIR_DATA"],
options: [("api_key", "", "API key for example.com")],
source: "example.com"
}
});
#[async_trait]
impl Module for ExampleRep {
fn meta(&self) -> &ModuleMeta {
&META
}
async fn handle(&self, event: &Event, ctx: &ModuleCtx) -> anyhow::Result<()> {
let key = ctx.opt("api_key").unwrap_or_default();
if key.is_empty() {
return Ok(()); // no key: opt out quietly
}
let url = format!("https://api.example.com/v1/domain/{}", event.data);
let resp = ctx.http.get(&url).await?;
if resp.status != 200 {
return Ok(());
}
// Emit a raw record, and a finding-worthy event if the source says so.
let raw = ctx.emit("RAW_RIR_DATA", &resp.body, event).await;
if resp.body.contains("\"malicious\":true") {
ctx.emit("MALICIOUS_INTERNET_NAME", &event.data, &raw).await;
}
Ok(())
}
}
Key points:
module_meta!keeps the metadata next to the code.flags: ["apikey"]makes the module show a[key]marker and appear inspiderfootplus providersthinking.ctx.opt("name")reads an option (and any configured API key).ctx.httpis the shared, rate-limited HTTP client.ctx.emit(type, data, parent)creates a new event and returns it, so you can hang further events off it to build the graph.- Return
Ok(())and emit nothing when you have no key or no result. Never panic and never block — everything is async. - Respect
ctx.is_cancelled()in long loops so stop/pause works.
3. Register it
Add it to crates/spiderfootplus-modules/src/lib.rs:
pub mod example_rep;
// ...
reg.register(Arc::new(example_rep::ExampleRep));
4. Record the data source
If the module talks to a third-party API, add it to data/providers.yaml with its
current status and whether it has a free tier. This is what spiderfootplus providers
shows, and it keeps dead sources visible instead of silently failing.
- { id: example_rep, name: ExampleRep, url: https://example.com/,
category: Reputation, status: alive, access: freemium,
free_trial: "yes", checked: knowledge, note: "Free tier 1k/mo." }
5. Test it
Add a unit test for any parsing logic (no network), then try it live:
cargo test -p spiderfootplus-modules
cargo clippy -p spiderfootplus-modules
spiderfootplus try example_rep DOMAIN_NAME example.com
spiderfootplus try runs one module against one input and prints what it emits — the
fastest way to confirm a module or an API key works.
6. Submit it
- Fork the repo and create a branch:
git checkout -b module/example-rep. - Keep the change to your module, its registration, its provider entry and its tests. One module per pull request.
- Make sure
cargo testandcargo clippyare clean. - In the PR description, say what the module consumes and produces, whether it needs a key, and whether the source has a free tier.
Checklist
- Module implements
Moduleand is registered inlib.rs -
watchedandproducedtypes are correct (new types added todata/event_types.jsonif needed) - API key read from options, module opts out quietly without one
- Data source added to
data/providers.yaml - Unit test for parsing;
cargo testandcargo clippypass - Verified with
spiderfootplus try
Legacy Python modules
The engine can also run legacy Python modules unchanged through the legacy
feature, which is how hundreds of community modules keep working while they are
ported to native Rust. Porting one to Rust follows exactly the steps above; the
event types and options are already defined, so you are mostly re-implementing
handle.