repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
2026-06-07-engagement-db.mdMarkdown44 lines2.9 KiBsource raw download

Engagement DB Tracker — Implementation Plan (Plan 2)#

For agentic workers: executed inline (ultracode). TDD where it pays: real DB-cycle tests.

Goal: SQLite-backed engagement tracker (htb-newbox/creds/flags/findings/note/database) at ~/.pentest/engagements.db, lazy-initialized, SQL-injection-safe, with backup/restore/export and an active-target file the prompt + tmux read.

Architecture: config/database.zsh defines functions only (no DB I/O at shell startup — perf). First command calls _pdb_init which creates ~/.pentest (0700), runs scripts/db-init.sql, chmods the db 0600. Active target persisted to ~/.pentest/.active (name|ip) + exported $PENTEST_TARGET/$PENTEST_TARGET_IP. All string inputs escaped (' → '').

Tech Stack: zsh, sqlite3, tar.


File structure#

.zshrc already sources config/database.zsh if present (Plan 1 orchestrator).

Env contract (testability)#

Commands#

Schema (scripts/db-init.sql)#

targets / credentials / flags(user|root) / findings / notes — FKs ON DELETE CASCADE, PRAGMA foreign_keys=ON per connection. (full DDL in the file)

Tests (lifecycle, temp DIR)#

newbox×2 → list shows 2 → select → creds add×2 + list count 2 → flags add user+root → findings add → note add → export writes md containing creds → backup writes tar.gz → delete (piped DELETE) empties targets but backup exists → injection test: name with ' doesn't corrupt/inject.

Security#

db 0600, dir 0700, gitignored, escape all inputs, warn on first cred, auto-backup before delete.