repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
import-powerview-powerup-sheet.pyPython72 lines2.5 KiBraw download
#!/usr/bin/env python3
"""Import the vault's PowerView + PowerUp deep-dive into the AD collection."""

from __future__ import annotations

import re
from pathlib import Path


SOURCE = Path(
    "/home/daemon-sec/git/NetrunnerVault/02Cybersecurity/Cheatsheets/ActiveDirectory/"
    "PowerView-PowerUp-Cheatsheet.md"
)
REPO_ROOT = Path(__file__).resolve().parents[1]
DESTINATION = REPO_ROOT / "src/content/sheets/active-directory/powerview-powerup.md"

FRONTMATTER = """---
title: "PowerView and PowerUp Deep-Dive"
description: "Comprehensive PowerView domain-enumeration and PowerUp local Windows privilege-escalation reference, with read-only triage, validation, cleanup, and function indexes."
category: active-directory
subcategory: "Tooling & Recon"
tags: [active-directory, powerview, powerup, powershell, enumeration, privilege-escalation]
tools: [PowerView, PowerUp, PowerShell]
difficulty: advanced
updated: "2026-08-29"
source: "vault:ActiveDirectory/PowerView-PowerUp-Cheatsheet.md"
---
"""

DOWNLOADS = {
    "../Pentest%20Attack%20Flow/General%20Pentest%20Cheatsheets/attachments/PowerView.ps1": (
        "/downloads/pentest-workflow/PowerView.ps1"
    ),
    "../Pentest%20Attack%20Flow/General%20Pentest%20Cheatsheets/attachments/PowerUp.ps1": (
        "/downloads/pentest-workflow/PowerUp.ps1"
    ),
}


def main() -> None:
    body = SOURCE.read_text(encoding="utf-8")
    if not body.startswith("---\n"):
        raise SystemExit(f"Expected YAML frontmatter in {SOURCE}")
    _, _, body = body.split("---\n", 2)

    # Obsidian-only note furniture has no meaning on the generated site.
    body = re.sub(r"```dataviewjs\n.*?\n```\n*", "", body, count=1, flags=re.DOTALL)

    for source_href, public_href in DOWNLOADS.items():
        filename = Path(public_href).name
        checksum_href = f"{public_href}.sha256"
        body = body.replace(
            f"[{filename}]({source_href})",
            f"[{filename}]({public_href}) ([SHA-256]({checksum_href}))",
        )

    body = body.replace(
        "[[BloodHound-Cheatsheet]]",
        "[BloodHound cheat sheet](/sheets/active-directory/bloodhound/)",
    )

    unresolved = re.findall(r"!?\[\[[^\]]+\]\]", body)
    if unresolved:
        raise SystemExit(f"Unresolved Obsidian links: {unresolved}")

    DESTINATION.parent.mkdir(parents=True, exist_ok=True)
    DESTINATION.write_text(FRONTMATTER + body.lstrip(), encoding="utf-8")
    print(f"Imported {DESTINATION.relative_to(REPO_ROOT)}")


if __name__ == "__main__":
    main()