A Python module for sandboxing code execution.
Project description
PyJail
PyJail is a Python module designed to provide a secure environment for executing untrusted code. PyJail is available on PyPI.
pip install PyJail
To execute a function without access to your system, call it through PyJail as shown below.
from pyjail import Jail
with Jail() as jail:
result = jail.execute(untrusted_func, *func_args, **func_kwargs)
The Jail class constructor has the optional parameters path=os.path.join(os.getcwd(), "jail") and clear_before_create=True. The path parameter specifies the directory where the jail will be created (note that this is a transient directory that will be deleted when the Jail object is destroyed) and the clear_before_create parameter specifies whether the jail directory should be cleared before creation (if it already exists).
[!NOTE] You must run your python script as root to create a jail.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file PyJail-0.1.1.tar.gz.
File metadata
- Download URL: PyJail-0.1.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b63a2df02231fc21541ac1dcb6f2c1980019cb1a3f84ee43e70a483abbe68f7a
|
|
| MD5 |
1d34b1637ff46b69f0d07c403b29cc85
|
|
| BLAKE2b-256 |
bec40cad25749c116ffc6ef3909bffea1036922c2742dfd820f4553f3e402a53
|
File details
Details for the file PyJail-0.1.1-py3-none-any.whl.
File metadata
- Download URL: PyJail-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04de4b19a1e8773af60b0a76c031d52191c43640cdb3e8483c51223de5ef2f6f
|
|
| MD5 |
431080bb939571235f3d2a7d83fe8a6e
|
|
| BLAKE2b-256 |
39464b71780c744dc240fb425977862a8c36ca28e36cf972fd6c85e227c268f1
|