Skip to main content

An interactive shell interface for the Snyk API

Project description

Snyk Shell

Snyk Shell provides a convenient shell interface to the Snyk API. You can use any valid Python expression as well as make calls to the Snyk API using the pre-configured Snyk API client. When you load the the shell it will pre-load a list of your organizations and projects so you have some data to explore.

Installation

Snyk Shell is available from PyPi. Use your prefered Python dependency management tool to install:

pip install snyksh

Snyk Shell is also available as a Docker image.

docker pull garethr/snyksh

Configuration

In order to access the Snyk API you need to provide your API token. This is done using an environment variable called SNYK_TOKEN:

export SNYK_TOKEN=<your-token-goes-here>
snyksh
docker run --rm -it -e SNYK_TOKEN=<your-token> garethr/snyksh

Usage

With Snyk Shell running you can interact with data in Snyk. This includes your projects as well as vulnerability data more generally.

Here's a few examples.

Welcome to Snyk Shell

The following objects and methods are currently available:
  client - An instance of the Snyk client, which can be used to make requests to the API
  organizations - A prepopulated list of the Snyk organizations you are a member of
  projects - A prepopulated list of all of your Snyk projects
  pprint() - A pretty printer for objects returns by the API


In [1]: organizations
Out[1]: [Organization(name='garethr', id='<not-the-read-organization-id>', group=None)]

In [2]: pprint(organizations)
[
    snyk.models.Organization(
        name='garethr',
        id='<not-the-real-organization-id>'
    )
]

In [3]: results = client.organizations.first().test_python("django", "2.0.0")

In [4]: len(results.issues.vulnerabilities)
Out[4]: 6

In [5]: [x.identifiers["CVE"][0] for x in results.issues.vulnerabilities]
Out[5]:
['CVE-2019-6975',
 'CVE-2018-7536',
 'CVE-2018-7537',
 'CVE-2018-6188',
 'CVE-2018-14574',
 'CVE-2019-3498']

The Snyk API client

Snyk Shell uses the Snyk Python API client pysnyk. If you want to build your own applications which interact with the Snyk API, or you want to know all of the properties and methods avaiable to you, see the client documentation and examples.

Project details


Download files

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

Source Distribution

snyksh-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

snyksh-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file snyksh-0.1.0.tar.gz.

File metadata

  • Download URL: snyksh-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/3.7.3 Darwin/18.6.0

File hashes

Hashes for snyksh-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8cb3d24fefb79f3a22d8267fffb8b86bf2bb463312202ac4b08928bf05d9d25f
MD5 5dde250893d2ce2eb21f522d60cd691f
BLAKE2b-256 77f818b398d85e8e079ce88f135f9a280709848a3bf0d1b0e86be50c713170d7

See more details on using hashes here.

File details

Details for the file snyksh-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: snyksh-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.16 CPython/3.7.3 Darwin/18.6.0

File hashes

Hashes for snyksh-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 707fabec1f33bfc0ce2856addb4d81e05a01640d508d9bc92e9224a21cb2214f
MD5 b49c0a0971eb51fc5f7d2ceddd9759c0
BLAKE2b-256 c2576b042f361b7db864d948f8a65b4f8237fce684f390018a5368309444f378

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page