aboutsummaryrefslogtreecommitdiffstats
path: root/english/security
diff options
context:
space:
mode:
authorCarsten Schoenert <c.schoenert@t-online.de>2023-12-02 10:48:52 +0100
committerThomas Lange <lange@debian.org>2023-12-02 16:47:03 +0100
commit7cf91065009e7713c326bab7d56a92e384e8ea18 (patch)
treea51576e7ecda8c0b25894e4120044828a7204814 /english/security
parent3f6686cbdd1e390a31e9018c7603067e98ce3768 (diff)
tracker.py: Transform the date from DSA-DATA match
A complete set of data from the file dsa.data looks like this: [25 Oct 2023] DSA-5535-1 firefox-esr - security update {CVE-2023-5721 CVE-2023-5724 CVE-2023-5725 CVE-2023-5728 CVE-2023-5730 CVE-2023-5732} [bullseye] - firefox-esr 115.4.0esr-1~deb11u1 [bookworm] - firefox-esr 115.4.0esr-1~deb12u1 The first element in the first line is representing the date, here it is '25 Oct 2023'. In the Oval files we want to have a date that is written then as '2023-10-25', we need to transform the regex match.
Diffstat (limited to 'english/security')
-rw-r--r--english/security/oval/oval/parser/tracker.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/english/security/oval/oval/parser/tracker.py b/english/security/oval/oval/parser/tracker.py
index 58c65a2aedb..d64331a962a 100644
--- a/english/security/oval/oval/parser/tracker.py
+++ b/english/security/oval/oval/parser/tracker.py
@@ -10,6 +10,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
"""
import re
+from datetime import datetime
from typing import Any
# Dictionary containing all the regular expressions for scanning the
@@ -90,7 +91,15 @@ def parse_tracker_data(
match = regex.search(line)
if match:
if key == "DSA-DATA":
- dsa_date = match.group(1)
+ # The parsed data in match.group(1) is containing
+ # the date in the format of '27-Aug-2023'.
+ # In the later generated Oval XML-files we want
+ # the date to be in the format of '2023-08-27'.
+ # Thus we need to transform the string into
+ # a different output.
+ dsa_date = str(
+ datetime.strptime(match.group(1), '%d %b %Y')
+ ).split(' ', maxsplit=1)[0]
dsa_number = match.group(2)
dsa_pkg = match.group(3)
dsa_desc = match.group(4)

© 2014-2024 Faster IT GmbH | imprint | privacy policy