Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cve_bin_tool/checkers/bind.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BindChecker(Checker):
VERSION_PATTERNS = [
r"version: BIND ([0-9]+\.[0-9]+\.[0-9]+)", # for .rpm, .tgz, etc.
r"(?:lib|/)bind[0-9]*-([0-9]+\.[0-9]+\.[0-9]+)", # for .deb
r"/bind9-([0-9]+\.[0-9]+\.[0-9]+)" # using buildpath if included
r"/bind9-([0-9]+\.[0-9]+\.[0-9]+)", # using buildpath if included
# If you trust the filenames to contain the right version number enable the following regular expressions:
# r"libisc-([0-9]+\.[0-9]+\.[0-9]+)", # for libisc
# r"libisccfg-([0-9]+\.[0-9]+\.[0-9]+)", # for libisccfg
Expand Down
2 changes: 1 addition & 1 deletion cve_bin_tool/checkers/binutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BinutilsChecker(Checker):
# readelf - Displays information from any ELF format object file.
# size - Lists the section sizes of an object or archive file.
# strings - Lists printable strings from files.
r"can't set BFD default target to `%s': %s"
r"can't set BFD default target to `%s': %s",
# strip - Discards symbols.
# windmc - A Windows compatible message compiler.get_ver
# windres - A compiler for Windows resource files.
Expand Down
2 changes: 1 addition & 1 deletion cve_bin_tool/checkers/cups.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class CupsChecker(Checker):
CONTAINS_PATTERNS = [
r"No limit for CUPS-Get-Document defined in policy %s and no suitable template found.",
r"\*%%%%%%%% Created by the CUPS PPD Compiler CUPS v([0-9]+\.[0-9]+\.[0-9]+)"
r"\*%%%%%%%% Created by the CUPS PPD Compiler CUPS v([0-9]+\.[0-9]+\.[0-9]+)",
# Alternate optional contains patterns,
# see https://github.com/intel/cve-bin-tool/tree/main/cve_bin_tool/checkers#helper-script for more details
# r"Unable to edit cupsd.conf files larger than 1MB",
Expand Down
8 changes: 5 additions & 3 deletions cve_bin_tool/data_sources/gad_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,11 @@ def format_data(self, all_cve_entries):
"score": score if vector[0] is not None else "unknown",
"CVSS_version": str(version) if vector[0] is not None else "unknown",
"CVSS_vector": vector if vector[0] is not None else "unknown",
"last_modified": cve_item["date"]
if cve_item.get("date", None)
else cve_item["pubdate"],
"last_modified": (
cve_item["date"]
if cve_item.get("date", None)
else cve_item["pubdate"]
),
}

severity_data.append(cve)
Expand Down
16 changes: 10 additions & 6 deletions cve_bin_tool/data_sources/nvd_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ def format_data(self, all_cve_entries):
"score": "unknown",
"CVSS_version": "unknown",
"CVSS_vector": "unknown",
"last_modified": cve_item["lastModifiedDate"]
if cve_item.get("lastModifiedDate", None)
else cve_item["publishedDate"],
"last_modified": (
cve_item["lastModifiedDate"]
if cve_item.get("lastModifiedDate", None)
else cve_item["publishedDate"]
),
}
if cve["description"].startswith("** REJECT **"):
# Skip this CVE if it's marked as 'REJECT'
Expand Down Expand Up @@ -226,9 +228,11 @@ def format_data_api2(self, all_cve_entries):
"score": "unknown",
"CVSS_version": "unknown",
"CVSS_vector": "unknown",
"last_modified": cve_item["lastModified"]
if cve_item.get("lastModified", None)
else cve_item["published"],
"last_modified": (
cve_item["lastModified"]
if cve_item.get("lastModified", None)
else cve_item["published"]
),
}
if cve["description"].startswith("** REJECT **"):
# Skip this CVE if it's marked as 'REJECT'
Expand Down
8 changes: 5 additions & 3 deletions cve_bin_tool/data_sources/osv_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ def format_data(self, all_cve_entries):
"score": score if vector is not None else "unknown",
"CVSS_version": version if vector is not None else "unknown",
"CVSS_vector": vector if vector is not None else "unknown",
"last_modified": cve_item["modified"]
if cve_item.get("modified", None)
else cve_item["published"],
"last_modified": (
cve_item["modified"]
if cve_item.get("modified", None)
else cve_item["published"]
),
}

severity_data.append(cve)
Expand Down
8 changes: 4 additions & 4 deletions cve_bin_tool/nvd_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ async def get_nvd_params(
if time_of_last_update:
# Fetch all the updated CVE entries from the modified date. Subtracting 2-minute offset for updating cve entries
if self.api_version == "2.0":
self.params[
"lastModStartDate"
] = self.convert_date_to_nvd_date_api2(
time_of_last_update - timedelta(minutes=2)
self.params["lastModStartDate"] = (
self.convert_date_to_nvd_date_api2(
time_of_last_update - timedelta(minutes=2)
)
)
self.params["lastModEndDate"] = self.convert_date_to_nvd_date_api2(
datetime.now()
Expand Down
18 changes: 9 additions & 9 deletions cve_bin_tool/output_engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,9 @@ def output_pdf(
pdfdoc.paragraph(
"The table given below gives CVE found with there score on different metrics."
)
cve_by_metrics: defaultdict[
Remarks, list[dict[str, str]]
] = defaultdict(list)
cve_by_metrics: defaultdict[Remarks, list[dict[str, str]]] = (
defaultdict(list)
)
col_headings = [
"CVE Number",
"CVSS_version",
Expand Down Expand Up @@ -920,9 +920,9 @@ def generate_sbom(
my_package.set_licenseconcluded(license)
my_package.set_supplier("UNKNOWN", "NOASSERTION")
# Store package data
sbom_packages[
(my_package.get_name(), my_package.get_value("version"))
] = my_package.get_package()
sbom_packages[(my_package.get_name(), my_package.get_value("version"))] = (
my_package.get_package()
)
sbom_relationship.initialise()
sbom_relationship.set_relationship(parent, "DESCRIBES", root_package)
sbom_relationships.append(sbom_relationship.get_relationship())
Expand All @@ -935,9 +935,9 @@ def generate_sbom(
my_package.set_supplier("Organization", product_data.vendor)
my_package.set_licensedeclared(license)
my_package.set_licenseconcluded(license)
sbom_packages[
(my_package.get_name(), my_package.get_value("version"))
] = my_package.get_package()
sbom_packages[(my_package.get_name(), my_package.get_value("version"))] = (
my_package.get_package()
)
sbom_relationship.initialise()
sbom_relationship.set_relationship(
root_package, "DEPENDS_ON", product_data.product
Expand Down
8 changes: 5 additions & 3 deletions cve_bin_tool/output_engine/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,11 @@ def output_html(
vendor=product_info.vendor,
name=product_info.product,
version=product_info.version,
cve_count=0
if cve_data["cves"][0][1] == "UNKNOWN"
else len(cve_data["cves"]),
cve_count=(
0
if cve_data["cves"][0][1] == "UNKNOWN"
else len(cve_data["cves"])
),
severity_analysis=analysis_pie.to_html(
full_html=False, include_plotlyjs=False
),
Expand Down