All Projects → sethmlarson → Virtualbox Python

sethmlarson / Virtualbox Python

Licence: apache-2.0
Complete implementation of VirtualBox's COM API with a Pythonic interface.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Virtualbox Python

Macos Virtualbox Vm
Instructions and script to help you create a VirtualBox VM running macOS.
Stars: ✭ 2,385 (+761.01%)
Mutual labels:  virtual-machine, virtualbox, vm
Box
[DEPRECATED] Official, pre-packaged Vagrant Box
Stars: ✭ 197 (-28.88%)
Mutual labels:  virtual-machine, virtualbox, vm
vm-automation
VirtualBox automation using Python
Stars: ✭ 1 (-99.64%)
Mutual labels:  vm, virtualbox, virtual-machine
js5005
js5005 is a virtual CPU with every logic gate simulated. A pretty interface, a built in assembler, display, and 256 bytes of RAM to boot. It's the better i4004.
Stars: ✭ 14 (-94.95%)
Mutual labels:  vm, virtualbox, virtual-machine
SBTCVM-Gen2-9
SBTCVM is a virtual machine implementation of a balanced ternary (base 3) computer. Features several compiled languages for ternary software development.
Stars: ✭ 32 (-88.45%)
Mutual labels:  vm, virtual-machine
butterfly
Butterfly connects Virtual Machines and control their traffic flow
Stars: ✭ 48 (-82.67%)
Mutual labels:  vm, virtual-machine
Multipass
Multipass orchestrates virtual Ubuntu instances
Stars: ✭ 3,978 (+1336.1%)
Mutual labels:  virtual-machine, virtualbox
kcs
Scripting in C with JIT(x64)/VM.
Stars: ✭ 25 (-90.97%)
Mutual labels:  vm, virtual-machine
Implementaion-of-Private-Cloud-using-ownCloud
Implementation of Private Cloud using ownCloud. ownCloud is a suite of client–server software for creating and using file hosting services. This repository explains implementing ownCloud on an Ubuntu VM running on top of a Windows host for secure cloud storage
Stars: ✭ 30 (-89.17%)
Mutual labels:  virtualbox, virtual-machine
Animach
Scheme语言实现和运行时环境 / A Scheme runtime & implementation
Stars: ✭ 45 (-83.75%)
Mutual labels:  vm, virtual-machine
Smlvm
Smallrepo Virtual Machine
Stars: ✭ 265 (-4.33%)
Mutual labels:  virtual-machine, vm
acquia-cloud-vm
VirtualBox/Vagrant-based VM to closely match Acquia Cloud environment.
Stars: ✭ 20 (-92.78%)
Mutual labels:  vm, virtualbox
c8c
The chip8 compiler, assembler, and virtual machine
Stars: ✭ 110 (-60.29%)
Mutual labels:  vm, virtual-machine
RSqueak
A Squeak/Smalltalk VM written in RPython.
Stars: ✭ 78 (-71.84%)
Mutual labels:  vm, virtual-machine
Scambaiting-Setup
A full setup guide for scam-baiting with Oracle's VirtualBox.
Stars: ✭ 232 (-16.25%)
Mutual labels:  virtualbox, virtual-machine
tsharkVM
tshark + ELK analytics virtual machine
Stars: ✭ 51 (-81.59%)
Mutual labels:  vm, virtual-machine
Lubuntu-VirtualBox
Lubuntu Bionic 18.04.5 Minimal and Full virtual machines. VirtualBox OVA files less than 400 MB and 1GB respectively
Stars: ✭ 25 (-90.97%)
Mutual labels:  virtualbox, virtual-machine
RISVM
A low overhead, embeddable bytecode virtual machine in C++
Stars: ✭ 21 (-92.42%)
Mutual labels:  vm, virtual-machine
upstream-institute-virtual-environment
A Vagrant-based image creator for OpenStack Upstream Training sessions
Stars: ✭ 18 (-93.5%)
Mutual labels:  virtualbox, virtual-machine
specter
a (tiny) VM project built with Go
Stars: ✭ 57 (-79.42%)
Mutual labels:  vm, virtual-machine

