ptsandbox 5.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. ptsandbox-5.0.0/.gitignore +146 -0
  2. ptsandbox-5.0.0/LICENSE +21 -0
  3. ptsandbox-5.0.0/PKG-INFO +108 -0
  4. ptsandbox-5.0.0/README.md +86 -0
  5. ptsandbox-5.0.0/ptsandbox/__init__.py +8 -0
  6. ptsandbox-5.0.0/ptsandbox/config.py +10 -0
  7. ptsandbox-5.0.0/ptsandbox/models/__init__.py +3 -0
  8. ptsandbox-5.0.0/ptsandbox/models/api/__init__.py +36 -0
  9. ptsandbox-5.0.0/ptsandbox/models/api/analysis.py +695 -0
  10. ptsandbox-5.0.0/ptsandbox/models/api/key.py +96 -0
  11. ptsandbox-5.0.0/ptsandbox/models/api/maintenance.py +36 -0
  12. ptsandbox-5.0.0/ptsandbox/models/api/sandbox.py +12 -0
  13. ptsandbox-5.0.0/ptsandbox/models/api/storage.py +25 -0
  14. ptsandbox-5.0.0/ptsandbox/models/core/__init__.py +125 -0
  15. ptsandbox-5.0.0/ptsandbox/models/core/base.py +60 -0
  16. ptsandbox-5.0.0/ptsandbox/models/core/common.py +474 -0
  17. ptsandbox-5.0.0/ptsandbox/models/core/enum.py +598 -0
  18. ptsandbox-5.0.0/ptsandbox/models/ui/__init__.py +76 -0
  19. ptsandbox-5.0.0/ptsandbox/models/ui/artifacts.py +11 -0
  20. ptsandbox-5.0.0/ptsandbox/models/ui/av_engines.py +85 -0
  21. ptsandbox-5.0.0/ptsandbox/models/ui/baqueue.py +181 -0
  22. ptsandbox-5.0.0/ptsandbox/models/ui/cluster.py +151 -0
  23. ptsandbox-5.0.0/ptsandbox/models/ui/common.py +547 -0
  24. ptsandbox-5.0.0/ptsandbox/models/ui/components.py +89 -0
  25. ptsandbox-5.0.0/ptsandbox/models/ui/license.py +168 -0
  26. ptsandbox-5.0.0/ptsandbox/models/ui/scans.py +15 -0
  27. ptsandbox-5.0.0/ptsandbox/models/ui/system.py +540 -0
  28. ptsandbox-5.0.0/ptsandbox/models/ui/tasks.py +104 -0
  29. ptsandbox-5.0.0/ptsandbox/models/ui/tokens.py +31 -0
  30. ptsandbox-5.0.0/ptsandbox/models/ui/tree.py +538 -0
  31. ptsandbox-5.0.0/ptsandbox/py.typed +0 -0
  32. ptsandbox-5.0.0/ptsandbox/sandbox/__init__.py +3 -0
  33. ptsandbox-5.0.0/ptsandbox/sandbox/sandbox.py +622 -0
  34. ptsandbox-5.0.0/ptsandbox/sandbox/sandbox_api.py +460 -0
  35. ptsandbox-5.0.0/ptsandbox/sandbox/sandbox_ui.py +832 -0
  36. ptsandbox-5.0.0/ptsandbox/utils/__init__.py +3 -0
  37. ptsandbox-5.0.0/ptsandbox/utils/async_http_client.py +61 -0
  38. ptsandbox-5.0.0/ptsandbox/utils/diff.py +78 -0
  39. ptsandbox-5.0.0/pyproject.toml +109 -0
