Skip to content

meltedinhex/analyst-ai-pack / skills/scoping-an-incident-from-a-single-indicator

scoping-an-incident-from-a-single-indicator

Verified

Expands one indicator into the full scope of an incident: pivoting across data sources to find related hosts, accounts, and infrastructure, building a timeline, and bounding what is and is not affected. Activates for requests to scope an incident, pivot from a single IOC, or determine the blast radius of a detection.

FileKindSize
LICENSEother340 B
SKILL.mdskill md3.0 KB
references/api-reference.mdmarkdown1.3 KB
scripts/analyst.pyscript2.5 KB

scripts/analyst.py

View on GitHub
#!/usr/bin/env python3
"""Pivot from a seed indicator across event records to scope an incident.

Reads a JSON list of normalized events (each may contain hosts, accounts, and indicator values)
and performs breadth-first pivoting from a seed value: any event sharing a known entity pulls in
its other entities, expanding the affected set. Produces the involved entities and a sorted
timeline. It reads local JSON only; it touches no live systems.
"""
from __future__ import annotations

import argparse
import json
import sys
from pathlib import Path

ENTITY_FIELDS = ["host", "account", "indicator", "src_ip", "dst_ip", "domain", "sha256"]


def _entities(ev: dict) -> set:
    vals = set()
    for f in ENTITY_FIELDS:
        v = ev.get(f)
        if isinstance(v, list):
            vals.update(str(x) for x in v)
        elif v:
            vals.add(str(v))
    return vals


def scope(events: list[dict], seed: str) -> dict:
    known = {seed}
    included_idx = set()
    changed = True
    while changed:
        changed = False
        for i, ev in enumerate(events):
            if i in included_idx:
                continue
            ents = _entities(ev)
            if ents & known:
                included_idx.add(i)
                new = ents - known
                if new:
                    known |= new
                    changed = True

    involved = [events[i] for i in sorted(included_idx)]
    timeline = sorted(involved, key=lambda e: e.get("ts", 0))
    hosts = sorted({str(e["host"]) for e in involved if e.get("host")})
    accounts = sorted({str(e["account"]) for e in involved if e.get("account")})
    return {
        "seed": seed,
        "entities_discovered": sorted(known),
        "affected_hosts": hosts,
        "affected_accounts": accounts,
        "event_count": len(involved),
        "earliest_event": timeline[0] if timeline else None,
        "timeline": timeline,
    }


def main(argv: list[str] | None = None) -> int:
    parser = argparse.ArgumentParser(description="Scope an incident from one indicator")
    sub = parser.add_subparsers(dest="cmd", required=True)
    p = sub.add_parser("scope")
    p.add_argument("file", help="JSON list of normalized events")
    p.add_argument("--seed", required=True, help="seed indicator value")
    args = parser.parse_args(argv)
    events = json.loads(Path(args.file).read_text(encoding="utf-8"))
    print(json.dumps(scope(events, args.seed), indent=2))
    return 0


if __name__ == "__main__":
    sys.exit(main())
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall