virtualbox


Namevirtualbox JSON
Version 2.1.1 PyPI version JSON
download
home_pagehttps://github.com/sethmlarson/virtualbox-python
SummaryComplete implementation of VirtualBox's COM API with a Pythonic interface
upload_time2020-10-26 19:16:17
maintainerSeth Michael Larson
docs_urlNone
authorMichael Dorman
requires_python
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            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



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sethmlarson/virtualbox-python",
    "name": "virtualbox",
    "maintainer": "Seth Michael Larson",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "sethmichaellarson@gmail.com",
    "keywords": "",
    "author": "Michael Dorman",
    "author_email": "mjdorma+pyvbox@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/83/ba/9253ee4b2a08d2868d163afbf8085cf70807368abbe630cbb133a1b25a02/virtualbox-2.1.1.tar.gz",
    "platform": "cygwin",
    "description": "virtualbox-python\n*****************\n\n.. image:: https://img.shields.io/travis/sethmlarson/virtualbox-python/master.svg\n   :target: https://travis-ci.org/sethmlarson/virtualbox-python\n\nComplete implementation of VirtualBox's COM API with a Pythonic interface.\n\nInstallation\n============\n\nGo to VirtualBox's downloads page (https://www.virtualbox.org/wiki/Downloads) and download the VirtualBox SDK.\nWithin the extracted ZIP file there is a directory called \"installer\". Open a console within the installer directory\nand run ``python vboxapisetup.py install`` using your system Python. This installs ``vboxapi`` which is the interface\nthat talks to VirtualBox via COM.\n\nNext is to install this library:\n\nTo get the latest released version of virtualbox from PyPI run the following::\n\n    $ python -m pip install virtualbox\n\nor to install the latest development version from GitHub::\n\n    $ git clone https://github.com/sethmlarson/virtualbox-python\n    $ cd virtualbox-python\n    $ python setup.py install\n\nGetting Started \n===============\n\nListing Available Machines\n--------------------------\n\n .. code-block::\n\n    >>> import virtualbox\n    >>> vbox = virtualbox.VirtualBox()\n    >>> [m.name for m in vbox.machines]\n    [\"windows\"]\n\nLaunching a Machine\n-------------------\n\n  .. code-block::\n\n    >>> session = virtualbox.Session()\n    >>> machine = vbox.find_machine(\"windows\")\n    >>> # progress = machine.launch_vm_process(session, \"gui\", \"\")\n    >>> # For virtualbox API 6_1 and above (VirtualBox 6.1.2+), use the following:\n    >>> progress = machine.launch_vm_process(session, \"gui\", [])\n    >>> progress.wait_for_completion()\n\nQuerying the Machine\n--------------------\n\n .. code-block::\n\n    >>> session.state\n    SessionState(2)  # locked\n    >>> machine.state\n    MachineState(5)  # running\n    >>> height, width, _, _, _, _ = session.console.display.get_screen_resolution()\n\nInteracting with the Machine\n----------------------------\n\n .. code-block::\n\n    >>> session.console.keyboard.put_keys(\"Hello, world!\")\n    >>> guest_session = session.console.guest.create_session(\"Seth Larson\", \"password\")\n    >>> guest_session.directory_exists(\"C:\\\\Windows\")\n    True\n    >>> proc, stdout, stderr = guest_session.execute(\"C:\\\\\\\\Windows\\\\System32\\\\cmd.exe\", [\"/C\", \"tasklist\"])\n    >>> print(stdout)\n    Image Name                   PID Session Name     Session#    Mem Usage\n    ========================= ====== ================ ======== ============\n    System Idle Process            0 Console                 0         28 K\n    System                         4 Console                 0        236 K\n    smss.exe                     532 Console                 0        432 K\n    csrss.exe                    596 Console                 0      3,440 K\n    winlogon.exe                 620 Console                 0      2,380 K\n    services.exe                 664 Console                 0      3,780 K\n    lsass.exe                    676 Console                 0      6,276 K\n    VBoxService.exe              856 Console                 0      3,972 K\n    svchost.exe                  900 Console                 0      4,908 K\n    svchost.exe                 1016 Console                 0      4,264 K\n    svchost.exe                 1144 Console                 0     18,344 K\n    svchost.exe                 1268 Console                 0      2,992 K\n    svchost.exe                 1372 Console                 0      3,948 K\n    spoolsv.exe                 1468 Console                 0      4,712 K\n    svchost.exe                 2000 Console                 0      3,856 K\n    wuauclt.exe                  400 Console                 0      7,176 K\n    alg.exe                     1092 Console                 0      3,656 K\n    wscntfy.exe                 1532 Console                 0      2,396 K\n    explorer.exe                1728 Console                 0     14,796 K\n    wmiprvse.exe                1832 Console                 0      7,096 K\n    VBoxTray.exe                1940 Console                 0      3,196 K\n    ctfmon.exe                  1948 Console                 0      3,292 K\n    cmd.exe                     1284 Console                 0      2,576 K\n    tasklist.exe                 124 Console                 0      4,584 K\n\nRegistering Event Handlers\n--------------------------\n\n .. code-block::\n\n    >>> def test(event):\n    >>>    print(\"scancode received: %r\" % event.scancodes)\n    >>>\n    >>> session.console.keyboard.set_on_guest_keyboard(test)\n    140448201250560\n    scancode received: [35]\n    scancode received: [23]\n    scancode received: [163]\n    scancode received: [151]\n    scancode received: [57]\n\nPowering-Down a Machine\n-----------------------\n\n  .. code-block::\n\n    >>> session.console.power_down()\n\nLicense\n=======\n\nApache-2.0\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Complete implementation of VirtualBox's COM API with a Pythonic interface",
    "version": "2.1.1",
    "project_urls": {
        "Homepage": "https://github.com/sethmlarson/virtualbox-python"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cdeabb32234710d4ad61782a30dc28c45baaa0e769ffe6a6162662b36545a1e5",
                "md5": "e28057ff3cc048c37ab320609bedd05c",
                "sha256": "158a7e278b0a88bf3a9405131d79f569f2465270428914734573080d79b51dfc"
            },
            "downloads": -1,
            "filename": "virtualbox-2.1.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e28057ff3cc048c37ab320609bedd05c",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 275265,
            "upload_time": "2020-10-26T19:16:14",
            "upload_time_iso_8601": "2020-10-26T19:16:14.506779Z",
            "url": "https://files.pythonhosted.org/packages/cd/ea/bb32234710d4ad61782a30dc28c45baaa0e769ffe6a6162662b36545a1e5/virtualbox-2.1.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83ba9253ee4b2a08d2868d163afbf8085cf70807368abbe630cbb133a1b25a02",
                "md5": "cf0ad29269f16c40c7011621ab682912",
                "sha256": "2950f181ce06d249dd35aec364753318377c2f2c9e9d9382d7fcbc4ccce4e0f6"
            },
            "downloads": -1,
            "filename": "virtualbox-2.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "cf0ad29269f16c40c7011621ab682912",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 284354,
            "upload_time": "2020-10-26T19:16:17",
            "upload_time_iso_8601": "2020-10-26T19:16:17.350780Z",
            "url": "https://files.pythonhosted.org/packages/83/ba/9253ee4b2a08d2868d163afbf8085cf70807368abbe630cbb133a1b25a02/virtualbox-2.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-10-26 19:16:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sethmlarson",
    "github_project": "virtualbox-python",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "virtualbox"
}
        
Elapsed time: 0.27466s