Persist the Kali setup in its base image
New 'kali snapshot' subcommand commits the working overlay into the base image, the same way the Windows guests are frozen. After it, reset returns to a Kali that already has: the wordlist under /opt/norbourg, bloodyAD, sshd enabled at boot, and the dual resolver (DC first, slirp second). Verified by booting from the committed base with no manual step: sshd answers, 1716-line wordlist present, bloodyad on PATH, lab and public names both resolving. Docs: README and instructor checklist describe the new step.
This commit is contained in:
+23
-1
@@ -62,8 +62,9 @@ cmd_kali() {
|
||||
up) _kali_up ;;
|
||||
down) _kali_down ;;
|
||||
reset) _kali_reset ;;
|
||||
snapshot) _kali_snapshot ;;
|
||||
status) _kali_status ;;
|
||||
*) info "usage: ./lab.sh kali install|up|down|reset|status"; return 2 ;;
|
||||
*) info "usage: ./lab.sh kali install|up|down|reset|snapshot|status"; return 2 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -177,6 +178,27 @@ _kali_down() {
|
||||
ok "Kali stopped"
|
||||
}
|
||||
|
||||
# Fold the current overlay into the base image: wordlist, DNS, packages and
|
||||
# any tooling you installed survive a reset from then on.
|
||||
_kali_snapshot() {
|
||||
local overlay
|
||||
_kali_installed || die "Kali is not installed"
|
||||
overlay=$(_kali_disk)
|
||||
|
||||
_kali_down >/dev/null 2>&1 || true
|
||||
|
||||
if [[ ! -f $overlay ]]; then
|
||||
ok "nothing to commit — no working overlay"
|
||||
return 0
|
||||
fi
|
||||
|
||||
step "commit the overlay into ${KALI_NAME:-kali}'s base image"
|
||||
qemu-img commit -q "$overlay" || die "qemu-img commit failed"
|
||||
rm -f "$overlay"
|
||||
_kali_ensure_overlay
|
||||
ok "baseline updated: ./lab.sh kali reset now returns to this state"
|
||||
}
|
||||
|
||||
_kali_reset() {
|
||||
local overlay
|
||||
_kali_installed || die "Kali is not installed"
|
||||
|
||||
Reference in New Issue
Block a user