Use qm guest exec to run VersionGopher™ inside QEMU/KVM virtual machines through the guest agent channel - no SSH, no network, no port forwarding.
qemu-guest-agent installed and running inside the guest VMqm set VMID --agent 1VMID=100 VG_DIR=/opt/versiongopher OUT_DIR=/var/tmp/versiongopher qm start "$VMID" qm set "$VMID" --agent 1 # Create working directories inside the guest qm guest exec "$VMID" -- /bin/sh -lc \ "mkdir -p '$VG_DIR' '$OUT_DIR'"
# Create a payload tarball tar czf /tmp/vg-payload.tgz version_gopher # Inject via base64 over guest agent stdin base64 -w0 /tmp/vg-payload.tgz | \ qm guest exec "$VMID" --pass-stdin 1 -- /bin/sh -lc ' base64 -d > /tmp/vg-payload.tgz && tar xzf /tmp/vg-payload.tgz -C /opt/versiongopher && chmod +x /opt/versiongopher/version_gopher '
qm guest exec --pass-stdin supports a maximum of ~1 MiB. For larger payloads, pre-bake the collector into the VM template, use SSH/SCP, or use virt-customize on a stopped image.
qm guest exec "$VMID" --timeout 0 -- /bin/sh -lc \ "cd /opt/versiongopher && \ ./version_gopher /usr/bin -o '$OUT_DIR/scan'"
--timeout 0 for long-running scans to prevent the guest agent from timing out.
qm guest exec returns JSON with out-data, err-data, and exitcode fields. Use jq to extract stdout.qm guest exec "$VMID" -- /bin/sh -lc \
"cat '$OUT_DIR/scan.json'" \
| jq -r '."out-data"' > "/tmp/vm-${VMID}-scan.json"