repositories

daemon-sec-lotl

DÆMONBins: GTFOBins × LOLBAS × WADComs × LOOBins in one filterable catalog

clonegit clone https://git.daemon-sec.xyz/daemon-sec-lotl.git
deck.tsTypeScript22 lines1.0 KiBraw download
// Shared by a collection page (build time) and its filter script (browser).

/** One character per facet value in a technique signature. */
export const DECK_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_';

/** The index letter a tool files under: a–z, or `#` for digits and symbols. */
export function deckLetter(name: string): string {
  const c = name.trim().charAt(0).toLowerCase();
  return c >= 'a' && c <= 'z' ? c : '#';
}

/**
 * Does a tool survive the pressed filters? `sigs` is one signature per
 * technique; `groups` is one string of acceptable characters per facet with
 * something pressed. The catalog's rule, held per technique: any pressed value
 * within a facet, every facet at once — so "sudo" + "File Read" keeps a tool
 * only if one of its techniques is both, not if two different ones are.
 */
export function sigMatches(sigs: string[], groups: string[]): boolean {
  if (!groups.length) return true;
  return sigs.some((sig) => groups.every((g) => [...g].some((ch) => sig.includes(ch))));
}