@@ -0,0 +1,146 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98
+ __pypackages__/
99
+
100
+ # Celery stuff
101
+ celerybeat-schedule
102
+ celerybeat.pid
103
+
104
+ # SageMath parsed files
105
+ *.sage.py
106
+
107
+ # Environments
108
+ .env
109
+ .venv
110
+ env/
111
+ venv/
112
+ ENV/
113
+ env.bak/
114
+ venv.bak/
115
+
116
+ # Spyder project settings
117
+ .spyderproject
118
+ .spyproject
119
+
120
+ # Rope project settings
121
+ .ropeproject
122
+
123
+ # mkdocs documentation
124
+ /site
125
+
126
+ # mypy
127
+ .mypy_cache/
128
+ .dmypy.json
129
+ dmypy.json
130
+
131
+ # Pyre type checker
132
+ .pyre/
133
+
134
+ # pytype static type analyzer
135
+ .pytype/
136
+
137
+ # Cython debug symbols
138
+ cython_debug/
139
+
140
+ report*json
141
+
142
+ .vscode/
143
+
144
+ result
145
+ .pdm-python
146
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Security Experts Community
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: ptsandbox
3
+ Version: 5.0.0
4
+ Summary: Async API connector for PT Sandbox instances
5
+ Project-URL: Homepage, https://github.com/Security-Experts-Community/py-ptsandbox
6
+ Project-URL: Documentation, https://security-experts-community.github.io/py-ptsandbox
7
+ Project-URL: Repository, https://github.com/Security-Experts-Community/py-ptsandbox
8
+ Project-URL: Issues, https://github.com/Security-Experts-Community/py-ptsandbox/issues
9
+ Author: Alexey Kolesnikov, Dmitry Zotov, PT ESC Malware Detection
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ptsandbox,sandbox
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Requires-Python: <4.0,>=3.11
16
+ Requires-Dist: aiohttp-socks>=0.10.1
17
+ Requires-Dist: aiohttp>=3.11.11
18
+ Requires-Dist: loguru>=0.7.3
19
+ Requires-Dist: orjson>=3.10.15
20
+ Requires-Dist: pydantic>=2.10.5
21
+ Description-Content-Type: text/markdown
22
+
23
+ ![Image](https://raw.githubusercontent.com/Security-Experts-Community/py-ptsandbox/refs/heads/main/docs/assets/logo_with_text.svg)
24
+
25
+ <p align="center">
26
+ <em>Async API connector for PT Sandbox instances</em>
27
+ </p>
28
+
29
+ ---
30
+
31
+ **Documentation**: <a href="https://security-experts-community.github.io/py-ptsandbox">https://security-experts-community.github.io/py-ptsandbox</a>
32
+
33
+ **Source Code**: <a href="https://github.com/Security-Experts-Community/py-ptsandbox">https://github.com/Security-Experts-Community/py-ptsandbox</a>
34
+
35
+ ---
36
+
37
+ ## Installation
38
+
39
+ You can use the following command to install the package:
40
+
41
+ PyPI:
42
+
43
+ ```sh
44
+ python3 -m pip install ptsandbox
45
+ ```
46
+
47
+ uv:
48
+
49
+ ```
50
+ uv add ptsandbox
51
+ ```
52
+
53
+ Nix:
54
+
55
+ ```
56
+ TBA
57
+ ```
58
+
59
+ <p align="middle">
60
+ <img width="50%" src="https://raw.githubusercontent.com/Security-Experts-Community/py-ptsandbox/refs/heads/main/docs/assets/pic_right.svg">
61
+ </p>
62
+
63
+ ## Usage
64
+
65
+ Getting a list of all installed images using the API:
66
+
67
+ ```py
68
+ import asyncio
69
+ from ptsandbox import Sandbox, SandboxKey
70
+
71
+ async def main() -> None:
72
+ key = SandboxKey(
73
+ name="test-key-1",
74
+ key="<TOKEN_FROM_SANDBOX>",
75
+ host="10.10.10.10",
76
+ )
77
+
78
+ sandbox = Sandbox(key)
79
+ print(await sandbox.api.get_images())
80
+
81
+ asyncio.run(main())
82
+ ```
83
+
84
+ Getting system settings using the UI API:
85
+
86
+ ```py
87
+ import asyncio
88
+ from ptsandbox import Sandbox, SandboxKey
89
+
90
+ async def main():
91
+ key = SandboxKey(
92
+ name="test-key-1",
93
+ key="<TOKEN_FROM_SANDBOX>",
94
+ host="10.10.10.10",
95
+ ui=SandboxKey.UI(
96
+ login="login",
97
+ password="password",
98
+ ),
99
+ )
100
+
101
+ sandbox = Sandbox(key)
102
+ # You must log in before using the UI API
103
+ await sandbox.ui.authorize()
104
+
105
+ print(await sandbox.ui.get_system_settings())
106
+
107
+ asyncio.run(main())
108
+ ```
@@ -0,0 +1,86 @@
1
+ ![Image](https://raw.githubusercontent.com/Security-Experts-Community/py-ptsandbox/refs/heads/main/docs/assets/logo_with_text.svg)
2
+
3
+ <p align="center">
4
+ <em>Async API connector for PT Sandbox instances</em>
5
+ </p>
6
+
7
+ ---
8
+
9
+ **Documentation**: <a href="https://security-experts-community.github.io/py-ptsandbox">https://security-experts-community.github.io/py-ptsandbox</a>
10
+
11
+ **Source Code**: <a href="https://github.com/Security-Experts-Community/py-ptsandbox">https://github.com/Security-Experts-Community/py-ptsandbox</a>
12
+
13
+ ---
14
+
15
+ ## Installation
16
+
17
+ You can use the following command to install the package:
18
+
19
+ PyPI:
20
+
21
+ ```sh
22
+ python3 -m pip install ptsandbox
23
+ ```
24
+
25
+ uv:
26
+
27
+ ```
28
+ uv add ptsandbox
29
+ ```
30
+
31
+ Nix:
32
+
33
+ ```
34
+ TBA
35
+ ```
36
+
37
+ <p align="middle">
38
+ <img width="50%" src="https://raw.githubusercontent.com/Security-Experts-Community/py-ptsandbox/refs/heads/main/docs/assets/pic_right.svg">
39
+ </p>
40
+
41
+ ## Usage
42
+
43
+ Getting a list of all installed images using the API:
44
+
45
+ ```py
46
+ import asyncio
47
+ from ptsandbox import Sandbox, SandboxKey
48
+
49
+ async def main() -> None:
50
+ key = SandboxKey(
51
+ name="test-key-1",
52
+ key="<TOKEN_FROM_SANDBOX>",
53
+ host="10.10.10.10",
54
+ )
55
+
56
+ sandbox = Sandbox(key)
57
+ print(await sandbox.api.get_images())
58
+
59
+ asyncio.run(main())
60
+ ```
61
+
62
+ Getting system settings using the UI API:
63
+
64
+ ```py
65
+ import asyncio
66
+ from ptsandbox import Sandbox, SandboxKey
67
+
68
+ async def main():
69
+ key = SandboxKey(
70
+ name="test-key-1",
71
+ key="<TOKEN_FROM_SANDBOX>",
72
+ host="10.10.10.10",
73
+ ui=SandboxKey.UI(
74
+ login="login",
75
+ password="password",
76
+ ),
77
+ )
78
+
79
+ sandbox = Sandbox(key)
80
+ # You must log in before using the UI API
81
+ await sandbox.ui.authorize()
82
+
83
+ print(await sandbox.ui.get_system_settings())
84
+
85
+ asyncio.run(main())
86
+ ```
@@ -0,0 +1,8 @@
1
+ """
2
+ Async API connector for PT Sandbox instances
3
+ """
4
+
5
+ from ptsandbox.models import SandboxKey
6
+ from ptsandbox.sandbox import Sandbox
7
+
8
+ __all__ = ["Sandbox", "SandboxKey"]
@@ -0,0 +1,10 @@
1
+ import base64
2
+
3
+ FAKE_NAME = "RESCAN_API.pdf"
4
+
5
+ # not a backdoor)
6
+ # it's just that the sandbox needs some kind of file to perform retro tasks
7
+ # sha256: 174c1ce620fc7c5e2c85a2c42f48a8aa1e772a093a41f1257e1a4aab673e50c4
8
+ FAKE_PDF = base64.b64decode(
9
+ rb"JVBERi0xLjEKJcKlwrHDqwoKMSAwIG9iagogIDw8IC9UeXBlIC9DYXRhbG9nCiAgICAgL1BhZ2VzIDIgMCBSCiAgPj4KZW5kb2JqCgoyIDAgb2JqCiAgPDwgL1R5cGUgL1BhZ2VzCiAgICAgL0tpZHMgWzMgMCBSXQogICAgIC9Db3VudCAxCiAgICAgL01lZGlhQm94IFswIDAgMzAwIDE0NF0KICA+PgplbmRvYmoKCjMgMCBvYmoKICA8PCAgL1R5cGUgL1BhZ2UKICAgICAgL1BhcmVudCAyIDAgUgogICAgICAvUmVzb3VyY2VzCiAgICAgICA8PCAvRm9udAogICAgICAgICAgIDw8IC9GMQogICAgICAgICAgICAgICA8PCAvVHlwZSAvRm9udAogICAgICAgICAgICAgICAgICAvU3VidHlwZSAvVHlwZTEKICAgICAgICAgICAgICAgICAgL0Jhc2VGb250IC9UaW1lcy1Sb21hbgogICAgICAgICAgICAgICA+PgogICAgICAgICAgID4+CiAgICAgICA+PgogICAgICAvQ29udGVudHMgNCAwIFIKICA+PgplbmRvYmoKCjQgMCBvYmoKICA8PCAvTGVuZ3RoIDU1ID4+CnN0cmVhbQogIEJUCiAgICAvRjEgMTggVGYKICAgIDAgMCBUZAogICAgKFBUIFNBTkRCT1ggUkVTQ0FOKSBUagogIEVUCmVuZHN0cmVhbQplbmRvYmoKCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAxOCAwMDAwMCBuIAowMDAwMDAwMDc3IDAwMDAwIG4gCjAwMDAwMDAxNzggMDAwMDAgbiAKMDAwMDAwMDQ1NyAwMDAwMCBuIAp0cmFpbGVyCiAgPDwgIC9Sb290IDEgMCBSCiAgICAgIC9TaXplIDUKICA+PgpzdGFydHhyZWYKNTY1CiUlRU9GCg==" # noqa
10
+ )
@@ -0,0 +1,3 @@
1
+ from ptsandbox.models.api import *
2
+ from ptsandbox.models.core import *
3
+ from ptsandbox.models.ui import *
@@ -0,0 +1,36 @@
1
+ from ptsandbox.models.api.analysis import (
2
+ DebugOptions,
3
+ SandboxAdvancedScanTaskRequest,
4
+ SandboxBaseScanTaskRequest,
5
+ SandboxBaseTaskResponse,
6
+ SandboxCheckTaskRequest,
7
+ SandboxCheckTaskResponse,
8
+ SandboxOptions,
9
+ SandboxOptionsAdvanced,
10
+ SandboxRescanTaskRequest,
11
+ SandboxScanTaskRequest,
12
+ SandboxScanURLTaskRequest,
13
+ )
14
+ from ptsandbox.models.api.key import SandboxKey
15
+ from ptsandbox.models.api.maintenance import CheckHealthResponse, GetVersionResponse
16
+ from ptsandbox.models.api.sandbox import SandboxGetImagesResponse
17
+ from ptsandbox.models.api.storage import SandboxUploadScanFileResponse
18
+
19
+ __all__ = [
20
+ "CheckHealthResponse",
21
+ "DebugOptions",
22
+ "GetVersionResponse",
23
+ "SandboxAdvancedScanTaskRequest",
24
+ "SandboxBaseScanTaskRequest",
25
+ "SandboxBaseTaskResponse",
26
+ "SandboxCheckTaskRequest",
27
+ "SandboxCheckTaskResponse",
28
+ "SandboxGetImagesResponse",
29
+ "SandboxKey",
30
+ "SandboxOptions",
31
+ "SandboxOptionsAdvanced",
32
+ "SandboxRescanTaskRequest",
33
+ "SandboxScanTaskRequest",
34
+ "SandboxScanURLTaskRequest",
35
+ "SandboxUploadScanFileResponse",
36
+ ]