Implementation:7onez Cti expert SH Export Read Case
| Knowledge Sources | |
|---|---|
| Domains | OSINT, MISP |
| Last Updated | 2026-10-28 14:00 GMT |
Overview
Concrete tool for reading a case's collected pivots and intake scope from the filesystem (pure I/O, no network), provided by the cti-expert IntelShare module.
Description
The read_case function in sh_export.py reads a case's scope.json and all raw/*.json pivot files. It returns a structured dict with the case ID, case directory, intake scope, and a list of records — each record containing the host, source URL, final URL, collected_at timestamp, and the pivot list. This is the input to build_event: the export reads the case, then classifies and builds the MISP event from the records.
The function is pure filesystem — no network calls, no API. A case can be exported offline.
Usage
Import this when you need to:
- Read a case's collected pivots and scope for MISP export.
- Determine if a case directory exists and has collected raw files.
- Feed the records into build_event for classification and event generation.
Code Reference
Source Location
- Repository: cti-expert
- File: intel_engine/IntelShare/tools/sh_export.py
- Lines: L207-234
Signature
def read_case(case: str, root: str | None = None) -> dict:
"""Read a case's collected pivots and its intake scope. Pure filesystem, no network.
Returns {case, case_dir, scope, records, exists}."""
Import
from sh_export import read_case
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| case | str | Yes | Case ID |
| root | str | No /// Repo root (auto-detected if None) |
Outputs
| Name | Type | Description |
|---|---|---|
| result | dict | {case, case_dir, scope: dict, records: [{host, source, final_url, collected_at, pivots}], exists: bool} |
Usage Examples
Read Case for Export
from sh_export import read_case
data = read_case("CASE-0001")
if not data["exists"]:
print("case directory not found")
elif not data["records"]:
print("no collected pivot files")
else:
print(f"{len(data['records'])} host(s), {data['scope'].get('target_class')}")
for rec in data["records"]:
print(f" {rec['host']}: {len(rec['pivots'])} pivots")