Files
pentest.intro/content/lib/cmd_misc.sh
T
quoije 77d123a9cf Add optional Kali attacker VM and DHCP for the lab bridge
lab.sh kali install|up|down|reset|status extracts the official Kali QEMU
image once, keeps it as a read-only base with a throwaway overlay, and
boots two NICs: the lab bridge (for the exercise) and user networking (so
apt works without opening the isolation policy).

DC01 now serves DHCP on 10.10.10.100-200 with DNS and domain options but no
router: devices on the bridge configure themselves while the lab stays
isolated. A reservation pins 10.10.10.101 to the Kali MAC.

Also fixed backend_stop, which still called the pre-refactor WinRM helper
and fell back to killing the VMs.
2026-10-22 19:55:15 -04:00

37 lines
996 B
Bash

# shellcheck shell=bash
# cmd_answers / cmd_destroy — small utilities shared by both platforms.
cmd_answers() {
local file="$ROOT_DIR/answers/walkthrough.md"
[[ -r $file ]] || die "no answer key at $file"
cat "$file"
}
cmd_destroy() {
local name i
step "stop"
for name in "${VM_NAMES[@]}"; do
backend_stop "$name" >/dev/null 2>&1 || true
done
step "remove"
for name in "${VM_NAMES[@]}"; do
backend_destroy "$name" || warn "could not fully remove $name"
done
step "generated artifacts"
rm -rf "$LAB_ROOT/seeds" "$LAB_ROOT/run" "$LAB_ROOT/provision"
ok "seed ISOs, runtime state and provisioning scratch removed"
printf '\n'
info "kept: ${LAB_ROOT}/images (baselines), logs, and the ISO cache"
info "remove those by hand if you really want the space back"
}
# Platforms that support participant tunnels override this.
cmd_peers() { planned peers; }
# Overridden by the qemu platform, which ships the Kali image helper.
cmd_kali() { planned kali; }