Implementation:7onez Cti expert Ingest Webpivot Ingest File
| Knowledge Sources | |
|---|---|
| Domains | OSINT, Knowledge_Base |
| Last Updated | 2026-10-28 14:00 GMT |
Overview
Concrete tool for adapting WebPivot raw JSON into KB entities and edges with provenance, idempotency, and noise filtering, provided by the cti-expert KB adapter.
Description
The ingest_file function in ingest_webpivot.py is the adapter between the raw pivot JSON (from WebPivot or BinaryPivot collection) and the knowledge base. It reads a raw JSON file, determines the collector type (web host, binary, GitHub, IP), and routes to the appropriate ingest branch. For web hosts, it maps pivot artifacts (domains, IPs, emails, trackers, favicons, wallets) to KB entities (add_fact) and relationships (add_edge), each carrying source, collector, observed_at, confidence, and evidence_ref.
The adapter is idempotent: add_fact is deduped on (attribute, value, source, collector); add_edge is deduped on the full edge key. Re-ingesting the same file updates observed_at but never overwrites a disagreement — conflicts are kept as separate facts. The binary branch (_ingest_binary) requires a valid SHA-256 hash as a completeness gate — a truncated or forged JSON never reaches the KB.
Usage
Import this when you need to:
- Convert raw pivot JSON files into KB entities and edges.
- Ingest binary analysis JSON (BinaryPivot) into the same KB as web evidence.
- Ensure idempotent re-ingest (safe to re-run after interrupted collection).
- Apply noise filtering (parking favicons, registrar contacts, boilerplate rels) at ingest time.
Code Reference
Source Location
- Repository: cti-expert
- File: intel_engine/tools/kb/ingest_webpivot.py
- Lines: L857-877 (ingest_file), L784-843 (_ingest_binary)
Signature
def ingest_file(kb, path):
"""Read a raw pivot JSON file and ingest its artifacts into the KB.
Routes to _ingest_binary if meta.collector starts with 'binarypivot/',
_ingest_github if meta.kind == 'github', or the web-host branch otherwise.
Returns the number of facts/edges ingested."""
Import
from ingest_webpivot import ingest_file
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| kb | KB | Yes | Knowledge base instance |
| path | str | Yes | Path to raw pivot JSON file |
Outputs
| Name | Type | Description |
|---|---|---|
| count | int | Number of facts/edges ingested (0 if skip) |
Usage Examples
Ingest Web Host Evidence
from knowledge_base import KB
from ingest_webpivot import ingest_file
kb = KB(KB_DIR)
n = ingest_file(kb, "cases/CASE-0001/raw/example.com.json")
print(f"ingested {n} facts/edges")
Ingest All Raw Files in a Case
import glob
from knowledge_base import KB
from ingest_webpivot import ingest_file
kb = KB(KB_DIR)
for path in sorted(glob.glob("cases/CASE-0001/raw/*.json")):
ingest_file(kb, path)
# Binary files under bin/analysis/ are ingested by binary_auto.ingest
Related Pages
Implements Principle
- Principle:7onez_Cti_expert_KB_Entity_Edge_Model
- Principle:7onez_Cti_expert_Provenance_Idempotent_Ingest