67d5e7da55
- integrations/virustotal: VirusTotal v3 (request-based: IP & domain reports) - templates/: fully-commented manifest + script-command example - README: discovery rules, manifest schema, how to publish and wire into Riposte
26 lines
894 B
Python
26 lines
894 B
Python
"""Example script-based command implementation.
|
|
|
|
Contract (Riposte sandbox):
|
|
- Inputs are available in the global dict `__inputs__` (already parsed JSON).
|
|
- `json`, `os` and `sys` are pre-imported — no need to import them.
|
|
- The script MUST print exactly ONE JSON object to stdout. That object becomes
|
|
the command's output (`data`). Anything else on stdout breaks parsing.
|
|
- On failure, raise an exception (the runner reports it) or exit non-zero.
|
|
|
|
The filename (without .py) MUST match the command id in manifest.yaml, e.g.
|
|
this file `example_command.py` backs the command `id: example_command`.
|
|
"""
|
|
|
|
# Inputs declared in the command's inputs_schema:
|
|
indicator = __inputs__.get("indicator", "")
|
|
|
|
# ... call an API, compute, enrich, etc. ...
|
|
result = {
|
|
"indicator": indicator,
|
|
"verdict": "unknown",
|
|
"score": 0,
|
|
}
|
|
|
|
# Emit the single JSON result object.
|
|
print(json.dumps(result))
|