Skip to content

Commit d52c045

Browse files
authored
Merge pull request #236 from oh6hay/openssh-checker
Openssh checker
2 parents d618792 + 58d31bb commit d52c045

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

cve_bin_tool/checkers/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
"libnss",
1111
"png",
1212
"xerces",
13-
"libjpeg" "xerces",
13+
"libjpeg",
14+
"xerces",
1415
"libgcrypt",
1516
"systemd",
1617
"sqlite",
1718
"kerberos",
1819
"icu",
20+
"openssh",
1921
"bluez",
2022
]

cve_bin_tool/checkers/openssh.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/python3
2+
3+
"""
4+
CVE checker for openssh
5+
6+
References:
7+
https://www.cvedetails.com/product/585/Openbsd-Openssh.html?vendor_id=97
8+
"""
9+
from ..util import regex_find
10+
11+
import sys, re
12+
13+
def get_version(lines, filename):
14+
"""
15+
Get the version and return it for OpenSSH server or client
16+
17+
VPkg: openssh
18+
"""
19+
regex = re.compile("OpenSSH_([0-9]+\.[0-9]+[0-9a-z\s]*)")
20+
version_info = dict()
21+
22+
# determine version
23+
for l in lines:
24+
if regex.match(l):
25+
version_info["version"] = regex.match(l).groups()[0]
26+
break # The binary seems to contain many version strings and the
27+
#first one matches the binary in question
28+
29+
if filename in ["scp", "sftp", "ssh", "ssh-add", "ssh-agent", "ssh-argv0", \
30+
"ssh-copy-id", "ssh-keygen", "ssh-keyscan", "slogin"]:
31+
version_info["is_or_contains"] = "is"
32+
version_info["modulename"] = "openssh-client"
33+
elif filename in ["sshd"]:
34+
version_info["is_or_contains"] = "is"
35+
version_info["modulename"] = "openssh-server"
36+
37+
if "is_or_contains" in version_info:
38+
version_info["modulename"] = "openssl"
39+
else:
40+
return dict()
41+
42+
return version_info

0 commit comments

Comments
 (0)