Skip to main content

Python Utilities for Windows Sandbox

Project description

PyWinSandbox

Python Windows Sandbox library. Create a new Windows Sandbox machine, control it with a simple RPyC interface.

A good usage for this library would be to easily run sandboxed tests in a controlled envionment.

Quick Start

PyWinSandbox can be installed using pip:

$ pip3 install -U pywinsandbox

If you want to run the latest version of the code, you can install from git:

$ pip3 install -U git+git://github.com/karkason/pywinsandbox.git

Note that the Windows Sandbox should be enabled in your system in order to use PyWinSandbox. See the following Microsoft article on how to do that.

Examples

import winsandbox

sandbox = winsandbox.new_sandbox()
sandbox.rpyc.modules.subprocess.run('explorer .')

# Create a sandbox with a mapped directory.
# Directories are mapped under desktop.
sandbox = winsandbox.new_sandbox(folder_mappers=[winsandbox.FolderMapper(r'C:\users\public')])
tree = sandbox.rpyc.modules.subprocess.check_output(r'cmd /c tree %userprofile%\Desktop\public')

# Create an offline sandbox with a logon script.
sandbox = winsandbox.new_sandbox(networking=False, logon_script="explorer .")

Also a console script is available:

# wsb / winsandbox are aliases

# Create an interactive sandbox session. Spawns an IPython shell.
wsb -i

# Spawn an "offline" Windows Sandbox instance, with a command line.
wsb -s "explorer C:\windows\system32" 

Windows Shell Extension

A shell extension is also available to easily sandbox executables with the right click menu:

Shell Extension

# Run these commands with Administrator privileges

# Register the shell extension
wsb -r
# Unregister the shell extension
wsb -u

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywinsandbox-1.4.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

pywinsandbox-1.4.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pywinsandbox-1.4.0.tar.gz.

File metadata

  • Download URL: pywinsandbox-1.4.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pywinsandbox-1.4.0.tar.gz
Algorithm Hash digest
SHA256 bb4c834eeb14f4c55f6a24b294b36f55995052f496b770bb85e49904c9db52fd
MD5 5f3adb7e0da6d71287f2020014a255d6
BLAKE2b-256 7107bef04ca322a409c591c3fcc1cb068e874b19ade5276f8264a50b11f1e2f3

See more details on using hashes here.

File details

Details for the file pywinsandbox-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: pywinsandbox-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for pywinsandbox-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 697894316e29b8dd49d1f1c4ca8ac5d8cccf35a5c7f19b394d024640d06e76fc
MD5 3417a3528258ccf14dc5ab265cac356c
BLAKE2b-256 4b03c516c1caecbca5afc02bd682d7093cc98242f251f98330793c78a5ff115f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page