Skip to main content

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).

The execute method takes an option timeout parameter to specify the maximum time in seconds that the function is allowed to run.

[!NOTE] You must run your python script as root to create a jail.

[!NOTE] PyJail is currently only supported on Linux.

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

PyJail-0.1.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PyJail-0.1.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file PyJail-0.1.2.tar.gz.

File metadata

  • Download URL: PyJail-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for PyJail-0.1.2.tar.gz
Algorithm Hash digest
SHA256 33237bc8146398f5c4f48b673af23310a1179690f12808b630abe722e8caf9fe
MD5 da8f654cc7cf4022c418fcd74b2a98e8
BLAKE2b-256 f6f7422dac296e8cc92d253e60753b6c1462f6977eba8006889dabba0e677e0c

See more details on using hashes here.

File details

Details for the file PyJail-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: PyJail-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for PyJail-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 edda7a6100eb9d239e098e54e5afcf361d0322bbf75659353eebe008760a4aa4
MD5 5dc789dce6555a8961b63b793b318489
BLAKE2b-256 83875a91b4d2fbe36aa14815852b6f14bb76d89f0c076bdf832444dccf6af991

See more details on using hashes here.

Supported by

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