Skip to content

meltedinhex/analyst-ai-pack / skills/monitoring-process-and-file-behavior

monitoring-process-and-file-behavior

Verified

Summarizes runtime behavior of a sample from Procmon-style operation logs — process and thread creation, file and registry writes, and network-related operations — to build a behavioral profile. Activates for requests to analyze Procmon output, summarize sample behavior, or profile process/file/registry activity from a sandbox run.

FileKindSize
LICENSEother340 B
SKILL.mdskill md2.9 KB
references/api-reference.mdmarkdown1.1 KB
scripts/analyst.pyscript2.7 KB

scripts/analyst.py

View on GitHub
#!/usr/bin/env python3
"""Summarize a Procmon-style CSV operation log into a behavioral profile.

Reads a CSV export (Process Monitor "Save as CSV") with at least Process Name, Operation, Path,
and Detail columns. Categorizes operations, reconstructs the process tree from Process Create
events, and highlights persistence-relevant writes. Parses logs only; executes nothing.
"""
from __future__ import annotations

import argparse
import csv
import json
import re
import sys
from collections import Counter

PERSIST_HINTS = ["\\run", "\\runonce", "currentversion\\run", "\\services\\", "startup"]
LOLBINS = ["powershell", "rundll32", "mshta", "regsvr32", "wscript", "cscript", "cmd.exe",
           "certutil", "bitsadmin"]
RE_URL = re.compile(r"https?://[^\s\"'<>]+", re.I)


def _category(op: str) -> str:
    op = op.lower()
    if "process" in op or "thread" in op:
        return "process_thread"
    if "reg" in op:
        return "registry"
    if "tcp" in op or "udp" in op or "connect" in op:
        return "network"
    if "file" in op or "create" in op or "write" in op or "read" in op:
        return "file"
    return "other"


def summarize(path: str) -> dict:
    cats: Counter = Counter()
    children = []
    persistence = []
    urls = set()
    with open(path, newline="", encoding="utf-8-sig", errors="replace") as fh:
        reader = csv.DictReader(fh)
        for row in reader:
            op = row.get("Operation", "")
            target = row.get("Path", "")
            detail = row.get("Detail", "")
            cats[_category(op)] += 1
            if op.lower().startswith("process create"):
                children.append({"parent": row.get("Process Name", ""), "detail": detail})
            low = target.lower()
            if any(h in low for h in PERSIST_HINTS) and "write" in op.lower():
                persistence.append({"op": op, "path": target})
            for u in RE_URL.findall(detail) + RE_URL.findall(target):
                urls.add(u)
    return {
        "operation_categories": dict(cats),
        "process_creates": children[:50],
        "lolbin_children": sorted({b for c in children for b in LOLBINS
                                   if b in c["detail"].lower()}),
        "persistence_writes": persistence[:50],
        "urls": sorted(u.replace("http", "hxxp").replace(".", "[.]") for u in urls),
    }


def main(argv: list[str] | None = None) -> int:
    parser = argparse.ArgumentParser(description="Summarize Procmon CSV behavior")
    sub = parser.add_subparsers(dest="cmd", required=True)
    p = sub.add_parser("summarize")
    p.add_argument("csv")
    args = parser.parse_args(argv)
    print(json.dumps(summarize(args.csv), indent=2))
    return 0


if __name__ == "__main__":
    sys.exit(main())
add-product-e2e-evalpaperclipai/paperclipAdd or extend a Paperclip full-stack runner E2E workflow, fixture, matcher, or report evidence path for local or Daytona execution.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
add-runner-evalpaperclipai/paperclipAdd or extend a Paperclip Runner protocol evaluation definition, roster, assertion, or report fixture with provenance and narrow validation.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
diagnose-why-work-stoppedpaperclipai/paperclipCompatibility entry point for failed, stalled, looping, or over-recovered Paperclip work. Use fix-failed-paperclip-run for the full diagnosis, regression, repair, real verification, and green-PR workflow; honor an explicitly requested diagnosis-only scope.Stars: 115kUpdated Claude CodeCodexVerifiedInstall
fix-failed-paperclip-runpaperclipai/paperclipDiagnose and fix failed, stuck, slow, or incorrectly blocked Paperclip tasks and runs. Use with a task/run URL or failure report to trace the root cause, prove a regression red then green, check second-order effects, verify the real workflow, and deliver a PR with passing checks.Stars: 115kUpdated Claude CodeCodexVerifiedInstall