Skip to content

Commit 3a16e76

Browse files
committed
Merge branch 'main' of https://github.com/intel/cve-bin-tool into librsvg
2 parents 9808075 + 9934aed commit 3a16e76

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ For more details, see our [documentation](https://cve-bin-tool.readthedocs.io/en
2424
- [CVE Binary Tool quick start / README](#cve-binary-tool-quick-start--readme)
2525
- [Installing CVE Binary Tool](#installing-cve-binary-tool)
2626
- [Most popular usage options](#most-popular-usage-options)
27+
- [Using the tool offline](#using-the-tool-offline)
2728
- [Finding known vulnerabilities using the binary scanner](#finding-known-vulnerabilities-using-the-binary-scanner)
2829
- [Finding known vulnerabilities in a list of components](#finding-known-vulnerabilities-in-a-list-of-components)
2930
- [Scanning an SBOM file for known vulnerabilities](#scanning-an-sbom-file-for-known-vulnerabilities)
@@ -50,6 +51,10 @@ You can also do `pip install --user -e .` to install a local copy which is usefu
5051

5152
## Most popular usage options
5253

54+
## Using the tool offline
55+
56+
Specifying the `--offline` option when running a scan ensures that cve-bin-tool doesn't attempt to download the latest database files or to check for a newer version of the tool.
57+
5358
### Finding known vulnerabilities using the binary scanner
5459

5560
To run the binary scanner on a directory or file:
@@ -173,8 +178,6 @@ in the terminal and provide it as an input by running `cve-bin-tool -L pkg-list`
173178
You can use `--config` option to provide configuration file for the tool. You can still override options specified in config file with command line arguments. See our sample config files in the
174179
[test/config](https://github.com/intel/cve-bin-tool/blob/main/test/config/)
175180

176-
Specifying the `--offline` option when running a scan ensures that cve-bin-tool doesn't attempt to download the latest database files or to check for a newer version of the tool.
177-
178181
## Using CVE Binary Tool in Github Actions
179182

180183
If you want to integrate cve-bin-tool as a part of your github action pipeline.

cve_bin_tool/cve_scanner.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
from collections import defaultdict
99
from logging import Logger
1010
from string import ascii_lowercase
11-
from typing import DefaultDict, Dict, List
11+
from typing import DefaultDict, Dict, List, Tuple, Union
1212

13-
from pkg_resources import parse_version
13+
from packaging.version import LegacyVersion, Version
14+
from packaging.version import parse as parse_version
1415
from rich.console import Console
1516

1617
from cve_bin_tool.cvedb import DBNAME, DISK_LOCATION_DEFAULT
@@ -251,10 +252,14 @@ def openssl_convert(self, version: str) -> str:
251252
version = f"{version[:-1]}.{self.ALPHA_TO_NUM[last_char]}"
252253
return version
253254

254-
def canonical_convert(self, product_info: ProductInfo) -> str:
255-
version_between = ""
255+
VersionType = Union[Version, LegacyVersion]
256+
257+
def canonical_convert(
258+
self, product_info: ProductInfo
259+
) -> Tuple[VersionType, VersionType]:
260+
version_between = parse_version("")
256261
if product_info.version == "":
257-
return product_info.version, version_between
262+
return parse_version(product_info.version), version_between
258263
if product_info.product == "openssl":
259264
pv = re.search(r"\d[.\d]*[a-z]?", product_info.version)
260265
version_between = parse_version(self.openssl_convert(pv.group(0)))

0 commit comments

Comments
 (0)