Skip to content

Commit fbeab02

Browse files
committed
Added a checker for gnutls
new file: gnutls.py
1 parent 2b335d0 commit fbeab02

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

cve_bin_tool/checkers/gnutls.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python3
2+
"""
3+
CVE checker for GnuTLS
4+
References:
5+
https://www.cvedetails.com/vulnerability-list/vendor_id-72/product_id-4433/GNU-Gnutls.html
6+
"""
7+
from ..util import regex_find
8+
9+
def get_version(lines, filename)
10+
"""
11+
returns version information for gnutls found in given file.
12+
Verfies using the tools gnutls-cli and gnu-serv
13+
Verifies using the libraries libgnutls.so and libgnutls-dane.so
14+
"""
15+
regex = [r"gnutls-cli ([3]+\.[0-9]+\.[0-9]+)"]
16+
regex_2 = [r"gnutls-serv ([3]+\.[0-9]+\.[0-9]+)"]
17+
version_info = dict()
18+
if filename[::-1].startswith(("gnutls-cli")[::-1]):
19+
version_info["is_or_contains"] = "is"
20+
if filename[::-1].startswith(("gnutls-serv")[::-1]):
21+
version_info["is_or_contains"] = "is"
22+
23+
if "is_or_contains" in version_info:
24+
version_info["modulename"] = "gnutls-cli"
25+
version_info["version"] = regex_find(lines, *regex)
26+
elif "is_or_contains" in version_info:
27+
version_info["modulename"] = "gnutls-serv"
28+
version_info["version"] = regex_find(lines, *regex2)
29+
30+
elif "libgnutls.so" in filename:
31+
version_info["is_or_contains"] = "is"
32+
elif "libgnutls-dane.so" in filename:
33+
version_info["is_or_contains"] = "is"
34+
35+
return version_info

0 commit comments

Comments
 (0)