Metadata-Version: 2.4
Name: ptsandbox
Version: 5.0.0
Summary: Async API connector for PT Sandbox instances
Project-URL: Homepage, https://github.com/Security-Experts-Community/py-ptsandbox
Project-URL: Documentation, https://security-experts-community.github.io/py-ptsandbox
Project-URL: Repository, https://github.com/Security-Experts-Community/py-ptsandbox
Project-URL: Issues, https://github.com/Security-Experts-Community/py-ptsandbox/issues
Author: Alexey Kolesnikov, Dmitry Zotov, PT ESC Malware Detection
License-Expression: MIT
License-File: LICENSE
Keywords: ptsandbox,sandbox
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: <4.0,>=3.11
Requires-Dist: aiohttp-socks>=0.10.1
Requires-Dist: aiohttp>=3.11.11
Requires-Dist: loguru>=0.7.3
Requires-Dist: orjson>=3.10.15
Requires-Dist: pydantic>=2.10.5
Description-Content-Type: text/markdown

![Image](https://raw.githubusercontent.com/Security-Experts-Community/py-ptsandbox/refs/heads/main/docs/assets/logo_with_text.svg)

<p align="center">
    <em>Async API connector for PT Sandbox instances</em>
</p>

---

**Documentation**: <a href="https://security-experts-community.github.io/py-ptsandbox">https://security-experts-community.github.io/py-ptsandbox</a>

**Source Code**: <a href="https://github.com/Security-Experts-Community/py-ptsandbox">https://github.com/Security-Experts-Community/py-ptsandbox</a>

---

## Installation

You can use the following command to install the package:

PyPI:

```sh
python3 -m pip install ptsandbox
```

uv:

```
uv add ptsandbox
```

Nix:

```
TBA
```

<p align="middle">
    <img width="50%" src="https://raw.githubusercontent.com/Security-Experts-Community/py-ptsandbox/refs/heads/main/docs/assets/pic_right.svg">
</p>

## Usage

Getting a list of all installed images using the API:

```py
import asyncio
from ptsandbox import Sandbox, SandboxKey

async def main() -> None:
    key = SandboxKey(
        name="test-key-1",
        key="<TOKEN_FROM_SANDBOX>",
        host="10.10.10.10",
    )

    sandbox = Sandbox(key)
    print(await sandbox.api.get_images())

asyncio.run(main())
```

Getting system settings using the UI API:

```py
import asyncio
from ptsandbox import Sandbox, SandboxKey

async def main():
    key = SandboxKey(
        name="test-key-1",
        key="<TOKEN_FROM_SANDBOX>",
        host="10.10.10.10",
        ui=SandboxKey.UI(
            login="login",
            password="password",
        ),
    )

    sandbox = Sandbox(key)
    # You must log in before using the UI API
    await sandbox.ui.authorize()

    print(await sandbox.ui.get_system_settings())

asyncio.run(main())
```
