Skip to main content

Python CLI wrapper for VAST - Visibility Across Space and Time

Reason this release was yanked:

Switched to semantic versioning scheme

Project description

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.

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
    stdout, stderr = vast.export(max_events=10).json("192.167.1.102").exec()
    print(stdout)
    
  • Import a Zeek log file
    # CLI call
    vast import zeek --read=/path/to/file
    
    # python wrapper
    stdout, stderr = vast.import_().zeek(read="/path/to/file").exec()
    print(stdout)
    

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

vast = VAST(binary="/opt/tenzir/bin/vast")
asyncio.run(vast.test_connection())

stdout, stderr = asyncio.run(vast.export(max_events=10).json("192.167.1.102").exec())
print(stdout)

See also the example folder for a demo using pyarrow for data export.

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 .

Installation

Use the setup.py for installation or development setup.

virtualenv --system-site-packages venv # create a virtual env
source venv/bin/activate
python setup.py develop # or python setup.py install

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvast-2020.3.26.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

pyvast-2020.3.26-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file pyvast-2020.3.26.tar.gz.

File metadata

  • Download URL: pyvast-2020.3.26.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for pyvast-2020.3.26.tar.gz
Algorithm Hash digest
SHA256 05e3c1e76fee07bfe629dd924603855d7fa270302916954e1403c7faa48e3084
MD5 cb697cf187d351166d0eb484289c740f
BLAKE2b-256 0693408d7a063a49083388be5b5f28231a2aae832d8e9508b1030d6210f7e783

See more details on using hashes here.

File details

Details for the file pyvast-2020.3.26-py3-none-any.whl.

File metadata

  • Download URL: pyvast-2020.3.26-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for pyvast-2020.3.26-py3-none-any.whl
Algorithm Hash digest
SHA256 83741388070dc62d3984d21f7dbeea5b51aa7a7e28b0ddd7012c4190fa899cbf
MD5 22993dedcb88369a1a45981161addc23
BLAKE2b-256 079688377742ad7b1384189f0bc81d14effe6e8cbc9420d7dd685f70ff90eec9

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