---
import Base from '../../layouts/Base.astro';
import SectionBanner from '../../components/SectionBanner.astro';
import RecordRow from '../../components/RecordRow.astro';
import CategoryNav from '../../components/CategoryNav.astro';
import SheetFilter from '../../components/SheetFilter.astro';
import SectionJump from '../../components/SectionJump.astro';
import { CATEGORIES } from '../../lib/taxonomy';
import type { CategoryDef } from '../../lib/taxonomy';
import { sheetsByCategory, sheetHref, isReportGuide, sheetFacets, tagSlug, type Sheet } from '../../lib/sheets';
import { url } from '../../lib/url';
import pentestDownloads from '../../data/pentest-workflow-downloads.json';
import { publishedSignatures } from '../../lib/download-signatures';
export async function getStaticPaths() {
const groups = await sheetsByCategory();
return CATEGORIES.map((c, i) => ({
params: { category: c.slug },
props: {
cat: c,
items: groups.find((g) => g.slug === c.slug)?.items ?? [],
n: String(i + 1).padStart(2, '0'),
},
}));
}
interface Props { cat: CategoryDef; items: Sheet[]; n: string }
const { cat, items, n } = Astro.props;
/* Kill-chain order for the sub-sections. A sheet whose subcategory isn't
listed falls to the end under its own name; a category with no
subcategories at all (every domain except Active Directory today) renders
one flat index, exactly as before. */
const SUBCAT_ORDER = [
'Pentest Attack Flow',
'Companion Guides',
'General Pentest Cheatsheets',
'Credential Access',
'Kerberos & Delegation',
'ACL Abuse',
'ADCS & Certificates',
'Domain Controller Attacks',
'Privilege & Group Abuse',
'Lateral Movement',
'Persistence',
'Trust Abuse',
'Advanced & Post-Exploitation',
'Tooling & Recon',
];
/* Within a section: numbered techniques first (attack-2 before attack-40,
esc1 before esc10 — numeric, not lexical), then everything else A→Z. The
prefix rank keeps all attack-* together, then all esc-*, and so on. */
const PFX_RANK: Record<string, number> = { attack: 0, esc: 1, persist: 2, theft: 3, dpersist: 4 };
function sortKey(entry: Sheet): [number, number, number, string] {
const slug = entry.id.split('/').pop() ?? '';
if (entry.data.order !== undefined) return [-1, 0, entry.data.order, slug];
const m = slug.match(/^([a-z]+)-?(\d+)/);
if (m && m[1] in PFX_RANK) return [0, PFX_RANK[m[1]], parseInt(m[2], 10), slug];
return [1, 0, 0, (entry.data.title || slug).toLowerCase()];
}
function cmp(a: Sheet, b: Sheet) {
const ka = sortKey(a), kb = sortKey(b);
for (let i = 0; i < ka.length; i++) {
if (ka[i] < kb[i]) return -1;
if (ka[i] > kb[i]) return 1;
}
return 0;
}
/* Section accents cycle the palette so the sub-headers read as a colour
run down the page, the same key the masthead and marquee use. */
const SECTION_ACCENTS = ['iris', 'foam', 'love', 'gold', 'rose', 'pine'];
const hasSubcats = items.some((s) => s.data.subcategory);
/* `key` is the section's anchor (`#sec-<key>`) and its value in the filter's
`sec` parameter, so a link can land on, or narrow to, one section. */
type Group = { name: string; key: string; accent: string; items: Sheet[] };
let groups: Group[] = [];
if (hasSubcats) {
const buckets = new Map<string, Sheet[]>();
for (const s of items) {
const key = s.data.subcategory ?? 'Other';
(buckets.get(key) ?? buckets.set(key, []).get(key)!).push(s);
}
const ordered = [
...SUBCAT_ORDER.filter((k) => buckets.has(k)),
...[...buckets.keys()].filter((k) => !SUBCAT_ORDER.includes(k)).sort(),
];
groups = ordered.map((name, gi) => ({
name,
key: tagSlug(name),
accent: SECTION_ACCENTS[gi % SECTION_ACCENTS.length],
items: [...buckets.get(name)!].sort(cmp),
}));
}
/* What the filter panel counts. Built from the same calls the rows make
below, so the panel's opening numbers cannot drift from the list. */
const facetRows = hasSubcats
? groups.flatMap((g) => g.items.map((s) => sheetFacets(s, g.key)))
: items.map((s) => sheetFacets(s));
/* The shelf's own name as a tag (`active-directory` on Active Directory)
and any tag every sheet here carries cannot narrow anything, so neither
gets a chip. */
const sharedTags = [
cat.slug,
...[...new Set(facetRows.flatMap((r) => r.tags))].filter((t) => facetRows.every((r) => r.tags.includes(t))),
];
const filterGroups = groups.map((g) => ({ key: g.key, label: g.name, count: g.items.length, accent: g.accent }));
const byDifficulty = (level: string) => items.filter((s) => s.data.difficulty === level).length;
const tools = new Set(items.flatMap((s) => s.data.tools));
const bannerStats = [
{ label: 'Sheets', value: String(items.length).padStart(2, '0'), accent: true },
...(hasSubcats
? [{ label: 'Sections', value: String(groups.length).padStart(2, '0') }]
: [{ label: 'Tools covered', value: String(tools.size).padStart(2, '0') }]),
{ label: 'Beginner / adv', value: `${byDifficulty('beginner')} / ${byDifficulty('advanced')}` },
];
const downloads = cat.slug === 'pentest-workflow' ? pentestDownloads : [];
/* Signing is a manual step that happens after the import, so the page states
only what this build can actually serve: a signature is linked when its
file is in public/downloads, and the library is called signed only when
the manifest and every file have one. */
const signatures = publishedSignatures(downloads);
const downloadBytes = downloads.reduce((sum, item) => sum + item.size, 0);
const downloadSize = `${(downloadBytes / 1024 / 1024).toFixed(1)} MiB`;
---
<Base title={`${cat.title} — DÆMON//SEC`} description={cat.blurb}>
<SectionBanner n={n} label={cat.tag} title={cat.title} blurb={cat.blurb} accent={cat.accent} stats={bannerStats} />
<div class="wrap">
<nav class="breadcrumb" style="margin-top:1.6rem;">
<a href={url('')}>~</a><span class="sep">/</span>
<span style={`color: var(--${cat.accent})`}>{cat.tag.toLowerCase()}</span>
</nav>
<div style="margin:1.4rem 0 0;"><CategoryNav active={cat.slug} /></div>
{items.length > 1 && (
<SheetFilter
rows={facetRows}
scope="this shelf"
accent={cat.accent}
groups={filterGroups}
hideTags={sharedTags}
/>
)}
{items.length > 1 && groups.length > 1 && <SectionJump items={filterGroups} label="Sections" />}
{items.length === 0 && (
<div class="slab corners" style="margin:1.5rem 0 3rem; padding:1.2rem 1.3rem;">
<p class="muted mono" style="font-size:0.85rem;">
No sheets in this domain yet. More landing soon —
<a class="accent-text" href={url('')}>back to the vault</a>.
</p>
</div>
)}
{items.length > 0 && !hasSubcats && (
<div class="index" style="margin-bottom:3rem;">
{items.map((entry, i) => (
<RecordRow
href={url(sheetHref(entry))}
n={String(i + 1).padStart(2, '0')}
title={entry.data.title}
reportGuide={isReportGuide(entry)}
kind={entry.data.difficulty}
accent={cat.accent}
meta={entry.data.updated ?? entry.id.split('/').pop()}
facets={sheetFacets(entry)}
/>
))}
</div>
)}
{items.length > 0 && hasSubcats && (
<div style="margin-bottom:3rem;">
{groups.map((g, gi) => {
const acc = g.accent;
return (
<section class="subcat" id={`sec-${g.key}`} data-sf-section={g.key}>
<div class="section-head" style="margin-bottom:0.9rem;">
<div>
<p class="eyebrow" style={`--acc: var(--${acc});`}>
<span class="eyebrow__n">{String(gi + 1).padStart(2, '0')}</span>
<span class="eyebrow__mark">^:</span>
<span data-sf-of={`sec:${g.key}`} data-total={g.items.length}>{g.items.length} {g.items.length === 1 ? 'sheet' : 'sheets'}</span>
<span class="eyebrow__rule" aria-hidden="true"></span>
</p>
<h2>{g.name}</h2>
</div>
</div>
<div class="index">
{g.items.map((entry, i) => (
<RecordRow
href={url(sheetHref(entry))}
n={String(i + 1).padStart(2, '0')}
title={entry.data.title}
reportGuide={isReportGuide(entry)}
kind={entry.data.difficulty}
accent={acc}
meta={entry.data.updated ?? entry.id.split('/').pop()}
facets={sheetFacets(entry, g.key)}
/>
))}
</div>
</section>
);
})}
</div>
)}
{downloads.length > 0 && (
<section class="download-library" id="signed-downloads" aria-labelledby="signed-downloads-title">
<div class="download-library__head">
<div>
<p class="eyebrow" style="--acc: var(--gold);">
<span class="eyebrow__n">DL</span>
<span class="eyebrow__mark">^:</span>
<span>{downloads.length} {signatures.complete ? 'signed' : 'checksummed'} files · {downloadSize}</span>
<span class="eyebrow__rule" aria-hidden="true"></span>
</p>
<h2 id="signed-downloads-title">{signatures.complete ? 'Signed attachment library' : 'Attachment library'}</h2>
{signatures.complete ? (
<p class="muted download-library__lede">
Every attachment referenced by the workflow sheets is mirrored here. Each download has an individual
SHA-256 checksum and detached OpenPGP signature; the combined manifest covers the complete set.
</p>
) : (
<p class="muted download-library__lede">
Every attachment referenced by the workflow sheets is mirrored here, each with a SHA-256 checksum, and
the combined manifest covers the complete set. These files are not OpenPGP-signed in this release: a
checksum served from the same site catches a corrupted download, not a substituted one.
</p>
)}
</div>
<div class="download-library__manifest">
<a class="btn" href={url('downloads/pentest-workflow/SHA256SUMS')} download>SHA256SUMS</a>
{signatures.manifest && (
<a class="btn btn--ghost" href={url('downloads/pentest-workflow/SHA256SUMS.asc')} download>Manifest signature</a>
)}
</div>
</div>
<div class="download-index" role="list">
{downloads.map((item, i) => (
<article class="download-row corners" role="listitem">
<span class="download-row__n">{String(i + 1).padStart(2, '0')}</span>
<div class="download-row__main">
<a class="download-row__file" href={url(item.href)} download>{item.name}</a>
<span class="download-row__hash" title={item.sha256}>{item.sha256}</span>
</div>
<span class="download-row__size">{item.sizeLabel}</span>
<div class="download-row__proof">
<a href={url(item.checksumHref)} download>SHA-256</a>
{signatures.files.has(item.name) && <a href={url(item.signatureHref)} download>GPG</a>}
</div>
</article>
))}
</div>
</section>
)}
</div>
</Base>
<style>
.subcat + .subcat { margin-top: clamp(2.2rem, 4.5vw, 3.4rem); }
.download-library {
margin: clamp(2.8rem, 6vw, 5rem) 0 4rem;
scroll-margin-top: 6rem;
}
.download-library__head {
display: grid;
gap: 1.2rem 2rem;
align-items: end;
margin-bottom: 1.2rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--rule);
}
.download-library__head h2 {
margin-top: 0.35rem;
font-family: var(--font-display);
font-size: clamp(1.7rem, 4vw, 2.7rem);
letter-spacing: -0.035em;
}
.download-library__lede { max-width: 72ch; margin-top: 0.55rem; }
.download-library__manifest { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.download-index { display: grid; gap: 0.45rem; }
.download-row {
position: relative;
display: grid;
grid-template-columns: 2.2rem minmax(0, 1fr) auto;
gap: 0.55rem 0.9rem;
align-items: center;
border: 1px solid var(--rule);
background: color-mix(in srgb, var(--surface) 76%, transparent);
padding: 0.75rem 0.85rem;
}
.download-row__n,
.download-row__size,
.download-row__hash,
.download-row__proof {
font-family: var(--font-mono);
font-size: var(--step-micro);
letter-spacing: var(--track-micro);
text-transform: uppercase;
}
.download-row__n { color: var(--gold); }
.download-row__main { min-width: 0; }
.download-row__file {
display: block;
overflow-wrap: anywhere;
color: var(--fg);
font-weight: 650;
}
.download-row__file:hover { color: var(--love); }
.download-row__hash {
display: block;
max-width: 100%;
margin-top: 0.2rem;
overflow: hidden;
color: var(--fg-faint);
text-overflow: ellipsis;
text-transform: none;
white-space: nowrap;
}
.download-row__size { color: var(--fg-muted); white-space: nowrap; }
.download-row__proof {
grid-column: 2 / -1;
display: flex;
gap: 0.75rem;
}
.download-row__proof a { color: var(--iris); }
.download-row__proof a:last-child { color: var(--foam); }
@media (min-width: 720px) {
.download-library__head { grid-template-columns: minmax(0, 1fr) auto; }
.download-library__manifest { justify-content: flex-end; }
.download-row { grid-template-columns: 2.2rem minmax(0, 1fr) 5.5rem 8rem; }
.download-row__proof { grid-column: auto; justify-content: flex-end; }
}
</style>