Implementation:7onez Cti expert SH Misp Push
| Knowledge Sources | |
|---|---|
| Domains | OSINT, MISP, Threat_Intel_Sharing |
| Last Updated | 2026-10-28 14:00 GMT |
Overview
Concrete tool for staging a MISP event on an instance at distribution=0 (organisation-only) and unpublished, gated by a confirmation parameter that returns a briefing when absent, provided by the cti-expert IntelShare module.
Description
The push function in sh_misp.py creates or updates the event on the MISP instance. It ALWAYS stages first: organisation-only (distribution=0) and unpublished, whatever distribution the export requested. confirm is a function parameter (not a config value) — without it, the function returns push_briefing() which describes what a push would do (instance, audience, attribute counts, to_ids count, held-back values, case caveat) and sends NOTHING.
Before pushing, the function:
- Validates the event against the instance's own attribute types (via validate_event) — a type the instance does not know is downgraded, not guessed.
- De-duplicates objects on update: /events/edit appends objects (not idempotent), so existing objects are read first and skipped.
- Attaches event reports(s) via the dedicated endpoint (a report key inside the event body is dropped silently by MISP).
The publish=True flag runs the sharing step immediately, but the publish step re-checks its own confirmation and the environment lock, so without the lock the event stays staged.
Usage
Import this when you need to:
- Stage a MISP event at distribution=0, unpublished (organisation-only).
- Get a pre-push briefing without actually pushing (confirm=False).
- Update an existing event without duplicating objects.
- Validate attribute types against the instance's known types.
Code Reference
Source Location
- Repository: cti-expert
- File: intel_engine/IntelShare/tools/sh_misp.py
- Lines: L406-520 (push), L317-359 (push_briefing)
Signature
def push(source, *, confirm: bool = False, event_id=None, case: str = "",
dry_run: bool = False, publish: bool = False, distribution: int = 0) -> dict:
"""Create or update the event on the instance. ALWAYS stages first:
organisation-only and unpublished. Returns briefing if confirm=False."""
def push_briefing(export: dict, *, event_id=None) -> dict:
"""What a push would do. Returned INSTEAD of acting when confirmation is absent."""
Import
from sh_misp import push, push_briefing
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| source | dict | Yes /// Export JSON path or dict | |
| confirm | bool | Yes /// Gate flag (False = briefing only, sends NOTHING) | |
| event_id | int | No /// Update existing event (default: create new) | |
| dry_run | bool | No /// Print exact request without sending | |
| publish | bool | No /// Also run publish step (re-checks its own gates) | |
| distribution | int | No /// Always clamped to 0 (staging) |
Outputs
| Name | Type | Description |
|---|---|---|
| (confirm=False) | dict | push_briefing (instance, audience, counts, held_back, to_proceed) |
| (confirm=True) | dict | {ok, sent, event_id, attributes_sent, objects_sent, distribution:0, published:false, url} |
Usage Examples
Pre-Push Briefing
from sh_misp import push
briefing = push("cases/CASE-0001/misp/event-20261028.json", confirm=False)
print(briefing["action"]) # "CONFIRMATION REQUIRED — nothing has been sent to MISP"
print(briefing["attributes"]) # {total, by_type, to_ids}
print(briefing["held_back"]) # {review: N, excluded: N}
Staged Push
result = push(
"cases/CASE-0001/misp/event-20261028.json",
confirm=True,
)
print(result["event_id"])
print(result["distribution"]) # 0 (organisation-only)
print(result["published"]) # False (staged, not published)