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
init.tsTypeScript32 lines1.3 KiBraw download
/**
 * Wires the shared daemon-sec effects into this site: the cursor with its
 * action pill and the sheet image viewer. (The contour field is mounted by
 * ContourField.astro, and the hero mounts its own plate dots.) Astro's
 * ClientRouter swaps the body on
 * navigation, so both re-bind on every `astro:page-load`.
 */
import { mountCursor } from './cursor';
import { initViewer } from './viewer';

const READ = /^\/(?:sheets|payloads|internal|hacktricks)\/[^?#]+/;
const BROWSE = /^\/(?:[a-z0-9-]+|tags\/[^/?#]+|hacktricks\/section\/[^/?#]+)\/?(?:[?#].*)?$/;
const NOT_BROWSE = /^\/(?:credits|tags)?\/?$/;

let destroyCursor: (() => void) | null = null;

export function initDmn(): void {
  initViewer();
  if (document.querySelector('.dmn-cursor')) return;
  destroyCursor?.();
  destroyCursor = mountCursor({
    linkLabel: (href, link) => {
      // The masthead and footer are navigation, not content: no pill.
      if (link.closest('.mast, .dfooter')) return null;
      if (READ.test(href)) return 'Read';
      if (BROWSE.test(href) && !NOT_BROWSE.test(href)) return 'Browse';
      return null;
    },
    /* Dark bands are `.plate`; `.plate-dawn` panels inside them are light. */
    isDark: (t) => t.closest('.plate, .plate-dawn')?.classList.contains('plate') ?? false,
  });
}