pygrype


Namepygrype JSON
Version 0.3.2 PyPI version JSON
download
home_pageNone
SummaryPython wrapper for Grype
upload_time2024-04-16 09:37:11
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License
keywords anchore grype security
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyGrype

![PyPI](https://img.shields.io/pypi/v/pygrype)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pygrype)
![PyPI - License](https://img.shields.io/pypi/l/pygrype)

A python wrapper for [Anchore Grype](https://github.com/anchore/grype)

## Status
Supported commands

- [ ] ~~completion~~
- [x] db
    - [ ] check
    - [x] delete
    - [ ] diff
    - [ ] import
    - [x] list
    - [ ] status
    - [x] update
- [ ] ~~help~~
- [x] scan
- [x] version

## Getting started
### Prerequisites
PyGrype relies on an existing grype binary. [Install grype following the official instructions](https://github.com/anchore/grype#installation).

### Installation
install using `pip`
```bash
pip install pygrype
```

## Usage
Instantiate `Grype` using the default path
```python3
from pygrype import Grype
grype = Grype()
```
or specify the binary
```python3
from pygrype import Grype
grype = Grype(path='/opt/grype')
```

## Full example
```python3
from pygrype import Grype

grype = Grype()

version_info = grype.version()

print(f'Using grype {version_info.version}')

images = [
    'alpine:3.12',
    'ubuntu:18.04',
    'debian:9'
]

for image in images:
    scan = grype.scan(image)
    criticals = len(list(filter(lambda x: x.vulnerability.severity.lower() == 'critical', scan.matches)))
    print(f'{image} has {len(scan.matches)} vulnerabilities ({criticals} critical)')
```
Example output
```
Using grype 0.62.3
alpine:3.12 has 23 vulnerabilities (3 critical)
ubuntu:18.04 has 18 vulnerabilities (0 critical)
debian:9 has 213 vulnerabilities (23 critical)
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pygrype",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "anchore, grype, security",
    "author": null,
    "author_email": "Albert Simon <simon.albert75@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cb/ea/9647d40ae52d2fa5450f21a90a0bf3929a3f672e153a2e1a703f8cbd3a64/pygrype-0.3.2.tar.gz",
    "platform": null,
    "description": "# PyGrype\n\n![PyPI](https://img.shields.io/pypi/v/pygrype)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pygrype)\n![PyPI - License](https://img.shields.io/pypi/l/pygrype)\n\nA python wrapper for [Anchore Grype](https://github.com/anchore/grype)\n\n## Status\nSupported commands\n\n- [ ] ~~completion~~\n- [x] db\n    - [ ] check\n    - [x] delete\n    - [ ] diff\n    - [ ] import\n    - [x] list\n    - [ ] status\n    - [x] update\n- [ ] ~~help~~\n- [x] scan\n- [x] version\n\n## Getting started\n### Prerequisites\nPyGrype relies on an existing grype binary. [Install grype following the official instructions](https://github.com/anchore/grype#installation).\n\n### Installation\ninstall using `pip`\n```bash\npip install pygrype\n```\n\n## Usage\nInstantiate `Grype` using the default path\n```python3\nfrom pygrype import Grype\ngrype = Grype()\n```\nor specify the binary\n```python3\nfrom pygrype import Grype\ngrype = Grype(path='/opt/grype')\n```\n\n## Full example\n```python3\nfrom pygrype import Grype\n\ngrype = Grype()\n\nversion_info = grype.version()\n\nprint(f'Using grype {version_info.version}')\n\nimages = [\n    'alpine:3.12',\n    'ubuntu:18.04',\n    'debian:9'\n]\n\nfor image in images:\n    scan = grype.scan(image)\n    criticals = len(list(filter(lambda x: x.vulnerability.severity.lower() == 'critical', scan.matches)))\n    print(f'{image} has {len(scan.matches)} vulnerabilities ({criticals} critical)')\n```\nExample output\n```\nUsing grype 0.62.3\nalpine:3.12 has 23 vulnerabilities (3 critical)\nubuntu:18.04 has 18 vulnerabilities (0 critical)\ndebian:9 has 213 vulnerabilities (23 critical)\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Python wrapper for Grype",
    "version": "0.3.2",
    "project_urls": null,
    "split_keywords": [
        "anchore",
        " grype",
        " security"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ea81ecaef1230d9735ffd3a429eddfebfa4898aef5eed1f3e071e2598c7458a",
                "md5": "cf32cf9f01ae57d3f3bb7d7eb9e406db",
                "sha256": "391e501bc0a9516bb4b44fa6894e2652045d89638eb0acf993904dc37650b5d2"
            },
            "downloads": -1,
            "filename": "pygrype-0.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cf32cf9f01ae57d3f3bb7d7eb9e406db",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12570,
            "upload_time": "2024-04-16T09:37:09",
            "upload_time_iso_8601": "2024-04-16T09:37:09.975257Z",
            "url": "https://files.pythonhosted.org/packages/8e/a8/1ecaef1230d9735ffd3a429eddfebfa4898aef5eed1f3e071e2598c7458a/pygrype-0.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbea9647d40ae52d2fa5450f21a90a0bf3929a3f672e153a2e1a703f8cbd3a64",
                "md5": "199b952847bc7f26185b91dcafd7dfa3",
                "sha256": "ebbb93cf80657b36bc4eca8a07fc06d510ebbfdca3ec2fe9a0bbcd63f5e0b5d4"
            },
            "downloads": -1,
            "filename": "pygrype-0.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "199b952847bc7f26185b91dcafd7dfa3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10648,
            "upload_time": "2024-04-16T09:37:11",
            "upload_time_iso_8601": "2024-04-16T09:37:11.891177Z",
            "url": "https://files.pythonhosted.org/packages/cb/ea/9647d40ae52d2fa5450f21a90a0bf3929a3f672e153a2e1a703f8cbd3a64/pygrype-0.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-16 09:37:11",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pygrype"
}
        
Elapsed time: 0.27583s