Database
~/.local/share/pentest-env/pentest.db is SQLCipher-encrypted. The data, state and backup directories are created mode 700.
Module 02 // encrypted operations
pe is the target-first interface for lab state: select one box, then attach flags, credentials, hosts, ports and notes to it without scattering secrets across flat files.
pe doctor, initialize once with pe init, then use pe help whenever the command surface changes.The active target is the current scope. New findings attach to it automatically unless a command accepts and receives an explicit --target. The Zsh prompt and tmux bar read only a small name | ip state cache, so they do not repeatedly unlock the database.
pe target add keeper --ip 10.10.11.227 --platform htb
pe status
pe target use keeper
pe target show keeper
pe status. Target-first convenience is powerful, but a stale active target can misfile evidence.| Command | Purpose | Notes |
|---|---|---|
pe init | Create and key the encrypted database. | Generates a key when neither PENTEST_DB_KEY nor a wrapped key file exists. |
pe doctor | Audit tools, ARM64 helpers, permissions, tunnel and safety defaults. | “Not found” can be optional; read each section rather than treating every line as fatal. |
pe status | Show active target, IP and flag count. | Fast pre-command scope check. |
pe version | Print pentest-env command version. | Useful when reporting a setup issue. |
pe help | Show the authoritative top-level command list. | Aliases -h and --help work too. |
pe target add <name> [--ip 10.10.10.10] [--platform htb]
[--hostname host.domain] [--os linux] [--difficulty medium]
pe target ls
pe target use <name-or-id>
pe target show [<name-or-id>]
pe target status
pe target edit <id> --ip 10.10.10.11 --status owned
pe target rm <name-or-id>
t is the noun alias; tl, tu and ts cover list, use and status. Removing a target cascade-deletes its attached flags, credentials, hosts, ports and notes after confirmation—back up first.
pe flag add [user|root|web|blood] <value> [--notes "where found"]
pe flag ls [--all]
pe flag show <id>
pe flag search <term>
pe flag rm <id>
The default type is user. Use --all only when you intentionally need cross-target output. Shell aliases: f and fl. Widget: Ctrl-X then f uses fzf to insert a selected flag at the cursor.
pe cred add -u <user> -s <secret>
[-t password|hash|ssh-key|token] [-S <service>]
[--source <where-found>] [--host <host-id>] [--target <target>]
pe cred ls [--all]
pe cred show <id>
pe cred valid <id> 1|0
pe cred search <term>
pe cred rm <id>
-s may briefly appear in process inspection and would normally enter history. Begin the command with a literal space, and prefer pasting only when needed. Clear the clipboard afterward.Aliases: c and cl. Widget: Ctrl-X then c selects a stored credential and inserts its secret into the current line; it does not execute it.
pe host add --ip <address> [--hostname <name>] [--os <os>]
[--label <role>] [--target <target>]
pe host ls [--all]
pe host show <id>
pe host port <host-id> <port> [--proto tcp] [--service ssh] [--version <text>]
pe host rm <id>
Use hosts for additional interfaces, domain controllers or pivot-only systems belonging to the active lab target. Aliases: h and hl; the short h intentionally replaces common history aliases.
pe note add -t <title> [-b <body>] [--tags <tags>]
[--target <target>] [--global]
pe note ls [--all] [--global]
pe note show <id>
pe note edit <id> [-t <title>] [-b <body>] [--tags <tags>]
pe note search <term>
pe note rm <id>
Without -b, pe note add opens $EDITOR (or reads piped input). Use global notes sparingly for reusable methodology; host-specific discoveries belong to their target. Aliases: n and nl.
pe vpn import ~/Downloads/lab.ovpn lab
pe vpn ls
pe vpn up lab
pe vpn status
pe vpn route "$IP"
~/.config/htb/vpn/ with mode 600.pe vpn up selects it automatically. With several, pass a name or choose through fzf in a terminal.sudo; Ctrl+C is the disconnect action.pe vpn status lists lab-like interfaces. pe vpn route <ip> answers the stronger question: where will this target packet go?pe session
pe session keeper
htb-session
box
All four enter the deterministic tmux workflow; a supplied target is activated first. The session name is htb-<safe-target-name>, and its panes start in $PE_WORKROOT/<target>. See the tmux cockpit for layout and keys.
| Command | Behavior | Guard |
|---|---|---|
pe backup | Integrity-checks, timestamps, compresses and prunes old snapshots. | Default retention is 20. |
pe restore | Selects a backup, validates a private staged copy, and snapshots the current DB before the atomic swap. | Rejects a wrong-key or corrupt candidate without touching the live DB. |
pe reset | Deletes all rows while preserving the schema. | Snapshots first and requires typing RESET. |
pe destroy | Deletes the current database file. | Backups remain; requires typing DESTROY. |
pe cheat
pe cheat env
pe cheat vpn
cheat nmap
With no query, pe cheat opens an fzf browser and preview. With a query, it searches the local Markdown sheets. This HTML manual is a separate, browser-friendly and printable layer; it uses no network resources.
~/.local/share/pentest-env/pentest.db is SQLCipher-encrypted. The data, state and backup directories are created mode 700.
~/.local/state/pentest-env/db.key.gpg contains the encrypted key material. GPG agent may cache its passphrase for a session.
PENTEST_DB_KEY bypasses the wrapped file. Environment variables can leak through process context and crash reports; use it only in a controlled environment.
The active display file contains target name and IP only. It lets the prompt and status bar remain responsive without database decryption.
No command topic matches that filter. Press Esc to reset.