Skip to content

meltedinhex/analyst-ai-pack / skills/analyzing-dotnet-malware-internals

analyzing-dotnet-malware-internals

Verified

Reverses .NET/managed malware: decompiling MSIL back to C#, defeating common .NET protectors and string encryptors, and tracing reflection-based loaders to recover the real payload. Activates for requests to analyze a .NET sample, decompile MSIL, or unpack a managed loader.

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

scripts/analyst.py

View on GitHub
#!/usr/bin/env python3
"""Identify a .NET/managed assembly and surface basic CLR metadata signals.

Parses the PE far enough to detect the COM descriptor (CLR) data directory and searches for
the ``BSJB`` metadata-root signature. Static parsing only; the sample is never executed.
"""
from __future__ import annotations

import argparse
import json
import struct
import sys
from pathlib import Path


def identify(path: str) -> dict:
    data = Path(path).read_bytes()
    result = {"managed": False, "bsjb_metadata": False, "notes": []}

    if data[:2] != b"MZ":
        result["notes"].append("not a PE (no MZ)")
        return result

    e_lfanew = struct.unpack_from("<I", data, 0x3C)[0]
    if data[e_lfanew:e_lfanew + 4] != b"PE\x00\x00":
        result["notes"].append("no PE signature")
        return result

    coff = e_lfanew + 4
    opt = coff + 20
    magic = struct.unpack_from("<H", data, opt)[0]
    pe32_plus = magic == 0x20B
    # data directories start after the standard+windows optional header fields
    dd_offset = opt + (112 if pe32_plus else 96)
    # COM descriptor is data directory index 14
    com_dir = dd_offset + 14 * 8
    rva, size = struct.unpack_from("<II", data, com_dir)
    if rva and size:
        result["managed"] = True
        result["notes"].append("CLR runtime header (COM descriptor) present")

    if b"BSJB" in data:
        result["bsjb_metadata"] = True
        result["notes"].append("BSJB metadata root signature found")

    if b"mscoree.dll" in data or b"_CorExeMain" in data:
        result["notes"].append("mscoree / _CorExeMain reference")

    result["managed"] = result["managed"] or result["bsjb_metadata"]
    return result


def main(argv: list[str] | None = None) -> int:
    parser = argparse.ArgumentParser(description="Identify managed .NET assembly")
    sub = parser.add_subparsers(dest="cmd", required=True)
    p = sub.add_parser("identify")
    p.add_argument("file")
    args = parser.parse_args(argv)
    print(json.dumps(identify(args.file), indent=2))
    return 0


if __name__ == "__main__":
    sys.exit(main())
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall