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 (3040B)


      1 ---
      2 import FuzzField from '../../components/FuzzField.astro';
      3 import { render } from 'astro:content';
      4 import Base from '../../layouts/Base.astro';
      5 import HackTricksCredit from '../../components/HackTricksCredit.astro';
      6 import { hackTricksBySection, hackTricksHref, prevNext, type HackTricksPage } from '../../lib/hacktricks';
      7 import { url } from '../../lib/url';
      8 
      9 export async function getStaticPaths() {
     10   const paths: any[] = [];
     11   for (const section of await hackTricksBySection()) {
     12     for (const entry of section.items) {
     13       const { prev, next } = prevNext(section.items, entry);
     14       paths.push({
     15         params: { slug: hackTricksHref(entry).replace(/^hacktricks\//, '') },
     16         props: { entry, prev, next, sectionTitle: section.title },
     17       });
     18     }
     19   }
     20   return paths;
     21 }
     22 
     23 interface Props { entry: HackTricksPage; prev?: HackTricksPage; next?: HackTricksPage; sectionTitle: string }
     24 const { entry, prev, next, sectionTitle } = Astro.props;
     25 const { Content, headings } = await render(entry);
     26 const toc = headings.filter((heading) => heading.depth === 2 || heading.depth === 3);
     27 ---
     28 <Base title={`${entry.data.title} — HackTricks — DÆMON//SEC`} description={`${sectionTitle} reference adapted from HackTricks under CC BY-NC 4.0.`}>
     29   <div class="wrap">
     30     <nav class="breadcrumb" style="margin-top:1.5rem;">
     31       <a href={url('')}>~</a><span class="sep">/</span>
     32       <a href={url('hacktricks')} style="color:var(--gold)">hacktricks</a><span class="sep">/</span>
     33       <a href={url(`hacktricks/section/${entry.data.sectionSlug}`)} style="color:var(--gold)">{entry.data.sectionSlug}</a>
     34     </nav>
     35 
     36     <header class="sheet-head plate signal-hero" data-pagefind-meta="category:HackTricks">
     37       <FuzzField />
     38       <span class="grain grain--local" aria-hidden="true"></span>
     39       <span class="scanlines" aria-hidden="true"></span>
     40       <p class="eyebrow" style="color:var(--gold)">// HackTricks · {sectionTitle}</p>
     41       <h1 class="sheet-title" data-pagefind-meta="title">{entry.data.title}</h1>
     42     </header>
     43 
     44     <HackTricksCredit section={sectionTitle} sourceUrl={entry.data.sourceUrl} sha={entry.data.sha} />
     45 
     46     <div class="sheet-layout">
     47       <article class="prose" data-pagefind-body>
     48         <Content />
     49       </article>
     50       {toc.length > 1 && (
     51         <aside class="toc plate-dawn corners" aria-label="On this page">
     52           <h4>On this page</h4>
     53           <nav>
     54             {toc.map((heading) => (
     55               <a href={`#${heading.slug}`} class={heading.depth === 3 ? 'lvl-3' : ''}>{heading.text}</a>
     56             ))}
     57           </nav>
     58         </aside>
     59       )}
     60     </div>
     61 
     62     <nav class="prevnext" aria-label="Pagination">
     63       {prev ? <a href={url(hackTricksHref(prev))} style="--acc:var(--gold)"><span class="dir">← Prev</span><strong>{prev.data.title}</strong></a> : <span></span>}
     64       {next ? <a class="nx" href={url(hackTricksHref(next))} style="--acc:var(--gold)"><span class="dir">Next →</span><strong>{next.data.title}</strong></a> : <span></span>}
     65     </nav>
     66   </div>
     67 </Base>