snyk api的交互式shell接口

snyksh的Python项目详细描述


SNYK外壳

snyk shell为snyk api提供了一个方便的shell接口。你可以 使用任何有效的python表达式,并使用 预先配置的snyk api客户端。当你装上外壳的时候 预先加载组织和项目的列表,以便您有一些数据可供探索。

安装

snyk shell可从pypi获得。使用首选的python依赖项管理工具安装:

pip install snyksh

snyk shell也可用作docker映像。

docker pull garethr/snyksh

配置

为了访问snyk api,您需要提供api令牌。这是用 名为SNYK_TOKEN

的环境变量
export SNYK_TOKEN=<your-token-goes-here>
snyksh
docker run --rm -it -e SNYK_TOKEN=<your-token> garethr/snyksh

用法

运行snyk shell可以与snyk中的数据交互。这包括您的项目 以及更一般的漏洞数据。

这里有几个例子。

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']

snyk api客户端

snyk shell使用snyk python api客户端pysnyk。如果您想构建自己的应用程序 它们与snyk api交互,或者您想知道所有可用的属性和方法 对于您,请参阅客户机文档和示例。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Android Action_Edit Intent无法像以前一样调用App Gallery来编辑图片   确保JRE兼容性的java适当程序(32或64位)   java JSONArray。for循环中的add(JSONObject)正在替换for循环中的旧值,数组由循环中的最后一个值组成   java需要帮助创建一个返回数组的方法,该数组的元素是另一个数组的平方   使用SmbFile w/groovy XmlSluper()创建xml。解析()Java   检查大小后的java ArrayIndexOutOfBoundsException   乘法表中的第k个最小元素   java 401 on请求,其中指定了'permitAll()'   java如何附加ORC文件   java hibernate类模型   java IDEA没有看到由自定义注释处理器生成的方法   Servlet中未声明java SerialVersionId   java linkedlist到达列表末尾时   java如何正确对齐EditText光标?   java 6编译器1.6上的eclipse重写方法错误   java如何在基于Jersey的RESTful Web服务中读取post数据   java如何在活动中正确使用接口?   Java的JIT编译器的工作速度有多快?