Plugins are WebAssembly components that run sandboxed inside postmortem's
ingest pipeline, alongside the built-in modules (ADR-022). They are written
against the same API as the built-in parsers: pm-plugin-api.
cp -r plugins/examples/big_round_files my_plugin
# edit Cargo.toml (name), src/lib.rs, plugin.toml
rustup target add wasm32-wasip2
cargo build --release --target wasm32-wasip2
mkdir -p ~/postmortem/Plugins/my_plugin
cp plugin.toml target/wasm32-wasip2/release/my_plugin.wasm ~/postmortem/Plugins/my_plugin/Set component = "my_plugin.wasm" in plugin.toml. Then open
Tools › Plugins › Reload in postmortem and enable the module in the
ingest module list (Add Data Source, or Run Ingest Modules).
use pm_plugin_sdk::api::*;
#[derive(Default)]
struct MyPlugin;
impl Plugin for MyPlugin {
fn info(&self) -> PluginInfo { /* id, name, file_filter, data_source_stage */ }
fn file_ingest(&self, settings: &serde_json::Value) -> Result<Option<Box<dyn FileIngest>>> { … }
fn data_source_ingest(&self, settings: &serde_json::Value) -> Result<Option<Box<dyn DataSourceIngest>>> { … }
}
pm_plugin_sdk::export_plugin!(MyPlugin);- File ingest (
FileIngest::process) is called for each file that matchesPluginInfo::file_filter(MIME types such asimage/*, extensions, exact names, size cap); the host applies the filter, so narrow filters keep plugins fast. - Data-source ingest (
DataSourceIngest::process) runs once per job in the declared stage (1 runs alongside file analysis; 2+ after it). - Host calls:
read(orHostReaderforio::Read + Seek),file,find_files,children,post(aNewResultwith a Autopsy artifact type such asKAAMOS_INTERESTING_ITEMand Autopsy attribute types such asKAAMOS_SET_NAME),add_derived(extracted files, scheduled for analysis),log,message(ingest inbox),is_cancelled. - Communications (API 0.2):
post_communicationposts a result such asKAAMOS_EMAIL_MSGorKAAMOS_CONTACTtogether with its accounts (e.g.EMAIL/PHONEidentifiers) and a MESSAGE / CALL_LOG / CONTACT relationship between them, atomically. - Custom types (API 0.2):
define_attribute_typeanddefine_artifact_typeregister types that results may then use by name. - Settings are JSON.
default_settingsprovides the defaults shown in the ingest module list, where the examiner can edit them;validaterejects bad settings before the job starts. - Re-runs are idempotent: posting the same result twice on a file adds
it once;
add_derivedadds a file's children once.
plugin.toml:
api = "0.3" # the pm-plugin-api version you built against
component = "my_plugin.wasm"
[limits]
memory_mb = 256 # linear memory cap per instance
fuel_per_call = 5000000000 # roughly instructions per process callA plugin has no file system, network, environment variables or arguments: evidence and results go only through the host calls. WASI's clocks and random numbers are available (Rust's standard library needs them). A panic, a trap, or an exhausted fuel budget fails that one call (recorded as a module error); the instance is recreated and the job continues.
plugins/examples/big_round_files: Autopsy's "Big and Round File Finder" sample module.plugins/tests/probe: exercises every host call (used by the tests).