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 upsert asset

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

Overview

Concrete tool for creating or updating session Intel asset records with content-addressed deduplication, evidence tracking, and confidence levels, provided by the Mitsu workspace Intel module.

Description

The upsert_asset function adds or updates an asset in the session Intel dict. Assets represent discovered entities: targets, domains, hostnames, IPs, URLs, services, endpoints, technologies, accounts, and other.

Key behaviors:

  • Deduplication: Matches on (type, value, parent) case-insensitively. If an existing asset is found, it is updated rather than duplicated.
  • Stable IDs: Uses SHA256-based identifiers derived from (asset_type, value, parent) for consistency across sessions.
  • Evidence accumulation: Each upsert appends an evidence entry (source, details, confidence, timestamp) without overwriting prior evidence.
  • Validation: Enforces controlled vocabulary for asset_type, verification, scope, and confidence. Validates that values have no control characters and attributes are string-to-string with size limits.
  • Primary target tracking: Setting `primary=True` marks this as the primary target; all other assets lose their primary flag. A primary target must be in_scope.
  • Capacity limits: Raises ValueError if the session already contains the maximum number of assets.

Usage

  • During agent turns: Called by the tool result handler when a tool discovers a new asset (host, service, domain).
  • Intel accumulation: Called from the TUI when the operator manually records an asset.
  • Session resume: Called to rebuild Intel from persisted session data.

Code Reference

Source Location

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

Signature

def upsert_asset(
    intel: dict[str, Any],
    *,
    asset_type: str,
    value: str,
    source: str,
    evidence: str,
    parent: str = "",
    verification: str | None = None,
    scope: str | None = None,
    confidence: str = "medium",
    attributes: dict[str, str] | None = None,
    primary: bool = False,
) -> tuple[dict[str, Any], bool]:

Import

from mitsu.workspace.intel import upsert_asset

I/O Contract

Inputs

Name Type Required Description
intel dict[str, Any] Yes Session Intel dict (mutated in place)
asset_type str Yes One of: target, domain, hostname, nameserver, ip, url, service, endpoint, technology, account, other
value str Yes Asset value (e.g., "example.com", "10.0.0.1")
source str Yes Source of the discovery (e.g., "nmap scan")
evidence str Yes Evidence details for this asset
parent str No Parent asset reference (e.g., domain for a hostname)
verification str No One of: discovered, validated, rejected
scope str No One of: unknown, in_scope, out_of_scope
confidence str No One of: low, medium, high, unknown (default: medium)
attributes dict[str, str] No Additional product/vendor/version attributes (max 64 entries)
primary bool No Mark as primary target (must be in_scope)

Outputs

Name Type Description
returns tuple[dict, bool] (asset_record, was_created) — the asset dict and whether it was newly created

Usage Examples

Record a Discovered Domain

from mitsu.workspace.intel import upsert_asset

intel = {"assets": [], "findings": [], "exploits": [], "observations": []}

asset, created = upsert_asset(
    intel,
    asset_type="domain",
    value="example.com",
    source="dns_lookup",
    evidence="DNS A record resolved to 93.184.216.34",
    confidence="high",
)
print(f"Asset ID: {asset['id']}")
print(f"Created: {created}")  # True on first call, False on duplicate

Record a Service with Attributes

asset, created = upsert_asset(
    intel,
    asset_type="service",
    value="https",
    source="nmap_scan",
    evidence="Nmap detected HTTPS on port 443",
    parent="10.0.0.1",
    attributes={
        "product": "nginx",
        "version": "1.25.3",
        "technology": "web server",
    },
    confidence="high",
)

Mark Primary Target

asset, created = upsert_asset(
    intel,
    asset_type="target",
    value="10.0.0.0/24",
    source="operator_scope",
    evidence="Engagement scope confirmed by operator",
    scope="in_scope",
    primary=True,
)

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

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