Implementation:7onez Cti expert SH Export Build Event
| Knowledge Sources | |
|---|---|
| Domains | OSINT, MISP, Threat_Intel_Sharing |
| Last Updated | 2026-10-28 14:00 GMT |
Overview
Concrete tool for building a MISP event from a case directory with three-way artifact classification (auto/review/never), ownership-gated publication, and leak scanning, provided by the cti-expert IntelShare module.
Description
The build_event function in sh_export.py reads a case's collected pivots and intake scope (pure filesystem, no network), then classifies each pivot artifact into one of three publish classes:
- auto: operator infra (registrant email, wallet, signing cert) — safe to share.
- review: personal data or third-party-derived — held for analyst approval.
- never: page context, noise, or excluded by policy — never shared.
The classification is gated by ownership: a case classified as victim_host or benign_check is REFUSED outright (sharing victim infra as indicators is dangerous). unknown → everything held for review.
The function builds the MISP event with attributes, objects (WHOIS objects, domain objects), tags (TLP, confidence), distribution=0 (staged, organisation-only), published=false. It also produces a leak scan — if the event info or any attribute value carries the operator's own operational strings (case identifiers, local paths, credential markers), the event is REFUSED and nothing is shared.
Usage
Import this when you need to:
- Build a MISP event from a case directory (offline, no network).
- Classify artifacts into auto/review/never publish classes.
- Gate sharing by case ownership class (refuse victim/benign).
- Scan the event for operational-string leaks before sharing.
Code Reference
Source Location
- Repository: cti-expert
- File: intel_engine/IntelShare/tools/sh_export.py
- Lines: L360-529 (build_event), L207-250 (read_case, class_for_case), L259-285 (classify)
Signature
def build_event(case: str, *, root: str | None = None, hosts=None, info: str = "",
label: str = "", tlp: str = "", confidence: str = "moderate",
threat_level=None, analysis=None, include_review: bool = False,
review_values=None, requested_distribution: int = 0, extra_tags=None,
max_attributes: int = 0, analyst_md: str = "") -> dict:
"""Build the MISP event for a case. Returns the event plus review/excluded lists."""
def classify(kind: str, value, *, confidence: str = "", noise=None) -> tuple:
"""(publish_class, spec, reason) for one pivot artifact."""
def class_for_case(scope: dict) -> tuple:
"""(target_class, policy_entry) from the case's intake scope."""
Import
from sh_export import build_event, classify, class_for_case
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| case | str | Yes /// Case ID | |
| root | str | No /// Repo root | |
| info | str | No /// Event headline (never a case ID) | |
| tlp | str | No /// TLP level (default from event defaults) | |
| confidence | str | No /// ICD-203 term (default "moderate") | |
| include_review | bool | No /// Include review-classed values (default False) | |
| review_values | list | No /// Individually approved values |
Outputs
| Name | Type | Description |
|---|---|---|
| result | dict | {meta, Event: {info, date, threat_level_id, distribution:0, published:false, Tag, Attribute, Object?}, review, excluded, counts, EventReport} |
Usage Examples
Build Event (Offline)
from sh_export import build_event
result = build_event(
case="CASE-0001",
info="Fraud network sharing registrant email",
tlp="TLP:AMBER",
confidence="moderate",
)
print(f"attributes: {result['counts']['attributes']}")
print(f"review: {result['counts']['review']}")
print(f"excluded: {result['counts']['excluded']}")
if result["meta"].get("refusal"):
print(f"REFUSED: {result['meta']['refusal']}")
Include Approved Review Values
result = build_event(
case="CASE-0001",
include_review=True,
review_values=["operator@example.com"], # individually approved
)
Related Pages
Implements Principle
- Principle:7onez_Cti_expert_Three_Way_Artifact_Classification
- Principle:7onez_Cti_expert_Ownership_Gated_Sharing