Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:ARCANGEL0 EVA build surface graph

From Leeroopedia
Knowledge Sources
Domains Pentest, Knowledge_Graphs, Visualization
Last Updated 2026-10-29 14:00 GMT

Overview

Concrete tool for constructing a graph of nodes and edges from session Intel records — mapping assets, findings, exploits, and observations into a structured knowledge graph, provided by the Mitsu surface map module.

Description

The build_surface_graph function transforms flat Intel records into a structured graph:

  1. Node generation: Iterates Intel sections (assets, findings, exploits, observations, accounts, manhunt), creating nodes with stable IDs, categories, labels, and detail fields. Asset types are mapped to graph categories via `_ASSET_CATEGORIES` (e.g., "target"→"asset", "service"→"service").
  2. Node details: For each node, collects relevant fields (type, scope, severity, status, summary, evidence) using `_node_details`, capping at 12 evidence items and 40 total details.
  3. Edge derivation: Derives edges from:
  * Asset parent relationships (domain→hostname→IP→service)
  * Finding/exploit/observation "asset" references
  * CIDR network containment (IP within network)
  * Optional transcript-derived connections

4 Edge deduplication: Uses an edge_keys set to prevent duplicate edges. 5 Returns a dict with nodes, edges, title, mode, created_at, updated_at, counts.

Usage

  • Surface map generation: Called by `create_surface_map` to build the graph before HTML rendering.
  • Live map preview: Can be called directly to get the graph structure without saving to HTML.

Code Reference

Source Location

  • Repository: Mitsu
  • File: workspace/surface_map.py

Signature

def build_surface_graph(
    session: dict[str, Any],
    extra_nodes: list[dict[str, Any]] | None = None,
    connections: list[dict[str, Any]] | None = None,
) -> dict[str, Any]:

Import

from mitsu.workspace.surface_map import build_surface_graph

I/O Contract

Inputs

Name Type Required Description
session dict[str, Any] Yes Session dict with "intel" key
extra_nodes None No Optional transcript-derived nodes
connections None No Optional transcript-derived connections

Outputs

Name Type Description
returns dict[str, Any] {nodes, edges, title, mode, created_at, updated_at, counts, transcript_node_count}

Usage Examples

Build Graph from Session

from mitsu.workspace.surface_map import build_surface_graph

graph = build_surface_graph(session_record)
print(f"Nodes: {len(graph['nodes'])}")
print(f"Edges: {len(graph['edges'])}")
print(f"Counts: {graph['counts']}")
# {'asset': 5, 'service': 3, 'finding': 2, 'exploit': 1, ...}

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment