repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
vault-pdf.zshShell38 lines1.6 KiBraw download
# DAEMONSEC-VAULT PDF library. All discovery and previews stay on this machine.
vault-pdf() { python3 "${DOTFILES:-$HOME/.dotfiles}/scripts/vault-pdf.py" "$@"; }
pdfs() { vault-pdf menu "$@"; }
alias pdf-fzf='pdfs'
pdf-list() { vault-pdf list "$@"; }

typeset -ga _VAULT_PDF_ALIASES
pdf-refresh() {
  local name output
  # Capture first so a missing vault leaves existing shortcuts intact.
  output=$(vault-pdf aliases) || return
  for name in "${_VAULT_PDF_ALIASES[@]}"; do
    [[ ${aliases[$name]-} == "vault-pdf open $name" ]] && unalias -- "$name"
  done
  _VAULT_PDF_ALIASES=()
  for name in "${(@f)output}"; do
    [[ -n $name ]] || continue
    # The helper emits safe identifiers only; never eval filenames or titles.
    [[ $name == pdf-* && $name != *[^a-z0-9-]* ]] || continue
    (( ${+aliases[$name]} || ${+functions[$name]} || ${+commands[$name]} )) && continue
    alias -- "$name=vault-pdf open $name"
    _VAULT_PDF_ALIASES+=("$name")
  done
}

# New PDFs get shortcuts on the next shell start, or immediately via pdf-refresh.
# Match the helper's override precedence and default folder fallback.
_vault_pdf_root=${DAEMONSEC_VAULT:-${NETRUNNER_VAULT:-$HOME/git/DAEMONSEC-VAULT}}
if [[ -z ${DAEMONSEC_VAULT:-}${NETRUNNER_VAULT:-} && ! -d $_vault_pdf_root && -d $HOME/git/NetrunnerVault ]]; then
  _vault_pdf_root=$HOME/git/NetrunnerVault
fi
if [[ ${~_vault_pdf_root} == $HOME/git/NetrunnerVault && ! -d ${~_vault_pdf_root} && -d $HOME/git/DAEMONSEC-VAULT ]]; then
  _vault_pdf_root=$HOME/git/DAEMONSEC-VAULT
fi
if (( $+commands[python3] )) && [[ -d ${~_vault_pdf_root} ]]; then
  pdf-refresh
fi
unset _vault_pdf_root