Files
pentest.intro/lib/cmd_snapshot.sh
T
quoije 71e05d6aa6 Phase 8: baseline snapshot and reset; validated attack path
snapshot freezes each golden disk into images/base/ and boots a thin
overlay; reset recreates the overlay in about a second. Shutdown now asks
the guest over WinRM because ACPI powerdown is ignored by Server 2022.

dc01-post: grant GenericAll with dsacls (the .NET ACL API reported success
but never persisted the ACE) and set MinPasswordAge to zero, without which
the ACL reset fails.

Attack path validated end to end against the live lab: web -> SMB creds ->
AS-REP -> Kerberoast -> WinRM -> GenericAll reset -> DCSync.
2026-10-21 20:10:06 -04:00

40 lines
937 B
Bash

# shellcheck shell=bash
# cmd_snapshot / cmd_reset — freeze a clean baseline and revert to it.
# qemu backend: the golden disk becomes a read-only base, each run boots a
# thin overlay. Reset deletes the overlay, so it takes about a second.
cmd_snapshot() {
local name
step "stop"
for name in "${VM_NAMES[@]}"; do
backend_stop "$name"
done
step "freeze baseline"
for name in "${VM_NAMES[@]}"; do
backend_snapshot "$name" || die "snapshot failed for $name"
done
printf '\n'
ok "baseline ready"
info " start with ./lab.sh up · revert with ./lab.sh reset"
}
cmd_reset() {
local name
step "revert to baseline"
for name in "${VM_NAMES[@]}"; do
backend_reset "$name" || die "reset failed for $name"
done
step "start"
for name in "${VM_NAMES[@]}"; do
backend_launch "$name" run || fail "$name did not start"
done
printf '\n'
ok "laboratory reset — previous state discarded"
}