1

I am currently working on a project that involves simulating keystrokes and mouse moves in a virtual machine, if possible in Python. That is, a Linux distro would be running in a VM and my Python script running on the host (MacOS) would be able to move the mouse pointer and simulate keystrokes inside that Linux VM. Additionally, I would like to be able to get the display output of the VM in my Python script running on the host (there might be some conversion needed to get the image in the right format but this is not an issue).

I have done some research and it seems that VirtualBox has an SDK that allows for such things (see for example Sending mouse or touch events to VirtualBox VM from host shell?). However, it seems that the Python bindings are old and I can't seem to get them to work on a recent version of MacOS.

Does anyone have experience with this (I hardly found any mention of controlling a VM from the host online, but I might be searching for the wrong keywords)? If so, is there another way to achieve this? It seems that most VM software does not even have an API that allows external programs to interface with the VMs.

Thanks!

Ben
  • 317
  • 3
  • 12
  • https://github.com/cair/pyVNC could do the trick if you set up a VNC connection between the host and the VM, however I'd appreciate a more native solution! – Ben May 31 '19 at 17:39
  • Follow-up: one can use a Docker VNC image and a VNC client Python library. – Ben May 31 '19 at 19:18

0 Answers0