Invoker Anatomy
SIERRA InvokerLink
This document walks you through creating custom Invoker scripts to extend SIERRA’s functionality and automate tasks in your investigations.
1. OverviewLink
Invoker scripts in SIERRA allow you to integrate external tools and scripts (Python, Bash, PowerShell, etc.) into the SIERRA interface. You define each script with a simple YAML configuration file that describes:
- Where to find your script files (
PATHS) - Which scripts to load (
SCRIPTS) - What parameters each script accepts
- How to execute the command
Once invoked, your script must return JSON-formatted results in a prescribed structure so SIERRA can visualize them in the investigation graph.
2. Invoker Script StructureLink
Each Invoker script is configured via a YAML file with the following sections:
- PATHS (optional): A prioritized list of directories where SIERRA locates your script file.
- Name (mandatory): Unique identifier for your Invoker script.
- Description (optional): Brief summary of what the script does.
-
Params (mandatory): List of parameters:
-
Name (mandatory)
- Description (optional)
- Type (mandatory):
STRINGorFILE - Options (optional): e.g.
PRIMARY,MANDATORY - Command (mandatory): The shell command to execute, with parameter placeholders like
{Domain}.
3. Result FormatsLink
Your script must output a JSON object that SIERRA can parse. There are three supported formats:
3.1 Tree TypeLink
Use for hierarchical results.
| JSON | |
|---|---|
type: must beTreeresults: array of strings or nested objects (parent � children)
3.2 Network TypeLink
Use for graph/network relationships.
type: must beNetworkorigins: list of origin node IDsnodes: array of{id, content}objectsedges: array of{source, target, label}
3.3 Error TypeLink
On errors, return:
| JSON | |
|---|---|
SIERRA will display the error and halt the script execution gracefully.
4. Example Invoker ConfigurationLink
Below is a full example of a subdomain lookup Invoker:
| YAML | |
|---|---|
When invoked, SIERRA will locate subfinder.py in the given PATHS, pass the {Domain} argument, and expect a Tree or Network JSON output.
5. Tips & Best PracticesLink
- Validate Input: Check parameter presence and types, returning an
ErrorJSON if invalid. - Timeouts: Ensure long-running scripts implement timeouts to avoid blocking SIERRA.
- Strict Output: Use
sierra.respond(result)to output the final JSON result. Do NOT useprint()orsys.stderr.write()for logging or debugging, as this will break the integration. - Reusability: Modularize code so dependency functions can be shared across multiple Invokers.
6. Advanced Validation Constraints & Async InvokersLink
6.1 Asynchronous Entry PointsLink
SIERRA natively supports asynchronous entry point functions. If your invoker script is non-blocking or uses async/await (e.g. for concurrent web scraping or API calls), simply define the entry point with async def:
| Python | |
|---|---|
asyncio.run() in their standalone CLI scripts.
6.2 Parameter Constraints ValidationLink
You can define compile-time and runtime value assertions for parameters using SierraOption metadata parameters:
min_value(int/float): The minimum numeric threshold.max_value(int/float): The maximum numeric threshold.choices(list): Enforces that the parameter value is one of the listed options.pattern(str): Regular expression pattern that the parameter value must match.
ExampleLink
SIERRA compiled standalone scripts will automatically:
1. Enforce these constraints at runtime before executing the entry point.
2. Terminate execution with an Error JSON payload if the input values violate any of these validations.
Harness the power of SIERRA Invoker scripts to automate your investigative workflows and integrate your favorite tools seamlessly into the SIERRA platform.