This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 3.1.0 instead.
Reason given by maintainers: Switched to semantic versioning scheme
PyVAST - VAST Python CLI Wrapper
With pyvast we provide a very minimal python wrapper around the VAST command
line interface. The wrapper features fluent method chaining and works
asynchronously.
All VAST commands can be used with the wrapper. However, the wrapper does not
implement any commands itself. It simply passes all received arguments to the
vast binary. It is hence very easy to make mistakes in form of typos, given
this minimalistic implementation. Please refer to the
vast documentation for details about valid vast
commands.
Installation
Use pip to install the package.
virtualenv --system-site-packages venv
source venv/bin/activate
pip install pyvast
Usage
Commands are simply chained via .-notation. Parameters can be passed as python
keyword arguments. The following examples provide an overview of VAST commands
and the analogous pyvast commands.
- Query for an IP address and return 10 results in JSON
# CLI call vast export --max-event=10 json ':addr == 192.168.1.104'
# python wrapper proc = await vast.export(max_events=10).json("192.167.1.102").exec() stdout, stderr = await proc.communicate() print(stdout)
- Import a Zeek log file
# CLI call vast import zeek --read=/path/to/file
# python wrapper proc = await vast.import_().zeek(read="/path/to/file").exec() stdout, stderr = await proc.communicate() print(stdout)
Module Parameterization
You can use PyVAST as Python module. After installing it via pip, simply
import it normally in your Python application.
from pyvast import VAST
Once imported, there are three optional keyword arguments to instruct PyVAST
with: binary, endpoint, and logger. The binary keyword defaults to
"vast". In case the vast binary is not in your $PATH, set this to the
actual path to the VAST binary. The endpoint keyword refers to the endpoint of
the VAST node (e.g., localhost:42000). Lastly, use the logger keyword to
provide a custom
logging.logger
object for your application.
See also the full example below.
Full Example
The following example shows a minimalistic working example with all required import statements.
#!/usr/bin/env python3
import asyncio
from pyvast import VAST
async def example():
vast = VAST(binary="/opt/tenzir/bin/vast")
await vast.test_connection()
proc = await vast.export(max_events=10).json("192.168.1.103").exec()
stdout, stderr = await proc.communicate()
print(stdout)
asyncio.run(example())
See also the example folder for a demo using pyarrow for data export and a
demo for continuous queries.
Testing
The tests are written with the python
unittest library and its
asynchronous analogon aiounittest.
Install the requirements.txt first to run the tests.
pip install --user -r requirements.txt
python -m unittest discover .
Development
Use the setup.py for local installation of a development setup.
virtualenv --system-site-packages venv # create a virtual env
source venv/bin/activate
python setup.py develop # or python setup.py install
Metadata
Release files for pyvast 2021.9.30
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyvast-2021.9.30.tar.gz | 4.8 kB | Without provenance | Details for pyvast-2021.9.30.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyvast-2021.9.30-py3-none-any.whl | Python 3 | none | any | Details for pyvast-2021.9.30-py3-none-any.whl |
Total release size: 9.9 kB
Release files / pyvast-2021.9.30.tar.gz
| Download URL | pyvast-2021.9.30.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2edb1192dcb6bfe05510000136193199dabe1a11a6e93b7590d00efca8b60e2a
|
|
BLAKE2b-256 checksum How to use checksums |
33467359260bf2556073509aac662f81d751361e35bc0dfef7b16836563b31e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
|
Release files / pyvast-2021.9.30-py3-none-any.whl
| Download URL | pyvast-2021.9.30-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1867612725f46acf278ab66d0a62b65354316f8349633dfff29f9015315b5d81
|
|
BLAKE2b-256 checksum How to use checksums |
b7b80d18a974af7e383ac82fff2eb01c7963be762eacbde303eca47db33c16fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
|
Security for pyvast 2021.9.30
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.