htb — lab lifecycle from the Mac#
The entry cheat for the whole rig: a Kali Docker container (htb-kali) you drive
from macOS, because Docker Desktop can't hand a host VPN tunnel to a container — so the
VPN, the tools, and the raw sockets all live inside the box. Set a target, bring the
container up, connect the VPN, work. Next stops: cheat recon, cheat web, cheat nxc,
cheat ad.
Aim — who you're hitting#
t seeds $TARGET/$RHOST; nearly every scanner and enum wrapper defaults to it, so set it once.
t <ip>— set$TARGETand$RHOST·t— print the current targetmyip— your attack IP into$LHOST: container tun0 first (the VPN one you actually want), then hostutun0/tun0, then LANen0. Run it right after the VPN connects.
Boot the lab#
htb-up is the everyday verb — create / start / re-attach in one command, then it drops you into a shell in the container. Prefers docker compose, falls back to raw docker run.
htb-up— bring uphtb-kaliand attach an interactive shellhtb-exec [cmd]— runcmdin the already-running container; bare = a/bin/bashshell. This is how you get a second prompt inside the box without leaving your current one.htb-down—docker stop(state kept, restart is instant) ·htb-rm—docker rm -f(destroys the container;~/htb+ external drive are volumes, so your data survives)
Connect the VPN (inside the container)#
Drop your HTB .ovpn into ~/htb/vpn/ (mounted at /root/vpn); a bare call grabs the first one it finds.
htb-up-vpn [file.ovpn]— fresh container that auto-connects the VPN on boot (setsHTB_VPN, recreates if needed)htb-vpn [file.ovpn]— connect openvpn as a daemon in an already-running container, wait fortun0, export$LHOSThtb-vpn-status— is it up, and what's thetun0IP ·htb-vpn-stop—pkill openvpnin the container- Still connecting? Read the log:
htb-exec cat /tmp/openvpn.log
Reach the lab from macOS (proxy)#
Burp / a Mac browser / curl can't route to HTB directly — the container can. htb-proxy opens a SOCKS5 hole through it.
htb-proxy— SOCKS5 viancaton127.0.0.1:1080·htb-proxy stop— tear it down- Point Burp / Firefox at
SOCKS5 127.0.0.1:1080, orcurl --socks5 127.0.0.1:1080 http://<target>
GUI when you need a screen (Bloodhound, browsers)#
XFCE4 + VNC container (kali-htb-gui), separate from the headless one. Build once with htb-build-gui.
htb-up-gui— start it (VNC :5901, noVNC :6080), then auto-opens the browser clienthtb-gui-connect— reprint the URLs / openhttp://localhost:6080/vnc.htmlhtb-exec-gui—/bin/zshstraight into the GUI box (skip VNC) ·htb-down-gui— stop and remove it
Organise the engagement#
Per-target scaffolding under ~/htb, plus /etc/hosts and Pro-Lab scope helpers.
htb-box <name> mk boxes/<name>/{scans,loot,exploits,notes,www} + cd
box [name] cd to a box (bare: list boxes)
htb-lab <name> mk pro-labs/<name>/{scans,loot,pivoting,exploits,notes,hosts} + cd
lab [name] cd to a lab (bare: list labs)
hosts-box <name>— add current$TARGETasname.htb+nameto/etc/hosts(the one you want 90% of the time)hosts-add <ip> <name…>— manual add (sudo) ·hosts-show— active entries ·hosts-rm <pat>— delete matching lines (sudo, backs up to/etc/hosts.bak)scope add|rm|check|list|clear <subnet|ip>— track in-scope subnets in~/htb/.scopefor Pro Labs;scope check <ip>tells you if a host is fair game before you scan it (stay in scope).session-report [box]— rollflags.txt/creds.txt/notes.md/scans/intoboxes/<box>_report_<date>.md
tmux for a session#
tmux-htb [name]— full HTB layout (shell / listeners / server / recon / docker windows) via~/.tmux/htb-layout.shtw <name>— quick new named window in the current session
Wordlists#
Pre-exported paths every wrapper reaches for — seed them once, then use the vars.
htb-wordlists— clone SecLists + extract rockyou into$WORDLISTS(run this on a fresh setup)
| Var | Points at |
|---|---|
$COMMON |
Web-Content/common.txt — first dir-bust pass |
$MEDIUM / $BIG / $SMALL |
directory-list-2.3-{medium,small} / big.txt |
$DNS_SUB |
subdomains-top1million-5000.txt — vhost/subdomain fuzzing |
$USERNAMES / $PASSWORDS |
names.txt / top-10000 passwords |
$ROCKYOU |
rockyou.txt — the default crack list |
$SECLISTS / $WORDLISTS |
the SecLists clone / your wordlist root |
Build & nuke images#
htb-build— build thekali-htbimage from~/htb/docker/·htb-build-gui— buildkali-htb-gui(needs the base image first)htb-delete— stop + remove the container andrmithekali-htbimage (destructive — you'llhtb-buildagain;~/htband the external drive are untouched)
Daily loop:
htb-up-vpn→myip→t <ip>→hosts-box <name>→htb-box <name>→ enumerate (cheat recon). Leave it running;htb-downbetween sessions,htb-rm/htb-deleteonly when something's wedged.