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
SheetCredit.astroAstro101 lines4.4 KiBraw download
---
/**
 * Attribution banner for a cheatsheet that carries third-party content.
 *
 * Renders nothing unless the sheet declares an upstream, so it can sit
 * unconditionally in the sheet template. The wording is driven by the licence
 * rather than being one generic line: a permissive licence needs its copyright
 * notice reproduced, whereas an unlicensed upstream grants no rights at all and
 * must be described as a reference to somewhere else, never as a mirror.
 */
import Icon from './Icon.astro';
import { url } from '../lib/url';

interface Props {
  name?: string;
  upstreamUrl?: string;
  author?: string;
  license?: string;
  relation?: string;
  copyright?: string;
}
const { name, upstreamUrl, author, license, relation, copyright } = Astro.props;

const BADGE: Record<string, string> = {
  verbatim: 'mirror',
  derived: 'derived',
  inspired: 'inspired',
  'link-only': 'link',
};

const LEAD: Record<string, string> = {
  verbatim: 'Reproduced from',
  derived: 'Derived from',
  inspired: 'Based on',
  'link-only': 'Summary of',
};

const badge = BADGE[relation ?? ''] ?? 'credit';
const lead = LEAD[relation ?? ''] ?? 'Content from';
// An unlicensed upstream is the one case where the licence slot must not read
// like a grant; say plainly that there isn't one.
const licenceLabel =
  license === 'none' ? 'no licence published' : license === 'proprietary' ? 'proprietary — all rights reserved' : license;
---
{upstreamUrl && (
  <aside class="patt-credit corners" aria-label="Attribution">
    <span class="patt-badge">{badge}</span>
    <span class="patt-credit__text">
      {lead} <a href={upstreamUrl} target="_blank" rel="noopener">{name ?? upstreamUrl}</a>
      {author && <> by <strong>{author}</strong></>}
      <span class="patt-lic">
        {licenceLabel}{copyright && <> · {copyright}</>} · <a href={url('credits')}>credits</a>
      </span>
    </span>
    <a class="patt-src" href={upstreamUrl} target="_blank" rel="noopener" aria-label="View the original">
      <Icon name="github" style="width:15px;height:15px;" /> source
    </a>
  </aside>
)}

<style>
  /* ---- Credit panel as a terminal plate ----------------------------------
     The same object the prose callouts are (prose.css): a square plate with
     corner brackets, a left accent bar, and DM Mono provenance
     micro-labels. Cross-theme in the same direction, too — on the cream
     page the palette is pinned to night so the panel reads as a terminal;
     on the night page it flips to a dawn (cream) plate, paper floating on
     the dark. The pin is written out (as the callout's is) rather than
     taken from `.plate`/`.plate-dawn`, so the flip stays one rule. */
  .patt-credit {
    --base: var(--color-night-base); --surface: var(--color-night-surface); --overlay: var(--color-night-overlay);
    --text: var(--color-night-text); --subtle: var(--color-night-subtle); --muted: var(--color-night-muted);
    --love: var(--color-night-love); --gold: var(--color-night-gold); --rose: var(--color-night-rose);
    --pine: var(--color-night-foam); --foam: var(--color-night-foam); --iris: var(--color-night-iris);
    --rule: var(--color-night-rule);
    --fg: var(--text); --fg-dim: var(--subtle); --fg-faint: var(--muted);
    --accent: var(--iris);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-left: 2px solid var(--accent);
    padding: 0.85rem 1.05rem;
  }
  /* Night page: flip the same object to a dawn (cream) plate. */
  :global(:root[data-theme='dark']) .patt-credit {
    --base: var(--color-dawn-base); --surface: var(--color-dawn-surface); --overlay: var(--color-dawn-overlay);
    --text: var(--color-dawn-ink); --subtle: var(--color-dawn-subtle); --muted: var(--color-dawn-muted);
    --love: var(--color-dawn-love-soft); --gold: var(--color-dawn-gold-soft); --rose: var(--color-dawn-rose-soft);
    --pine: var(--color-dawn-pine-soft); --foam: var(--color-dawn-foam-soft); --iris: var(--color-dawn-iris-soft);
    --rule: var(--color-dawn-rule);
    --accent: var(--iris);
  }
  /* Provenance metadata is terminal furniture: badge, licence line and the
     source link all set in DM Mono at micro-label size. */
  .patt-badge,
  .patt-lic,
  .patt-src {
    font-family: var(--font-term);
  }
  .patt-badge { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 50%, transparent); }
  .patt-src:hover { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 50%, transparent); }
</style>