Skip to content

Commit

Permalink
feat(checker): add dmidecode checker (#2997)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
  • Loading branch information
ffontaine committed Jun 1, 2023
1 parent 9fc71f1 commit 393d239
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions cve_bin_tool/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"dhclient",
"dhcpcd",
"dhcpd",
"dmidecode",
"dnsmasq",
"domoticz",
"dovecot",
Expand Down
20 changes: 20 additions & 0 deletions cve_bin_tool/checkers/dmidecode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (C) 2023 Orange
# SPDX-License-Identifier: GPL-3.0-or-later


"""
CVE checker for dmidecode
https://www.cvedetails.com/product/138316/Nongnu-Dmidecode.html?vendor_id=6788
"""
from __future__ import annotations

from cve_bin_tool.checkers import Checker


class DmidecodeChecker(Checker):
CONTAINS_PATTERNS: list[str] = []
FILENAME_PATTERNS: list[str] = []
VERSION_PATTERNS = [r"([0-9]+\.[0-9]+)\r?\n(?:# |)dmidecode"]
VENDOR_PRODUCT = [("nongnu", "dmidecode")]
Binary file not shown.
Binary file not shown.
Binary file not shown.
27 changes: 27 additions & 0 deletions test/test_data/dmidecode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (C) 2023 Orange
# SPDX-License-Identifier: GPL-3.0-or-later

mapping_test_data = [
{"product": "dmidecode", "version": "3.5", "version_strings": ["3.5\ndmidecode"]},
{"product": "dmidecode", "version": "3.0", "version_strings": ["3.0\n# dmidecode"]},
]
package_test_data = [
{
"url": "http://rpmfind.net/linux/opensuse/tumbleweed/repo/oss/x86_64/",
"package_name": "dmidecode-3.5-2.1.x86_64.rpm",
"product": "dmidecode",
"version": "3.5",
},
{
"url": "http://ftp.fr.debian.org/debian/pool/main/d/dmidecode/",
"package_name": "dmidecode_3.0-4_amd64.deb",
"product": "dmidecode",
"version": "3.0",
},
{
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
"package_name": "dmidecode_3.2-1_x86_64.ipk",
"product": "dmidecode",
"version": "3.2",
},
]

0 comments on commit 393d239

Please sign in to comment.