virtualbox-python


.. image:: https://img.shields.io/travis/sethmlarson/virtualbox-python/master.svg :target: https://travis-ci.org/sethmlarson/virtualbox-python

Complete implementation of VirtualBox's COM API with a Pythonic interface.

Installation

Go to VirtualBox's downloads page (https://www.virtualbox.org/wiki/Downloads) and download the VirtualBox SDK. Within the extracted ZIP file there is a directory called "installer". Open a console within the installer directory and run python vboxapisetup.py install using your system Python. This installs vboxapi which is the interface that talks to VirtualBox via COM.

Next is to install this library:

To get the latest released version of virtualbox from PyPI run the following::

$ python -m pip install virtualbox

or to install the latest development version from GitHub::

$ git clone https://github.com/sethmlarson/virtualbox-python
$ cd virtualbox-python
$ python setup.py install

Getting Started

Listing Available Machines

.. code-block::

>>> import virtualbox
>>> vbox = virtualbox.VirtualBox()
>>> [m.name for m in vbox.machines]
["windows"]

Launching a Machine

.. code-block::

>>> session = virtualbox.Session()
>>> machine = vbox.find_machine("windows")
>>> # progress = machine.launch_vm_process(session, "gui", "")
>>> # For virtualbox API 6_1 and above (VirtualBox 6.1.2+), use the following:
>>> progress = machine.launch_vm_process(session, "gui", [])
>>> progress.wait_for_completion()

Querying the Machine

.. code-block::

>>> session.state
SessionState(2)  # locked
>>> machine.state
MachineState(5)  # running
>>> height, width, _, _, _, _ = session.console.display.get_screen_resolution()

Interacting with the Machine

.. code-block::

>>> session.console.keyboard.put_keys("Hello, world!")
>>> guest_session = session.console.guest.create_session("Seth Larson", "password")
>>> guest_session.directory_exists("C:\\Windows")
True
>>> proc, stdout, stderr = guest_session.execute("C:\\\\Windows\\System32\\cmd.exe", ["/C", "tasklist"])
>>> print(stdout)
Image Name                   PID Session Name     Session#    Mem Usage
========================= ====== ================ ======== ============
System Idle Process            0 Console                 0         28 K
System                         4 Console                 0        236 K
smss.exe                     532 Console                 0        432 K
csrss.exe                    596 Console                 0      3,440 K
winlogon.exe                 620 Console                 0      2,380 K
services.exe                 664 Console                 0      3,780 K
lsass.exe                    676 Console                 0      6,276 K
VBoxService.exe              856 Console                 0      3,972 K
svchost.exe                  900 Console                 0      4,908 K
svchost.exe                 1016 Console                 0      4,264 K
svchost.exe                 1144 Console                 0     18,344 K
svchost.exe                 1268 Console                 0      2,992 K
svchost.exe                 1372 Console                 0      3,948 K
spoolsv.exe                 1468 Console                 0      4,712 K
svchost.exe                 2000 Console                 0      3,856 K
wuauclt.exe                  400 Console                 0      7,176 K
alg.exe                     1092 Console                 0      3,656 K
wscntfy.exe                 1532 Console                 0      2,396 K
explorer.exe                1728 Console                 0     14,796 K
wmiprvse.exe                1832 Console                 0      7,096 K
VBoxTray.exe                1940 Console                 0      3,196 K
ctfmon.exe                  1948 Console                 0      3,292 K
cmd.exe                     1284 Console                 0      2,576 K
tasklist.exe                 124 Console                 0      4,584 K

Registering Event Handlers

.. code-block::

>>> def test(event):
>>>    print("scancode received: %r" % event.scancodes)
>>>
>>> session.console.keyboard.set_on_guest_keyboard(test)
140448201250560
scancode received: [35]
scancode received: [23]
scancode received: [163]
scancode received: [151]
scancode received: [57]

Powering-Down a Machine

.. code-block::

>>> session.console.power_down()

License

Apache-2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].