repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
htb.mdMarkdown123 lines5.7 KiBsource raw download

htb — one box, one target, every session recorded#

Three commands, one job each: htbbox owns the box and the target (name, IP, OS, difficulty → box.json), htbcast records terminal sessions into that box, htbvpn/htbup carries the tunnel. The old htbtarget and the dotfiles' sqlite htb-newbox/htb-list/htb-select/creds/flags/note are gone; htbbox does all of it. Terminal card: htb-cheat — sections start box target record files env flow fix.

start — from nothing to a box#

htbup                                   # VPN up (htbvpn list / htbvpn up <profile> for a specific one)
htbbox new                              # prompts: name, ip, os, difficulty
htbbox new Sauna 10.10.10.175 windows easy            # or all at once, ANY order
htbbox new Sauna 10.10.10.175 win easy sauna.htb dc01.sauna.htb   # + hostnames -> /etc/hosts
htbbox new -n Sauna -i 10.10.10.175 -o windows -d easy -H dc01.sauna.htb   # flags, if you prefer
cd $BOXDIR                              # ~/htb/sauna
os          windows linux freebsd openbsd android other   (win, lin, bsd ok)
difficulty  easy medium hard insane

Re-running new on an existing box updates only what you pass — creds, flags, notes and writeup.md are kept.

box — look around, record what you find#

htbbox ls                               # every box, newest first (* = current)
htbbox use sauna                        # switch: $BOX, $BOXDIR, $TARGET, /etc/hosts all follow
htbbox info                             # the card: target, flags, creds, ports, notes
htbbox path                             # the directory
htbbox json ip                          # one field from box.json (dotted: flags.user)

htbbox set ip 10.10.10.176              # box reset gave a new IP (re-points $TARGET)
htbbox set os linux | difficulty hard | status paused | domain sauna.htb
htbbox host dc01.sauna.htb              # add hostnames (Kerberos needs them)
htbbox cred fsmith 'Thestrokes23' kerberoast    # add a credential   (htbbox cred = list)
htbbox flag user 3f4e...                # status -> user; `flag root ...` -> root
htbbox note "WinRM open, fsmith in Remote Mgmt" # timestamped   (htbbox note = list)
htbscan                                 # nmap into $BOXDIR/recon, ports imported automatically
htbbox ports                            # or import the newest recon/*.xml yourself

Any command takes -b <box> to act on a box that is not the current one.

target — show it, clear it#

htbbox target                           # target 10.10.10.175  (dc01.sauna.htb)  box sauna
htbbox clear                            # forget the target EVERYWHERE

htbbox clear unsets $TARGET $RHOST $IP $BOX $BOXDIR in every terminal (at its next prompt), removes the /etc/hosts block, and makes the red prompt banner and tmux segment disappear. It never deletes anything: every ~/htb/<box> directory, box.json, writeup, loot and cast stays. htbbox use <box> brings a box back.

record — htbcast, as many sessions as you like#

htbcast                                 # new session (exit / ctrl-d to stop)
htbcast -t                              # force a terminal session even with a box set
htbcast -n foothold                     # name it yourself
htbcast -b sauna                        # into another box
htbcast ls                              # current box's sessions, newest first, with durations
htbcast ls term                         # terminal sessions
htbcast play <name>                     # replay
htbcast txt  <name>                     # plain-text transcript (paste into your notes)
htbcast gif  <name>                     # GIF preview
box set     ~/htb/<box>/casts/<box>session_<YYYYmmdd-HHMMSS>_<NN>.cast
no box      ~/htb/_termsessions/termsession_<YYYYmmdd-HHMMSS>_<NN>.cast

<NN> counts up per folder and is claimed atomically, so five terminals starting htbcast in the same second get _01 … _05 — nothing is ever overwritten.

files — what lives where#

~/htb/<box>/box.json      the manifest: name ip os difficulty hostnames domain status flags creds ports notes
~/htb/<box>/writeup.md    rendered once, then yours — never rewritten
~/htb/<box>/recon enum creds loot exploit serve casts
~/htb/_termsessions/      htbcast sessions with no box
~/.local/state/htb/       target  host  box   (what clear empties)

env — exported in every terminal#

$TARGET  $RHOST  $IP      the box IP
$BOX     $BOXDIR          the box name and ~/htb/<box>

They refresh at each prompt: a shell mid-command keeps the old value until it returns.

flow — a whole box#

htbup
htbbox new EscapeTwo 10.10.11.51 win medium sequel.htb dc01.sequel.htb
htbcast -n enum                         # terminal 1: record
htbscan                                 # terminal 2: scan -> box.json ports
htbbox cred rose 'KxEPkKe6R8su' given
htbtime                                 # Kerberos clock skew (uses $TARGET); htbtime off after
htbbox flag user <hash>; htbbox flag root <hash>
htbcast txt enum                        # transcript for the write-up
htbbox clear; htbdown                   # done: target gone, files kept

fix — when something looks wrong#

banner/IP still showing        htbbox clear   (then press enter once in other terminals)
names stop resolving           a rebuild rewrote /etc/hosts -> htbbox use <box>
KRB_AP_ERR_SKEW                htbbox host dc01.<domain>; htbtime
htbcast "no such box"          htbbox ls — or htbcast -t for a terminal session
"/etc/hosts was NOT updated"   sudo rule missing until the rebuild is live; check /etc/hosts
old sqlite data                ~/.pentest/engagements.db is left on disk, untouched