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:
$ python3 -m pip install -U pywinsandbox
If you want to run the latest version of the code, you can install from git:
$ python3 -m pip 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"
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.0.1.tar.gz
(6.8 kB
view hashes)
Built Distribution
Close
Hashes for pywinsandbox-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f2f3f21230bd3a2c2b8f666f72f5016521436cf78fcb82a4558af2493137e22 |
|
MD5 | 374b02fac12a6d8294407ecb35fcda2a |
|
BLAKE2b-256 | 0b6d2190af05d1167aa31b8bca8794cd15585427b6cd0c4a334b173eea3129cb |