⬢ DragonFlyBSD Kernel Audit
DF-3829 / send_nmi.py
← back to finding ↓ download raw
#!/usr/bin/env python3
"""Send an NMI to the DragonFly guest via the QEMU monitor socket."""
import socket, sys

sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect("dfbsd-qemu/boot-mon.sock")
sock.settimeout(3)
# drain banner
try:
    sock.recv(4096)
except Exception:
    pass
sock.sendall(b"nmi\n")
import time
time.sleep(1)
try:
    resp = sock.recv(4096)
    print("monitor:", resp.decode(errors="replace").strip())
except Exception as e:
    print("monitor: (no resp)", e)
sock.close()