# pentest-env
A portable, riced Kali penetration-testing environment with an encrypted,
target-centric data store for **flags, credentials, hosts, and notes** — plus
ZSH, tmux, a Rose Pine GNOME/XFCE profile, and offline HTML plus in-terminal
cheatsheets.
Everything is driven by one command: **`pe`**.
```
┌─[kali@kali]─[~/htb/Cap] ⚑ Cap | 10.10.10.245
└─❯ pe flag add user 'HTB{...}'
[+] flag #1 [user] stored for Cap
```
---
## What you get
| Component | Description |
|-----------|-------------|
| `pe` CLI | target/flag/cred/host/note manager over an encrypted SQLCipher DB |
| Encryption | whole-DB SQLCipher; key generated + GPG-wrapped at install |
| Target-centric | pick an active box; new data auto-attaches to it |
| Backup | integrity-checked, gzip, retained; staged validation and atomic restore |
| ZSH | oh-my-zsh + autosuggestions, syntax-highlighting, fzf-tab, you-should-use; Rose-Pine prompt showing the active box |
| tmux | Rose Pine status bar with the active target; plugin-free and secret-safe |
| Cheatsheets | `pe cheat` in the terminal; `pe guide` opens the searchable HTML handbook |
| Terminal | Alacritty installed + Rose-Pine `alacritty.toml`, set as XFCE default |
| Theme | Rose Pine GNOME/Wayland on Ubuntu, XFCE fallback, optional BSPWM (Kali/X11) |
| Desktop | HTB launcher, wallpaper, terminal preference, and reversible GNOME settings |
| Bar hooks | Polybar shows the **active `pe` target** + **VPN `tun0` IP** — the bar knows your box |
## Requirements
Kali/Debian (installed automatically by `install.sh`):
`zsh tmux sqlcipher fzf bat ripgrep fd-find gnupg jq git curl xclip wl-clipboard
alacritty openvpn`.
The optional BSPWM rice (Linux/X11) adds:
`bspwm sxhkd polybar rofi picom dunst feh libnotify-bin maim xdotool brightnessctl
playerctl pulseaudio-utils papirus-icon-theme x11-xserver-utils` (skip with `--no-wm`).
Portable core also runs on macOS (Homebrew); Alacritty and the HTML handbook
deploy there, while GNOME/XFCE/BSPWM are Linux desktop profiles. A Nerd Font
(MesloLGS NF, installed automatically) provides the
prompt/bar glyphs.
## Install
```sh
git clone <this repo> pentest-env && cd pentest-env
./install.sh # full install (asks for a DB key passphrase)
exec zsh # reload your shell
pe cheat env # learn the workflow
```
Useful flags:
```sh
./install.sh --dry-run # print every action, change nothing
./install.sh --no-theme # skip GNOME/XFCE theming
./install.sh --no-wm # skip the optional BSPWM rice
./install.sh --no-wordlists # skip sparse SecLists download
./install.sh --no-deps # skip the package manager
./install.sh --uninstall # remove integration (keeps your database)
```
The installer is **idempotent** — safe to re-run. It writes a single marked
block into `~/.zshrc` and `~/.tmux.conf`; nothing else in those files is touched.
## Quick start
```sh
pe init # one-time: create the encrypted DB
pe target add Cap --ip 10.10.10.245 # add + activate a target
pe flag add user 'HTB{...}' # auto-attaches to Cap
pe cred add -u admin -s hunter2 -S ssh
pe host add --ip 10.10.10.245 --hostname cap.htb
pe note add -t foothold -b 'gobuster -> /uploads rce'
pe target ls # overview (active box marked with *)
pe backup # snapshot the encrypted DB
```
Full command reference: `pe cheat env` (or `cheatenv`). Open `pe guide` for the
visual setup, tmux, VPN, recon, web, AD, privilege-escalation, transfer, and
toolbox pages. Use only against systems you are authorized to test.
## Desktop — GNOME/XFCE and optional BSPWM
A Rose-Pine tiling desktop (X11) deployed alongside the toolkit. After install,
**log out and pick the `bspwm` session** at the greeter (or `startx` after
`cp ~/.config/pentest-env/wm/xinitrc ~/.xinitrc`). Configs are symlinked from
`wm/`, so editing a file in the repo updates the live rice immediately.
Stack: **bspwm** (WM) · **sxhkd** (keys) · **Polybar** (bar) · **Rofi** (launcher) ·
**picom** (compositor: rounded corners, blur, fade) · **dunst** (notifications).
The Polybar right cluster surfaces the **active `pe` target** (gold flag) and the
**VPN `tun0` IP** (foam shield) — click the flag to switch targets without leaving
the bar.
Key bindings (`super` = Mod4 / the ⊞ key — full list in `wm/sxhkd/sxhkdrc`):
| Keys | Action |
|------|--------|
| `super + Return` | terminal (Alacritty) |
| `super + space` | app launcher (Rofi) |
| `super + Tab` | window switcher |
| `super + shift + Return` | browser · `super + e` files |
| `super + r` | run dialog · `super + shift + e` power menu |
| `super + w` / `super + shift + w` | close / kill window |
| `super + {h,j,k,l}` | focus window (vim dirs) |
| `super + shift + {h,j,k,l}` | swap window |
| `super + alt + {h,j,k,l}` | resize window |
| `super + {1-9,0}` | go to desktop · add `shift` to send window |
| `super + {t,s,f}` | tiled / floating / fullscreen |
| `super + ctrl + {h,j,k,l}` | preselect split direction |
| `super + Escape` / `super + shift + r` | reload sxhkd / restart bspwm |
| `Print` / `super + Print` / `shift + Print` | screenshot full / region / window |
| media & brightness keys | volume · play-pause · brightness |
Don't want it? Re-run with `--no-wm`, or `~/.config/pentest-env/wm/setup-wm.sh --unlink`.
## Layout
```
~/.config/pentest-env/ config + code (config.sh, lib/, zsh/, tmux/, theme/, guide/, cheatsheets/)
~/.local/share/pentest-env/ pentest.db (encrypted) + backups/
~/.local/state/pentest-env/ active target pointer + GPG-wrapped DB key
~/.local/bin/pe symlink to the dispatcher
~/.local/bin/htb-session deterministic per-target tmux workspace
~/.config/{bspwm,sxhkd,polybar,rofi,picom,dunst} symlinks -> ~/.config/pentest-env/wm/*
```
## Security
- The entire database is encrypted at rest (SQLCipher, `cipher_compatibility=4`).
Credential values are therefore stored without extra per-field crypto.
- The key is a random 256-bit value, GPG-symmetric-wrapped with a passphrase you
choose. It is fed to SQLCipher on **stdin**, never as a process argument.
- All user input is passed through `db_quote` (SQL-injection safe).
- DB, key, and backups are created `0600`; data/state dirs `0700`.
- For automation, export `PENTEST_DB_KEY` to bypass the keyfile.
## Repo structure
```
install.sh master installer (idempotent, --dry-run/--uninstall)
config/ the payload deployed to ~/.config/pentest-env
config.sh paths + Rose-Pine palette (single source of truth)
schema.sql SQLCipher schema
bin/pe dispatcher
lib/*.sh ui, db, target, host, flag, cred, note, backup, cheat, guide, vpn
zsh/*.zsh loader, plugins, aliases, functions, prompt
tmux/tmux.conf Rose-Pine tmux config
alacritty/ Rose-Pine alacritty.toml
theme/ GNOME/XFCE Rose Pine profiles + wallpaper + rollback
wm/ BSPWM rice: bspwm/ sxhkd/ polybar/ rofi/ picom/ dunst/ + setup-wm.sh
scripts/ parallels-tools.sh (Parallels Tools installer)
cheatsheets/*.md env + tool cheatsheets
guide/*.html offline searchable Rose Pine Dawn field manual
```
## Parallels VM (Kali guest)
Installing Parallels Tools on Kali often fails with **"Permission denied"**
because the Tools ISO auto-mounts with `noexec`, so its `./install` can't run.
The bundled helper fixes this — it unmounts the CD, remounts it at
`/mnt/parallels-tools` with `exec`, installs the kernel build deps, and runs
the installer:
```sh
# 1. Parallels menu: Actions > Install Parallels Tools (attaches the CD)
# 2. in the Kali guest:
pt-install # installed by install.sh onto your PATH (self-elevates)
# or run it from the repo without installing:
./config/scripts/parallels-tools.sh
sudo reboot # after it completes
# variants:
pt-install --mount-only # just remount exec; run ./install yourself
pt-install --no-deps # skip the apt build-deps step
```
`install.sh --parallels-tools` runs the same helper as part of a full install
(attach the Tools CD first).