pentest-env — how to use this environment#
The meta-cheatsheet. Open it any time with pe cheat env (or cheatenv).
For the visual offline handbook, run pe guide (or pe guide tmux,
pe guide recon, and the other module names).
Everything lives behind one command: pe. Data is stored in an encrypted
SQLCipher database and organised target-first — pick an active box, and
every flag/cred/host/note you add attaches to it automatically.
First run#
pe init # create + key the encrypted database
pe target add Cap --ip 10.10.10.245 --platform htb
pe doctor # audit tools, permissions, VPN and wordlists
pe vpn import ~/Downloads/lab.ovpn lab
pe vpn up lab # foreground OpenVPN session
newbox Cap 10.10.10.245 htb # activate target + private worktree
htb-session # deterministic tmux cockpit
# (adding a target makes it active automatically)
The active target#
The "active target" is the box you're working on. New flags/creds/hosts/notes attach to it; the zsh prompt (right side) and tmux status bar show it.
pe target use Cap # switch active target (by name or id)
tu Cap # alias
pe status # name | ip | flag-count
Ctrl-X t # fzf-pick the active target
Targets ( alias: t )#
pe target add <name> [--ip x] [--platform htb|thm|ctf|client] [--hostname h] [--os o] [--difficulty d]
pe target ls # table; '*' marks the active one (tl)
pe target use <name|id> # set active (tu)
pe target show [name|id] # full detail incl. flags/creds/hosts
pe target status # one-line summary (ts)
pe target edit <id> --ip ... --status owned
pe target rm <name|id> # cascade-deletes its flags/creds/hosts/notes (double-confirm)
Flags ( alias: f )#
pe flag add [type] <value> [--notes n] [--target T] # type: user|root|web|blood (default user)
pe flag ls [--all] # active target, or every target with --all (fl)
pe flag show <id>
pe flag search <term>
pe flag rm <id>
Ctrl-X f # fzf-pick a flag, paste its value at the cursor
Credentials ( alias: c ) — stored encrypted (whole DB is SQLCipher)#
pe cred add -u <user> -s <secret> [-t password|hash|ssh-key|token] [-S service] [--source s] [--host id] [--target T]
pe cred ls [--all] (cl)
pe cred show <id>
pe cred valid <id> 1|0 # mark what works / what doesn't
pe cred search <term>
pe cred rm <id>
Ctrl-X c # fzf-pick a cred, paste its secret at the cursor
Hosts & ports ( alias: h ) — pivot / internal boxes under a target#
pe host add --ip <x> [--hostname h] [--os o] [--label l] [--target T] (hl = list)
pe host ls [--all]
pe host show <id> # host detail + recorded ports
pe host port <host_id> <port> [--proto tcp] [--service ssh] [--version v]
pe host rm <id>
Notes ( alias: n ) — quick scratch notes, per-target or global#
pe note add -t <title> [-b body] [--tags x] [--target T] [--global]
# no -b -> opens $EDITOR (or reads piped stdin)
pe note ls [--all] [--global] (nl)
pe note show <id>
pe note edit <id> [-t title] [-b body] [--tags x]
pe note search <term>
pe note rm <id>
Backup / restore / wipe#
pe backup # integrity-checked, gzip, timestamped, auto-pruned (peb)
pe restore # fzf-pick a backup; validate it before the swap,
# then snapshot the current DB and replace atomically
pe reset # wipe ALL rows, keep schema (snapshots first, type RESET)
pe destroy # delete the DB file entirely (backups kept, type DESTROY)
Backups: ~/.local/share/pentest-env/backups/ · retention = $PE_BACKUP_RETENTION (20).
Cheatsheets#
pe cheat # fzf list of sheets, live preview (alias: cheat)
pe cheat <query> # ripgrep across all sheets
pe cheat env # this file
Workflow helpers (zsh functions)#
newbox <name> <ip> [plat] # add+activate a target and make ~/htb/<name>/{nmap,loot,www,...}; cd in
tip # print active target IP (also -> clipboard via xclip)
useip # export $IP and $RHOST from the active target
scan [ip] # nmap -sCV into ./nmap (defaults to active target IP)
Keybindings (zsh)#
| Key | Action |
|---|---|
Ctrl-X t |
fzf-switch the active target |
Ctrl-X f |
insert a flag value at the cursor |
Ctrl-X c |
insert a credential secret at the cursor |
ESC ESC |
prepend sudo to the current line |
tmux#
Key (prefix C-b or C-a) |
Action |
|---|---|
| `prefix | /prefix -` |
prefix h/j/k/l |
move between panes |
prefix H/J/K/L |
resize pane |
prefix P |
3-pane HTB layout |
prefix r |
reload tmux.conf |
prefix V |
foreground VPN window |
Tmux is intentionally plugin-free: detach/reattach while the server runs, but pane commands and scrollback are never serialized to disk because they may contain credentials or tokens.
Where things live (XDG)#
| What | Path |
|---|---|
| Config + code | ~/.config/pentest-env/ |
| Encrypted DB | ~/.local/share/pentest-env/pentest.db |
| Backups | ~/.local/share/pentest-env/backups/ |
| Active target | ~/.local/state/pentest-env/active_target |
| DB key (wrapped) | ~/.local/state/pentest-env/db.key.gpg |
| Alacritty theme | ~/.config/alacritty/alacritty.toml (Rose-Pine) |
Database key#
On pe init a random 256-bit key is generated and GPG-symmetric-wrapped
(you choose the passphrase). The DB is decrypted on demand; gpg-agent caches
the passphrase. For automation, set PENTEST_DB_KEY in the environment to skip
the keyfile entirely.