pysandboxing


Namepysandboxing JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/libardoram/pysandboxing
SummaryA Python module for sandboxing code with restricted imports and timeout enforcement (Linux/macOS only)
upload_time2025-02-20 10:40:13
maintainerNone
docs_urlNone
authorLibardo Ramirez Tirado
requires_python>=3.6
licenseNone
keywords sandboxing security
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PySandboxing

PySandboxing is a Python module for sandboxing code with restricted imports and timeout enforcement. It prevents the execution of dangerous built-in functions and restricts the import of certain modules to enhance security. Sort of...


## Installation

### From PyPI

```sh
pip install pysandboxing
```

### From Source

To install PySandboxing, clone the repository and run the setup script:

```sh
git clone https://github.com/libardoram/pysandboxing.git
cd pysandboxing
python setup.py install
```

## Example Usage

To use `pysandboxing` in your Python code, simply import the module at the beginning of your script:

```python
import pysandboxing.sandbox  

while True:
 print("This will be stopped after the timeout!")
```


```python
import pysandboxing.sandbox as sandbox

import subprocess

subprocess.run(["ls", "-l"])

```

You can also set an environment variable PYSANDBOX_TIMEOUT to specify the timeout duration in seconds. For example, to set a timeout of 6 seconds:

```sh
export PYSANDBOX_TIMEOUT=6
```

## Features

1. Disables dangerous built-in functions (exec, eval, open).
2. Restricts the import of certain modules to prevent security risks.
3. Enforces a timeout to stop possible infinite loops.

## License
This project is licensed under the MIT License. See the LICENSE file for details.

## Author
Libardo Ramirez Tirado - libar@libardoramirez.com



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/libardoram/pysandboxing",
    "name": "pysandboxing",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "sandboxing security",
    "author": "Libardo Ramirez Tirado",
    "author_email": "libar@libardoramirez.com",
    "download_url": "https://files.pythonhosted.org/packages/15/f0/6408aa9d9bf8a0355247a78e311882dfd157c23a8f155a9ea251f3afd662/pysandboxing-0.1.3.tar.gz",
    "platform": null,
    "description": "# PySandboxing\n\nPySandboxing is a Python module for sandboxing code with restricted imports and timeout enforcement. It prevents the execution of dangerous built-in functions and restricts the import of certain modules to enhance security. Sort of...\n\n\n## Installation\n\n### From PyPI\n\n```sh\npip install pysandboxing\n```\n\n### From Source\n\nTo install PySandboxing, clone the repository and run the setup script:\n\n```sh\ngit clone https://github.com/libardoram/pysandboxing.git\ncd pysandboxing\npython setup.py install\n```\n\n## Example Usage\n\nTo use `pysandboxing` in your Python code, simply import the module at the beginning of your script:\n\n```python\nimport pysandboxing.sandbox  \n\nwhile True:\n print(\"This will be stopped after the timeout!\")\n```\n\n\n```python\nimport pysandboxing.sandbox as sandbox\n\nimport subprocess\n\nsubprocess.run([\"ls\", \"-l\"])\n\n```\n\nYou can also set an environment variable PYSANDBOX_TIMEOUT to specify the timeout duration in seconds. For example, to set a timeout of 6 seconds:\n\n```sh\nexport PYSANDBOX_TIMEOUT=6\n```\n\n## Features\n\n1. Disables dangerous built-in functions (exec, eval, open).\n2. Restricts the import of certain modules to prevent security risks.\n3. Enforces a timeout to stop possible infinite loops.\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Author\nLibardo Ramirez Tirado - libar@libardoramirez.com\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python module for sandboxing code with restricted imports and timeout enforcement (Linux/macOS only)",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/libardoram/pysandboxing"
    },
    "split_keywords": [
        "sandboxing",
        "security"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67c1a02e033dab13c91f0e178459f1abdb17fe400517050d98bc6b1d1df33f39",
                "md5": "a07b3838617ed8f7cb3698c78079fcb2",
                "sha256": "39b8deeb37853987ad15708137bb0e06359b8cc8039ab1c105f9f94bee97d263"
            },
            "downloads": -1,
            "filename": "pysandboxing-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a07b3838617ed8f7cb3698c78079fcb2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4023,
            "upload_time": "2025-02-20T10:40:12",
            "upload_time_iso_8601": "2025-02-20T10:40:12.189037Z",
            "url": "https://files.pythonhosted.org/packages/67/c1/a02e033dab13c91f0e178459f1abdb17fe400517050d98bc6b1d1df33f39/pysandboxing-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15f06408aa9d9bf8a0355247a78e311882dfd157c23a8f155a9ea251f3afd662",
                "md5": "c99f8f453cf13c1d947f72e936b3cc03",
                "sha256": "acbdf3cfd1caba79f0601603b009622f80e4156abf3c64cbf04369ae4180f644"
            },
            "downloads": -1,
            "filename": "pysandboxing-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c99f8f453cf13c1d947f72e936b3cc03",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3527,
            "upload_time": "2025-02-20T10:40:13",
            "upload_time_iso_8601": "2025-02-20T10:40:13.946804Z",
            "url": "https://files.pythonhosted.org/packages/15/f0/6408aa9d9bf8a0355247a78e311882dfd157c23a8f155a9ea251f3afd662/pysandboxing-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-20 10:40:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "libardoram",
    "github_project": "pysandboxing",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pysandboxing"
}
        
Elapsed time: 1.12800s