repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
2026-06-07-modular-zsh-pentest-rebuild-design.mdMarkdown250 lines12.0 KiBsource raw download

Modular ZSH / tmux / Pentest Environment Rebuild — Design Spec#

Date: 2026-06-07 Status: Approved (design), pending spec review Repo: ~/.dotfiles

1. Goal#

Rebuild the user's mature-but-slow zsh environment into a clean, modular, fast, cross-platform dotfiles project with a new SQLite-backed engagement tracker, non-blocking animated fetch, an upgraded tmux config, setup/bootstrap scripts, and comprehensive docs. Preserve the Chi-Rho "Neon Glow" rice aesthetic.

2. Locked decisions#

Decision Choice
Treatment of existing config Full modular rebuild (not augment)
Migration fidelity Curated rebuild — keep what's used, drop dead/dupes, show cut list first
Shell framework Drop oh-my-zsh → lightweight loader
Plugin loader Dependency-free manual loader (clone + source), cached single compinit
Animated fetch Custom ANSI frame-loop, non-blocking — integrate existing crossfetch
Credential storage Plaintext SQLite + 600 perms + warnings + gitignore
Platform macOS + Linux parity (brew/apt detect, mac vs kali/pwnbox paths)
Emojis None. Nerd-font glyphs only (per user memory)
Pride/seasonal code None anywhere (hyfetch not used)

3. Current-state findings (audit basis)#

Performance bugs identified#

  1. Double compinit — once in oh-my-zsh.sh, once in the Docker block (autoload -Uz compinit; compinit).
  2. 24 OMZ plugins loaded eagerly every shell.
  3. Eager fastfetch + optional crossfetch splash blocks the prompt.
  4. ZSH_THEME="" dead leftover.

4. Repo & file layout#

~/.dotfiles/
  .zshrc                  thin orchestrator: env guard → source config/*.zsh in order
  .tmux.conf
  config/
    core.zsh              env, PATH, perf, loader, compinit, completions, history
    theme.zsh            starship init + transience + active-target segment
    pentesting.zsh       curated toolkit (lazy), + pentest-mac (Docker-Kali)
    database.zsh         SQLite engagement tracker (htb-newbox/creds/flags/...)
    aliases.zsh          eza l* family, nav, encode, http, msf, cleanup
    functions.zsh        h* forensic/file, git helpers, cheat, OMZ-builtin reimpls
    animations.zsh       crossfetch integration + fastfetch static, verse, git-welcome
    plugins/             cloned zsh plugins (gitignored or submodule)
  scripts/
    setup.sh             OS detect, deps, backup, symlink, db-init, perms, self-test
    update.sh            pull repo, update plugins, re-link, re-test
    db-init.sql          schema
    db-backup.sh         cron-able tar.gz backup
  docs/
    CHEATSHEET.md  PENTESTING.md  DATABASE.md  TMUX.md
    superpowers/specs/   this spec
  README.md
  .gitignore             ignores ~/.pentest data, plugins/, local secrets

setup.sh backs up existing ~/.zshrc, ~/.tmux.conf, ~/.pentest.zsh, ~/.pentest-mac.zsh to ~/.dotfiles-backup-<timestamp>/, then symlinks ~/.dotfiles/.zshrc → ~/.zshrc and ~/.dotfiles/.tmux.conf → ~/.tmux.conf.

Load order (in .zshrc)#

  1. Interactive guard + instant-prompt-safe env
  2. core.zsh (PATH/env/history/compinit/loader/plugins)
  3. aliases.zsh, functions.zsh
  4. theme.zsh (starship)
  5. database.zsh (defines functions only; no DB I/O at startup)
  6. pentesting.zsh lazy wrapper (load on first htb/pentest/htb-*)
  7. animations.zsh splash (non-blocking, last, interactive-only)

5. core.zsh — performance#

6. theme.zsh — prompt + engagement context#

7. database.zsh + db-init.sql — engagement tracker (net-new core)#

DB: ~/.pentest/engagements.db, dir 0700, file 0600, gitignored. First-run banner warns: plaintext lab loot, not for real-world sensitive data.

Schema#

CREATE TABLE IF NOT EXISTS targets (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL UNIQUE,
  ip TEXT,
  os TEXT,
  status TEXT DEFAULT 'active',
  created_at TEXT DEFAULT (datetime('now')),
  notes TEXT
);
CREATE TABLE IF NOT EXISTS credentials (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  target_id INTEGER REFERENCES targets(id) ON DELETE CASCADE,
  username TEXT, password TEXT, service TEXT DEFAULT 'unknown',
  found_at TEXT DEFAULT (datetime('now')), notes TEXT
);
CREATE TABLE IF NOT EXISTS flags (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  target_id INTEGER REFERENCES targets(id) ON DELETE CASCADE,
  flag_type TEXT CHECK(flag_type IN ('user','root')),
  flag_value TEXT, found_at TEXT DEFAULT (datetime('now'))
);
CREATE TABLE IF NOT EXISTS findings (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  target_id INTEGER REFERENCES targets(id) ON DELETE CASCADE,
  title TEXT, severity TEXT, description TEXT, evidence TEXT,
  found_at TEXT DEFAULT (datetime('now'))
);
CREATE TABLE IF NOT EXISTS notes (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  target_id INTEGER REFERENCES targets(id) ON DELETE CASCADE,
  body TEXT, created_at TEXT DEFAULT (datetime('now'))
);

PRAGMA foreign_keys = ON; on every connection.

Command reference (replaces old file-based creds/flag/note)#

8. animations.zsh — non-blocking splash#

9. pentesting.zsh — curated toolkit#

Curated port of .pentest.zsh + .pentest-mac.zsh, lazy-loaded (preserve _load_pentest + merged command_not_found_handler). Groups: target mgmt, scanning (nmap/rustscan + rs* family), web enum, AD/Windows (impacket/nxc/ certipy/bloodhound), cracking (hashcat/hydra/john), listeners/shells/revshell, C2 (sliver/havoc), pivoting (chisel/ligolo/socks), HTB box/lab/Docker mgmt, OSINT. Remove file-based note/flag/flag-count/flags/creds/creds-show (→ DB). Optional: collapse the ~80 rs* wrappers into one rs <profile> dispatcher (kept as backward-compat aliases) — flagged for user decision in the plan.

10. .tmux.conf — enhancements over existing 149 lines#

tpm + tmux-resurrect + tmux-continuum. Neon Glow status bar with live target context (reads ~/.pentest/.active). Pentest 4-pane layout bind (recon | exploit / notes | shells). tmux-htb <box> session template. Mouse on, vi copy-mode, sane pane nav, reload bind. Keep user's existing working binds.

11. scripts#

12. docs#

13. Security model#

Plaintext SQLite (lab loot). ~/.pentest 700, db 600, gitignored. Warning banner on first creds add. Auto-backup before database delete/restore. No secrets in repo. Quote/escape all SQL string inputs.

14. Keep / Cut audit#

CUT (certain)#

KEEP & remap#

DECIDE during plan#

15. Testing / verification#

16. Out of scope (YAGNI)#