Files
pentest.intro/backends/qemu.sh
T
quoije fb06ee5a52 Phase 1: scaffold lab.sh, config and preflight checks
Move the archived 2002 site into site-src/ so the lab README can take the
repo root. Add lab.conf, the lab.sh dispatcher, a qemu backend and the
check/init verbs. No VM is created yet.
2026-10-21 18:34:22 -04:00

38 lines
1.2 KiB
Bash

# shellcheck shell=bash
# QEMU/KVM backend — local development and dry runs.
backend_check() {
if qemu-system-x86_64 -M help 2>/dev/null | grep -q '^q35'; then
_c_ok "qemu: q35 machine type available"
else
_c_fail "qemu: q35 machine type unavailable"
fi
if qemu-system-x86_64 -device help 2>/dev/null | grep -q 'name "e1000"'; then
_c_ok "qemu: e1000 NIC model available"
else
_c_warn "qemu: e1000 NIC model not listed"
fi
if qemu-system-x86_64 -device help 2>/dev/null | grep -q 'name "ich9-ahci"'; then
_c_ok "qemu: ich9-ahci controller available"
else
_c_warn "qemu: ich9-ahci controller not listed"
fi
# `-netdev help` omits bridge even when it is compiled in, so probe it instead:
# an unsupported type answers "Invalid netdev type", a supported one complains
# about the missing bridge device (br0).
if qemu-system-x86_64 -netdev bridge,id=probe 2>&1 | grep -qi 'invalid netdev'; then
_c_fail "qemu: bridge netdev not supported"
else
_c_ok "qemu: bridge netdev supported"
fi
if [[ -x /usr/libexec/qemu-bridge-helper ]]; then
_c_ok "qemu-bridge-helper present"
else
_c_warn "qemu-bridge-helper not found: unprivileged bridge attach will fail"
fi
}