---
import Base from '../../layouts/Base.astro';
import SlantTitle from '../../components/SlantTitle.astro';
import allTechniques from '../../data/techniques.json';
import allTools from '../../data/tools.json';
import { toolSlug, routeSourceOf } from '../../lib/techniques';
import type { Technique, Tool } from '../../lib/techniques';
import { SOURCE_ROUTE, SOURCE_META, PLATFORM_META, CAPABILITY_META } from '../../lib/taxonomy';
import { highlightCommand } from '../../lib/highlight';
import { url } from '../../lib/url';
import { techArticle, breadcrumbs } from '../../lib/jsonld';
import { catalogHref, ledger } from '../../lib/insights';
import '../../styles/catalog.css';
export async function getStaticPaths() {
const tools = allTools as unknown as Tool[];
const techs = allTechniques as unknown as Technique[];
const byTool = new Map<string, Technique[]>();
for (const t of techs) {
if (!byTool.has(t.toolId)) byTool.set(t.toolId, []);
byTool.get(t.toolId)!.push(t);
}
const seen = new Set<string>();
const kept: { deck: string; tool: Tool }[] = [];
for (const tool of tools) {
const deck = SOURCE_ROUTE[routeSourceOf(tool.id)];
const route = `${deck}/${toolSlug(tool.id)}`;
if (seen.has(route)) continue; // guard against slug collisions
seen.add(route);
kept.push({ deck, tool });
}
// Neighbours in the deck's own A–Z order — the order its index page lists
// them in — so a tool page can step to the next one without going back up.
const shelves = new Map<string, Tool[]>();
for (const { deck, tool } of kept) shelves.set(deck, [...(shelves.get(deck) || []), tool]);
for (const shelf of shelves.values()) shelf.sort((a, b) => a.name.localeCompare(b.name, 'en', { sensitivity: 'base' }));
return kept.map(({ deck, tool }) => {
const shelf = shelves.get(deck)!;
const i = shelf.indexOf(tool);
const link = (t?: Tool) => (t ? { name: t.name, slug: toolSlug(t.id) } : null);
return {
params: { source: deck, tool: toolSlug(tool.id) },
props: { tool, techniques: byTool.get(tool.id) || [], prev: link(shelf[i - 1]), next: link(shelf[i + 1]), position: i + 1, shelfSize: shelf.length },
};
});
}
interface Neighbour { name: string; slug: string }
interface Props { tool: Tool; techniques: Technique[]; prev: Neighbour | null; next: Neighbour | null; position: number; shelfSize: number }
const { tool, techniques, prev, next, position, shelfSize } = Astro.props;
// Display deck comes from the toolId namespace, so a daemon-authored WADComs
// addition (wadcoms:Certipy) reads under the WADComs deck; per-technique NEW
// badges convey which rows are daemon-authored.
const src = SOURCE_META[routeSourceOf(tool.id)];
const upstream = tool.references?.find((r) => /gtfobins|lolbas|wadcoms|loobins/i.test(r)) || src.homepage;
const deck = SOURCE_ROUTE[routeSourceOf(tool.id)];
const path = `/${deck}/${toolSlug(tool.id)}`;
// The page's own tags: what its techniques need and what they do. Only worth
// drawing when there is something to choose between.
const tally = (values: string[]) => {
const m = new Map<string, number>();
for (const v of values) m.set(v, (m.get(v) || 0) + 1);
return [...m].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([value, count]) => ({ value, count }));
};
const contextOf = (t: Technique) => t.context || t.privilege || '';
const ctxTags = tally(techniques.map(contextOf).filter(Boolean));
const capTags = tally(techniques.flatMap((t) => t.capability));
const tagGroups = techniques.length > 2
? [{ kind: 'ctx', label: 'Context', tags: ctxTags }, { kind: 'cap', label: 'Capability', tags: capTags }].filter((g) => g.tags.length > 1)
: [];
const jsonLd = [
techArticle(Astro.site, path, tool, techniques, routeSourceOf(tool.id)),
breadcrumbs(Astro.site, [
{ name: 'Catalog', path: '/catalog' },
{ name: src.label, path: `/${deck}` },
{ name: tool.name, path },
]),
];
---
<Base
title={`${tool.name} — ${src.label} — DÆMONBins`}
description={`${tool.name}: ${techniques.length} living-off-the-land technique${techniques.length === 1 ? '' : 's'} from ${src.label}. Commands, MITRE ATT&CK mapping, detection and references.`}
jsonLd={jsonLd}
>
<div class="wrap tool" style="padding-top:1.5rem;" data-pagefind-body>
<span class="sr-only" data-pagefind-meta={`source:${src.label}`}></span>
<p class="tool__crumb">
<a href={url('catalog')}>Catalog</a>
<span aria-hidden="true">/</span>
<a href={url(SOURCE_ROUTE[routeSourceOf(tool.id)])}>{src.label}</a>
<span aria-hidden="true">/</span>
<span aria-current="page">{tool.name}</span>
<span class="tool__pos">{position} of {shelfSize}</span>
</p>
<SlantTitle eyebrow={`${src.tag} · ${tool.toolType || 'Tool'}`} title={tool.name} tone={src.accent}>
<Fragment slot="meta">
<span>{techniques.length} technique{techniques.length === 1 ? '' : 's'}</span>
{tool.platform?.length ? <span>{tool.platform.join(' · ')}</span> : null}
<span>{src.label}</span>
<span>GPL-3.0</span>
</Fragment>
</SlantTitle>
<div class="tool__body">
{(tool.aliases?.length || tool.fullPath?.length || tool.author || tool.contributors?.length) ? (
<aside class="tool__facts slab corners">
<p class="micro tool__facts-label">// {src.tag} · {tool.name}</p>
<dl>
{tool.aliases?.length ? (<><dt>Aliases</dt><dd>{tool.aliases.join(', ')}</dd></>) : null}
{tool.fullPath?.length ? (<><dt>Full path</dt><dd class="mono">{tool.fullPath.map((p) => <div>{p}</div>)}</dd></>) : null}
{tool.author ? (<><dt>Author</dt><dd>{tool.author}</dd></>) : null}
{tool.created ? (<><dt>Created</dt><dd>{tool.created}</dd></>) : null}
{tool.contributors?.length ? (<><dt>Credits</dt><dd>{tool.contributors.join(', ')}</dd></>) : null}
<dt>Upstream</dt>
<dd><a href={upstream} target="_blank" rel="noopener">{upstream.replace(/^https?:\/\//, '')}</a></dd>
</dl>
</aside>
) : null}
{tagGroups.length ? (
<div class="tool__filter" data-tool-filter style={`--acc: var(--${src.accent});`}>
{tagGroups.map((g) => (
<div class="tool__filter-row">
<span class="tool__filter-lbl">{g.label}</span>
<ul class="tags">
{g.tags.map((tag) => (
<li><button class="tag" type="button" aria-pressed="false" data-kind={g.kind} data-value={tag.value}>{tag.value}<span class="tag__n">{ledger(tag.count)}</span></button></li>
))}
</ul>
</div>
))}
<p class="tool__filter-status"><span data-tool-shown role="status">{techniques.length} techniques</span><button class="finder__clear" data-tool-clear type="button" hidden>Show all</button></p>
</div>
) : null}
<div class="tool__techs">
{techniques.map((t) => (
<article class="tech" id={t.id} data-ctx={contextOf(t)} data-cap={t.capability.join('|')}>
<header class="tech__head">
<div class="tech__title">
<h2 class="tech__name">{t.name && t.name !== t.toolName ? t.name : t.capability[0]}</h2>
{t.added ? <span class="tbadge tbadge--new" style="--acc: var(--love);">DÆMON</span> : null}
</div>
<div class="tech__badges">
{t.capability.map((c) => (
<span class="tbadge" style={`--acc: var(--${CAPABILITY_META[c]?.accent || 'foam'});`}>{c}</span>
))}
{t.platform.map((p) => (
<span class="tbadge tbadge--soft" style={`--acc: var(--${PLATFORM_META[p]?.accent || 'foam'});`}>{p}</span>
))}
</div>
</header>
{t.description ? <p class="tech__desc">{t.description}</p> : null}
{t.usecase ? <p class="tech__use"><span>Use</span> {t.usecase}</p> : null}
<div class="tech__cmdbar" data-cmdbar>
<pre class="cmd"><code set:html={highlightCommand(t.command)} /></pre>
<button class="trow__copy" type="button" data-copy aria-label="Copy command">copy</button>
</div>
<dl class="tech__meta">
{t.verification ? (<div><dt>Evidence</dt><dd>{t.verification}{t.reviewedAt ? ` · reviewed ${t.reviewedAt}` : ''}</dd></div>) : null}
{t.environment?.length ? (<div><dt>Environment</dt><dd>{t.environment.join(', ')}</dd></div>) : null}
{t.compatibility ? (<div><dt>Compatibility</dt><dd>{t.compatibility}</dd></div>) : null}
{t.expected ? (<div><dt>Expected result</dt><dd>{t.expected}</dd></div>) : null}
{t.troubleshooting ? (<div><dt>Troubleshooting</dt><dd>{t.troubleshooting}</dd></div>) : null}
{t.sideEffects ? (<div><dt>Side effects</dt><dd>{t.sideEffects}</dd></div>) : null}
{t.restore ? (<div><dt>Restore</dt><dd>{t.restore}</dd></div>) : null}
{t.template ? (<div><dt>Template</dt><dd><a href={url(`catalog?id=${encodeURIComponent(t.id)}`)}>Configure this command in the catalog</a></dd></div>) : null}
{t.privilege ? (<div><dt>Context</dt><dd>{t.privilege}</dd></div>) : null}
{t.nativeCategory?.length ? (<div><dt>Native</dt><dd>{t.nativeCategory.join(', ')}</dd></div>) : null}
{t.mitre?.length ? (<div><dt>MITRE</dt><dd>{t.mitre.map((m) => <a class="tchip-link" href={`https://attack.mitre.org/techniques/${m.replace('.', '/')}/`} target="_blank" rel="noopener">{m}</a>)}</dd></div>) : null}
{t.requires?.length ? (<div><dt>Requires</dt><dd>{t.requires.join(', ')}</dd></div>) : null}
{t.services?.length ? (<div><dt>Services</dt><dd>{t.services.join(', ')}</dd></div>) : null}
{t.detection?.length ? (<div><dt>Detection</dt><dd>{t.detection.map((d) => <div>{d.type}: {/^https?:/.test(d.value) ? <a href={d.value} target="_blank" rel="noopener">{d.value.replace(/^https?:\/\//, '')}</a> : d.value}</div>)}</dd></div>) : null}
{t.verifyNote ? (<div><dt>Verified</dt><dd class="tech__note">✓ {t.verifyNote}</dd></div>) : null}
{t.references?.length ? (<div><dt>Refs</dt><dd>{t.references.map((r) => <div><a href={r} target="_blank" rel="noopener">{r.replace(/^https?:\/\//, '')}</a></div>)}</dd></div>) : null}
</dl>
</article>
))}
</div>
<nav class="tool__onward" aria-label={`More from ${src.label}`}>
<a href={catalogHref({ query: tool.name })}>Find {tool.name} across the catalog →</a>
<a href={url(deck)}>All {shelfSize} {src.label} tools →</a>
</nav>
{(prev || next) ? (
<nav class="prevnext" aria-label={`Neighbouring ${src.label} tools`}>
{prev ? <a href={url(`${deck}/${prev.slug}`)} rel="prev"><span class="dir">← Previous</span><strong>{prev.name}</strong></a> : <span class="prevnext__gap" aria-hidden="true"></span>}
{next ? <a class="nx" href={url(`${deck}/${next.slug}`)} rel="next"><span class="dir">Next →</span><strong>{next.name}</strong></a> : <span class="prevnext__gap" aria-hidden="true"></span>}
</nav>
) : null}
</div>
</div>
<script>import '../../scripts/copy.ts'; import '../../scripts/tool.ts';</script>
</Base>
<style>
.tool__crumb { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); margin: 0 0 0.5rem; }
.tool__crumb a { color: var(--fg-dim); text-decoration: none; }
.tool__crumb a:hover { color: var(--accent); }
.tool__crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.tool__crumb [aria-current] { color: var(--fg); }
.tool__pos { margin-left: auto; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
/* Stays under the masthead: on a tool with dozens of techniques the tags are
the page's table of contents. */
.tool__filter { position: sticky; top: 63px; z-index: 20; display: grid; gap: 0.6rem; padding: 0.8rem 0; background: var(--bg); border-bottom: 1px solid var(--rule); }
.tool__filter-row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); align-items: baseline; gap: 0.8rem; }
.tool__filter-lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg-faint); }
.tool__filter .tag { padding: 0.35rem 0.6rem; font-size: 11px; letter-spacing: 0.1em; }
.tool__filter-status { display: flex; align-items: center; gap: 0.8rem; margin: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--acc); }
@media (max-width: 640px) {
.tool__filter { position: static; }
.tool__filter-row { grid-template-columns: 1fr; gap: 0.4rem; }
}
.tech[hidden] { display: none; }
.tool__onward { display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; }
.tool__onward a { color: var(--accent); text-decoration: none; }
.tool__onward a:hover { text-decoration: underline; text-underline-offset: 3px; }
.tool__body .prevnext { margin-top: 0; }
.prevnext__gap { background: var(--base); }
@media (max-width: 619px) { .prevnext__gap { display: none; } }
.tool__body { margin-top: 2.5rem; display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.tool__facts { padding: 1.1rem 1.3rem; }
.tool__facts-label { color: var(--fg-faint); margin: 0 0 0.6rem; }
.tool__facts dl { display: grid; grid-template-columns: 120px 1fr; gap: 0.35rem 1rem; margin: 0; font-size: 13px; }
.tool__facts dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); }
.tool__facts dd { margin: 0; color: var(--fg-dim); }
.tool__facts dd.mono { font-family: var(--font-mono); font-size: 12px; }
.tool__facts a { color: var(--accent); text-decoration: none; }
.tool__techs { display: flex; flex-direction: column; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.tech { background: var(--bg); padding: 1.1rem 1.2rem; scroll-margin-top: 5.5rem; }
.tool__filter ~ .tool__techs .tech { scroll-margin-top: 12rem; }
/* The catalog's "full details" link lands here by #id — mark the row it meant. */
.tech:target { box-shadow: inset 3px 0 0 var(--accent); }
.tech__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.7rem; }
.tech__title { display: flex; align-items: center; gap: 0.5rem; }
/* An h2 so the techniques form a real outline under the tool's h1; styled as the label it always was. */
.tech__name { margin: 0; font-family: var(--font-archivo); font-weight: 700; font-size: 16px; line-height: 1.3; letter-spacing: -0.01em; text-transform: none; color: var(--fg); }
.tech__badges { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tech__desc { margin: 0 0 0.7rem; font-size: 14px; line-height: 1.6; color: var(--fg-dim); max-width: 74ch; white-space: pre-wrap; }
.tech__use { margin: 0 0 0.7rem; font-size: 13px; color: var(--fg-dim); }
.tech__use span { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); }
.tech__cmdbar { position: relative; display: flex; align-items: stretch; margin: 0 0 0.8rem; }
.cmd { flex: 1; min-width: 0; margin: 0; padding: 0.6rem 0.8rem; background: var(--color-night-base, #191724); border: 1px solid color-mix(in srgb, #000 20%, var(--color-night-base, #191724)); overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }
.cmd code { white-space: pre; color: var(--color-night-text, #e0def4); }
.tech__meta { display: grid; gap: 0.35rem 1.5rem; margin: 0; }
.tech__meta > div { display: grid; grid-template-columns: 90px 1fr; gap: 0.8rem; font-size: 12.5px; line-height: 1.55; }
.tech__meta dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-faint); }
.tech__meta dd { margin: 0; color: var(--fg-dim); word-break: break-word; }
.tech__meta a { color: var(--accent); text-decoration: none; }
.tech__meta a:hover { text-decoration: underline; text-underline-offset: 2px; }
.tech__note { color: var(--foam); font-family: var(--font-mono); font-size: 11.5px; }
</style>