<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light"><meta name="theme-color" content="#faf4ed">
<meta name="description" content="Complete pe pentest-env command cheatsheet.">
<title>Voidwalker Field Manual // pe</title>
<link rel="stylesheet" href="assets/style.css?v=2"><script src="assets/app.js?v=2" defer></script>
</head>
<body>
<a class="skip-link" href="#content">Skip to content</a>
<header class="site-header"><div class="header-inner">
<a class="brand" href="index.html"><span class="brand-mark" aria-hidden="true">V</span><span>Voidwalker<small>offline field manual</small></span></a>
<button class="nav-toggle" type="button" aria-expanded="false" aria-controls="site-nav">menu</button>
<nav class="site-nav" id="site-nav" aria-label="Handbook">
<a href="index.html">Setup</a><a href="tmux.html">tmux</a><a href="pe.html">pe</a><a href="htb-workflow.html">HTB</a><a href="zsh-terminal.html">Shell</a><a href="recon.html">Recon</a><a href="web.html">Web</a><a href="ad-windows.html">AD</a><a href="privesc.html">PrivEsc</a><a href="transfer.html">Transfer</a><a href="toolbox.html">Tools</a>
</nav>
</div></header>
<div class="page-shell">
<main id="content">
<section class="hero">
<p class="eyebrow">Module 02 // encrypted operations</p>
<h1><span class="accent">pe</span> command center.</h1>
<p class="lede"><code>pe</code> 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.</p>
<div class="hero-meta"><span class="tag">SQLCipher</span><span class="tag">GPG-wrapped key</span><span class="tag">XDG paths</span><span class="tag">target-first</span></div>
</section>
<div class="notice safe"><div><strong>Start here:</strong> run <code>pe doctor</code>, initialize once with <code>pe init</code>, then use <code>pe help</code> whenever the command surface changes.</div></div>
<div class="search-box"><label for="page-search">Find a pe command</label><input id="page-search" data-page-search type="search" placeholder="Try: credential, backup, VPN, target edit…" autocomplete="off"><span class="search-hint"><kbd>/</kbd> focus · <kbd>Esc</kbd> clear</span></div>
<p class="filter-summary" data-filter-summary aria-live="polite"></p>
<section id="mental-model" data-search-item data-search="model active target encrypted database plaintext cache SQLCipher">
<h2>The active-target model</h2>
<p>The active target is the current scope. New findings attach to it automatically unless a command accepts and receives an explicit <code>--target</code>. The Zsh prompt and tmux bar read only a small <code>name | ip</code> state cache, so they do not repeatedly unlock the database.</p>
<pre><code>pe target add keeper --ip 10.10.11.227 --platform htb
pe status
pe target use keeper
pe target show keeper</code></pre>
<div class="notice"><div>Before adding a credential or flag, glance at <code>pe status</code>. Target-first convenience is powerful, but a stale active target can misfile evidence.</div></div>
</section>
<section id="bootstrap" data-search-item data-search="init doctor health version help bootstrap database create key">
<h2>Bootstrap and health</h2>
<div class="table-wrap"><table>
<thead><tr><th>Command</th><th>Purpose</th><th>Notes</th></tr></thead>
<tbody>
<tr><td><code>pe init</code></td><td>Create and key the encrypted database.</td><td>Generates a key when neither <code>PENTEST_DB_KEY</code> nor a wrapped key file exists.</td></tr>
<tr><td><code>pe doctor</code></td><td>Audit tools, ARM64 helpers, permissions, tunnel and safety defaults.</td><td>“Not found” can be optional; read each section rather than treating every line as fatal.</td></tr>
<tr><td><code>pe status</code></td><td>Show active target, IP and flag count.</td><td>Fast pre-command scope check.</td></tr>
<tr><td><code>pe version</code></td><td>Print pentest-env command version.</td><td>Useful when reporting a setup issue.</td></tr>
<tr><td><code>pe help</code></td><td>Show the authoritative top-level command list.</td><td>Aliases <code>-h</code> and <code>--help</code> work too.</td></tr>
</tbody>
</table></div>
</section>
<section id="targets" data-search-item data-search="target t add use list show status current edit remove platform hostname os difficulty owned">
<h2>Targets</h2>
<pre><code>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></code></pre>
<p><code>t</code> is the noun alias; <code>tl</code>, <code>tu</code> and <code>ts</code> cover list, use and status. Removing a target cascade-deletes its attached flags, credentials, hosts, ports and notes after confirmation—back up first.</p>
</section>
<section id="flags" data-search-item data-search="flag f add list show search remove user root web blood proof">
<h2>Flags</h2>
<pre><code>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></code></pre>
<p>The default type is <code>user</code>. Use <code>--all</code> only when you intentionally need cross-target output. Shell aliases: <code>f</code> and <code>fl</code>. Widget: <kbd>Ctrl-X</kbd> then <kbd>f</kbd> uses fzf to insert a selected flag at the cursor.</p>
</section>
<section id="credentials" data-search-item data-search="credential cred c password hash ssh key token valid service source secret">
<h2>Credentials</h2>
<pre><code>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></code></pre>
<div class="notice"><div><strong>Command-line exposure:</strong> a secret passed with <code>-s</code> 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.</div></div>
<p>Aliases: <code>c</code> and <code>cl</code>. Widget: <kbd>Ctrl-X</kbd> then <kbd>c</kbd> selects a stored credential and inserts its secret into the current line; it does not execute it.</p>
</section>
<section id="hosts" data-search-item data-search="host h port service pivot internal hostname IP protocol version">
<h2>Hosts and ports</h2>
<pre><code>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></code></pre>
<p>Use hosts for additional interfaces, domain controllers or pivot-only systems belonging to the active lab target. Aliases: <code>h</code> and <code>hl</code>; the short <code>h</code> intentionally replaces common history aliases.</p>
</section>
<section id="notes" data-search-item data-search="note n add editor stdin tags global search edit title body">
<h2>Notes</h2>
<pre><code>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></code></pre>
<p>Without <code>-b</code>, <code>pe note add</code> opens <code>$EDITOR</code> (or reads piped input). Use global notes sparingly for reusable methodology; host-specific discoveries belong to their target. Aliases: <code>n</code> and <code>nl</code>.</p>
</section>
<section id="vpn" data-search-item data-search="VPN import list up connect status route openvpn profile permissions tun tap wg">
<h2>VPN profiles and routes</h2>
<pre><code>pe vpn import ~/Downloads/lab.ovpn lab
pe vpn ls
pe vpn up lab
pe vpn status
pe vpn route "$IP"</code></pre>
<ul class="checklist">
<li>Import copies a profile into <code>~/.config/htb/vpn/</code> with mode <code>600</code>.</li>
<li>With one profile, <code>pe vpn up</code> selects it automatically. With several, pass a name or choose through fzf in a terminal.</li>
<li>The OpenVPN process remains in the foreground under <code>sudo</code>; <kbd>Ctrl</kbd>+<kbd>C</kbd> is the disconnect action.</li>
<li><code>pe vpn status</code> lists lab-like interfaces. <code>pe vpn route <ip></code> answers the stronger question: where will this target packet go?</li>
<li>Do not run a local HTB VPN and HTB Pwnbox against the same lab at the same time.</li>
</ul>
</section>
<section id="sessions" data-search-item data-search="session htb-session box workspace tmux target deterministic">
<h2>Sessions</h2>
<pre><code>pe session
pe session keeper
htb-session
box</code></pre>
<p>All four enter the deterministic tmux workflow; a supplied target is activated first. The session name is <code>htb-<safe-target-name></code>, and its panes start in <code>$PE_WORKROOT/<target></code>. See the <a href="tmux.html">tmux cockpit</a> for layout and keys.</p>
</section>
<section id="backup" data-search-item data-search="backup restore reset destroy recovery retention integrity gzip database wipe">
<h2>Backup, restore and destructive actions</h2>
<div class="table-wrap"><table>
<thead><tr><th>Command</th><th>Behavior</th><th>Guard</th></tr></thead>
<tbody>
<tr><td><code>pe backup</code></td><td>Integrity-checks, timestamps, compresses and prunes old snapshots.</td><td>Default retention is 20.</td></tr>
<tr><td><code>pe restore</code></td><td>Selects a backup, validates a private staged copy, and snapshots the current DB before the atomic swap.</td><td>Rejects a wrong-key or corrupt candidate without touching the live DB.</td></tr>
<tr><td><code>pe reset</code></td><td>Deletes all rows while preserving the schema.</td><td>Snapshots first and requires typing <code>RESET</code>.</td></tr>
<tr><td><code>pe destroy</code></td><td>Deletes the current database file.</td><td>Backups remain; requires typing <code>DESTROY</code>.</td></tr>
</tbody>
</table></div>
<div class="notice"><div>A database backup without its wrapped key—or the passphrase needed to unwrap it—may be unrecoverable. Protect both, but store copies separately where practical.</div></div>
</section>
<section id="cheats" data-search-item data-search="cheat cheatsheet fzf ripgrep markdown browse search">
<h2>Terminal cheatsheets</h2>
<pre><code>pe cheat
pe cheat env
pe cheat vpn
cheat nmap</code></pre>
<p>With no query, <code>pe cheat</code> 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.</p>
</section>
<section id="storage" data-search-item data-search="storage security paths key environment PENTEST_DB_KEY GPG SQLCipher permissions XDG">
<h2>Storage and key behavior</h2>
<div class="grid">
<article class="panel"><h3>Database</h3><p><code>~/.local/share/pentest-env/pentest.db</code> is SQLCipher-encrypted. The data, state and backup directories are created mode <code>700</code>.</p></article>
<article class="panel"><h3>Wrapped key</h3><p><code>~/.local/state/pentest-env/db.key.gpg</code> contains the encrypted key material. GPG agent may cache its passphrase for a session.</p></article>
<article class="panel"><h3>Automation override</h3><p><code>PENTEST_DB_KEY</code> bypasses the wrapped file. Environment variables can leak through process context and crash reports; use it only in a controlled environment.</p></article>
<article class="panel"><h3>Hot-path cache</h3><p>The active display file contains target name and IP only. It lets the prompt and status bar remain responsive without database decryption.</p></article>
</div>
</section>
<p class="empty-state" data-empty-state hidden>No command topic matches that filter. Press <kbd>Esc</kbd> to reset.</p>
<nav class="page-nav" aria-label="Adjacent pages"><a href="tmux.html">← tmux cockpit</a><a href="htb-workflow.html">HTB runbook →</a></nav>
</main>
<aside class="toc" aria-label="On this page"><strong>On this page</strong>
<ul><li><a href="#mental-model">Model</a></li><li><a href="#bootstrap">Bootstrap</a></li><li><a href="#targets">Targets</a></li><li><a href="#flags">Flags</a></li><li><a href="#credentials">Credentials</a></li><li><a href="#hosts">Hosts</a></li><li><a href="#notes">Notes</a></li><li><a href="#vpn">VPN</a></li><li><a href="#sessions">Sessions</a></li><li><a href="#cheats">Cheats</a></li><li><a href="#backup">Recovery</a></li><li><a href="#storage">Storage</a></li></ul>
</aside>
</div>
<footer class="site-footer"><strong>VOIDWALKER // PE</strong><br>Encrypted target state · explicit scope · recoverable backups</footer>
</body>
</html>