1
0

extract-evidence.sh 801 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. # Copy the demo evidence out of the FAT toolkit image. Run only after shutdown.
  3. set -euo pipefail
  4. ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  5. VM_DIR="${VM_DIR:-$HOME/.HHD/PCLPoC-VM}"
  6. OUT="${1:-$ROOT/evidence}"
  7. if pgrep -f "qemu-system.*PCLPoC-2.99.0.1" >/dev/null 2>&1; then
  8. echo "VM is still running; shut it down before extracting evidence" >&2
  9. exit 1
  10. fi
  11. if [[ ! -f "$VM_DIR/toolkit.img" ]]; then
  12. echo "missing: $VM_DIR/toolkit.img" >&2
  13. exit 1
  14. fi
  15. if ! mdir -i "$VM_DIR/toolkit.img@@1M" ::/pcl-test/evidence >/dev/null 2>&1; then
  16. echo "no evidence directory in the toolkit image" >&2
  17. exit 1
  18. fi
  19. mkdir -p "$OUT"
  20. mcopy -s -i "$VM_DIR/toolkit.img@@1M" "::/pcl-test/evidence/*" "$OUT/"
  21. find "$OUT" -maxdepth 2 -type f -printf '%p %s bytes\n' | sort