daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR
git clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
Log | Files | Refs | README | LICENSE

[...slug].astro (4757B)


      1 ---
      2 import FuzzField from '../../components/FuzzField.astro';
      3 import { render } from 'astro:content';
      4 import Base from '../../layouts/Base.astro';
      5 import Icon from '../../components/Icon.astro';
      6 import { internalBySection, internalRootPages, sectionOrder, prevNext, internalHref, type Internal } from '../../lib/internal';
      7 import { url } from '../../lib/url';
      8 
      9 export async function getStaticPaths() {
     10   const groups = await internalBySection();
     11   const paths: any[] = [];
     12   for (const g of groups) {
     13     const order = sectionOrder(g);
     14     for (const entry of order) {
     15       const { prev, next } = prevNext(order, entry);
     16       const slug = internalHref(entry).replace(/^internal\//, '');
     17       paths.push({ params: { slug }, props: { entry, prev, next, sectionSlug: g.slug, sectionTitle: g.title } });
     18     }
     19   }
     20   // Root pages stand alone: no section to page through.
     21   for (const entry of await internalRootPages()) {
     22     const slug = internalHref(entry).replace(/^internal\//, '');
     23     paths.push({ params: { slug }, props: { entry, sectionSlug: entry.data.sectionSlug, sectionTitle: entry.data.section } });
     24   }
     25   return paths;
     26 }
     27 
     28 interface Props { entry: Internal; prev?: Internal; next?: Internal; sectionSlug: string; sectionTitle: string }
     29 const { entry, prev, next, sectionTitle } = Astro.props;
     30 const d = entry.data;
     31 const { Content, headings } = await render(entry);
     32 const toc = headings.filter((h) => h.depth === 2 || h.depth === 3);
     33 const leaf = entry.id.split('/').pop()!.replace(/^index$/, d.sectionSlug);
     34 ---
     35 <Base title={`${d.title} — Internal — DÆMON//SEC`} description={`${d.section} — internal network tradecraft, mirrored from InternalAllTheThings.`}>
     36   <div class="wrap">
     37     <nav class="breadcrumb" style="margin-top:1.5rem;">
     38       <a href={url('')}>~</a><span class="sep">/</span>
     39       <a href={url('internal')} style="color: var(--pine)">internal</a><span class="sep">/</span>
     40       {d.isIndex
     41         ? <span class="muted">{d.sectionSlug}</span>
     42         : <><a href={url(`internal/${d.sectionSlug}`)} style="color: var(--pine)">{d.sectionSlug}</a><span class="sep">/</span><span class="muted">{leaf}</span></>}
     43     </nav>
     44 
     45     <header class="sheet-head plate signal-hero" data-pagefind-meta="category:Internal">
     46       <FuzzField />
     47       <span class="grain grain--local" aria-hidden="true"></span>
     48       <span class="scanlines" aria-hidden="true"></span>
     49       <p class="eyebrow" style="color: var(--pine)">// Internal · {sectionTitle}</p>
     50       <h1 class="sheet-title" data-pagefind-meta="title">{d.title}</h1>
     51     </header>
     52 
     53     <aside class="patt-credit" aria-label="Attribution">
     54       <span class="patt-badge">mirror</span>
     55       <span class="patt-credit__text">
     56         Mirrored from <a href="https://github.com/swisskyrepo/InternalAllTheThings" target="_blank" rel="noopener">InternalAllTheThings</a>
     57         <span class="muted">›</span> {d.section}
     58         <span class="patt-lic">credit: swisskyrepo · <a href={url('credits')}>credits</a> · <code>{d.sha.slice(0, 7)}</code></span>
     59       </span>
     60       <a class="patt-src" href={d.sourceUrl} target="_blank" rel="noopener" aria-label="View source on GitHub">
     61         <Icon name="github" /> source
     62       </a>
     63     </aside>
     64 
     65     <div class="sheet-layout">
     66       <article class="prose" data-pagefind-body>
     67         <Content />
     68       </article>
     69 
     70       {toc.length > 1 && (
     71         <aside class="toc plate-dawn corners" aria-label="On this page">
     72           <h4>On this page</h4>
     73           <nav>
     74             {toc.map((h) => (
     75               <a href={`#${h.slug}`} class={h.depth === 3 ? 'lvl-3' : ''}>{h.text}</a>
     76             ))}
     77           </nav>
     78         </aside>
     79       )}
     80     </div>
     81 
     82     <nav class="prevnext" aria-label="Pagination">
     83       {prev ? (
     84         <a href={url(internalHref(prev))} style="--acc: var(--pine)">
     85           <span class="dir">← Prev</span><strong>{prev.data.title}</strong>
     86         </a>
     87       ) : <span></span>}
     88       {next ? (
     89         <a class="nx" href={url(internalHref(next))} style="--acc: var(--pine)">
     90           <span class="dir">Next →</span><strong>{next.data.title}</strong>
     91         </a>
     92       ) : <span></span>}
     93     </nav>
     94   </div>
     95 </Base>
     96 
     97 <style>
     98   /* Attribution is keyed to iris in global.css; this mirror runs on pine. */
     99   .patt-credit { border-left-color: var(--pine); }
    100   .patt-badge { color: var(--pine); border-color: color-mix(in oklab, var(--pine) 50%, transparent); }
    101   .patt-credit__text a { color: var(--pine); border-bottom-color: color-mix(in oklab, var(--pine) 40%, transparent); }
    102   .patt-credit__text a:hover { border-bottom-color: var(--pine); }
    103   .patt-src:hover { color: var(--pine); border-color: color-mix(in oklab, var(--pine) 50%, transparent); }
    104   .patt-src svg { width: 15px; height: 15px; }
    105 </style>