Skip to content

meltedinhex/analyst-ai-pack / skills/tracking-adversary-infrastructure

tracking-adversary-infrastructure

Verified

Tracks adversary C2 and staging infrastructure by clustering indicators on shared attributes (TLS/JARM, certificate fields, favicon hashes, ASN, registration patterns) to find related hosts. Activates for requests to track adversary infrastructure, cluster C2 servers, or pivot on infrastructure attributes to find related hosts.

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

scripts/analyst.py

View on GitHub
#!/usr/bin/env python3
"""Cluster suspected adversary infrastructure on shared pivot attributes.

Groups host records that share values for one or more chosen attributes (e.g., JARM, cert CN,
favicon hash, ASN) and ranks clusters by the count of distinct shared attributes. Defangs host
indicators. Parses data only; executes nothing.
"""
from __future__ import annotations

import argparse
import json
import sys
from collections import defaultdict
from pathlib import Path

GENERIC_VALUES = {"", "none", "null", "cloudflare", "n/a"}


def _defang(host: str) -> str:
    return host.replace(".", "[.]")


def cluster(path: str, attrs: list[str]) -> dict:
    hosts = json.loads(Path(path).read_text(encoding="utf-8-sig"))
    # Map (attr, value) -> set of host ids.
    groups: dict[tuple, set] = defaultdict(set)
    host_label = {}
    for i, h in enumerate(hosts):
        hid = h.get("host") or h.get("ip") or str(i)
        host_label[hid] = hid
        for a in attrs:
            val = str(h.get(a, "")).strip().lower()
            if val and val not in GENERIC_VALUES:
                groups[(a, val)].add(hid)
    # Build host->shared-attribute links, then connected clusters via shared keys.
    host_attrs: dict[str, set] = defaultdict(set)
    for (a, val), members in groups.items():
        if len(members) >= 2:
            for m in members:
                host_attrs[m].add((a, val))
    # Union-find over hosts sharing any (attr,value).
    parent: dict[str, str] = {h: h for h in host_attrs}

    def find(x: str) -> str:
        while parent[x] != x:
            parent[x] = parent[parent[x]]
            x = parent[x]
        return x

    for members in groups.values():
        members = [m for m in members if m in parent]
        for m in members[1:]:
            parent[find(m)] = find(members[0])
    clusters: dict[str, set] = defaultdict(set)
    for h in host_attrs:
        clusters[find(h)].add(h)
    result = []
    for members in clusters.values():
        shared = set.intersection(*[host_attrs[m] for m in members]) if members else set()
        result.append({
            "hosts": sorted(_defang(m) for m in members),
            "shared_attributes": sorted(f"{a}={v}" for a, v in shared),
            "strength": len(shared),
        })
    result.sort(key=lambda d: (d["strength"], len(d["hosts"])), reverse=True)
    return {"clusters": result, "cluster_count": len(result)}


def main(argv: list[str] | None = None) -> int:
    parser = argparse.ArgumentParser(description="Cluster adversary infrastructure")
    sub = parser.add_subparsers(dest="cmd", required=True)
    p = sub.add_parser("cluster")
    p.add_argument("hosts")
    p.add_argument("--attrs", required=True, help="comma list, e.g. jarm,cert_cn,asn")
    args = parser.parse_args(argv)
    print(json.dumps(cluster(args.hosts, [a.strip() for a in args.attrs.split(",")]), 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