Skip to content

Commit 393d239

Browse files
authored
feat(checker): add dmidecode checker (#2997)
Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 9fc71f1 commit 393d239

File tree

6 files changed

+48
-0
lines changed

6 files changed

+48
-0
lines changed

cve_bin_tool/checkers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"dhclient",
5757
"dhcpcd",
5858
"dhcpd",
59+
"dmidecode",
5960
"dnsmasq",
6061
"domoticz",
6162
"dovecot",

cve_bin_tool/checkers/dmidecode.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (C) 2023 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
5+
"""
6+
CVE checker for dmidecode
7+
8+
https://www.cvedetails.com/product/138316/Nongnu-Dmidecode.html?vendor_id=6788
9+
10+
"""
11+
from __future__ import annotations
12+
13+
from cve_bin_tool.checkers import Checker
14+
15+
16+
class DmidecodeChecker(Checker):
17+
CONTAINS_PATTERNS: list[str] = []
18+
FILENAME_PATTERNS: list[str] = []
19+
VERSION_PATTERNS = [r"([0-9]+\.[0-9]+)\r?\n(?:# |)dmidecode"]
20+
VENDOR_PRODUCT = [("nongnu", "dmidecode")]
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/test_data/dmidecode.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (C) 2023 Orange
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
mapping_test_data = [
5+
{"product": "dmidecode", "version": "3.5", "version_strings": ["3.5\ndmidecode"]},
6+
{"product": "dmidecode", "version": "3.0", "version_strings": ["3.0\n# dmidecode"]},
7+
]
8+
package_test_data = [
9+
{
10+
"url": "http://rpmfind.net/linux/opensuse/tumbleweed/repo/oss/x86_64/",
11+
"package_name": "dmidecode-3.5-2.1.x86_64.rpm",
12+
"product": "dmidecode",
13+
"version": "3.5",
14+
},
15+
{
16+
"url": "http://ftp.fr.debian.org/debian/pool/main/d/dmidecode/",
17+
"package_name": "dmidecode_3.0-4_amd64.deb",
18+
"product": "dmidecode",
19+
"version": "3.0",
20+
},
21+
{
22+
"url": "https://downloads.openwrt.org/releases/packages-19.07/x86_64/packages/",
23+
"package_name": "dmidecode_3.2-1_x86_64.ipk",
24+
"product": "dmidecode",
25+
"version": "3.2",
26+
},
27+
]

0 commit comments

Comments
 (0)