Skip to content

Commit 7b67908

Browse files
committed
Checker for openssh
Tested with a few debian variants (kali, ubuntu)
1 parent 43cc422 commit 7b67908

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

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)