diff --git a/troubadix/standalone_plugins/deprecate_vts.py b/troubadix/standalone_plugins/deprecate_vts.py index 784019f7..8a864056 100644 --- a/troubadix/standalone_plugins/deprecate_vts.py +++ b/troubadix/standalone_plugins/deprecate_vts.py @@ -30,7 +30,7 @@ class DeprecatedFile: # CHANGE AS NEEDED -FILENAME_REGEX = re.compile(r"gb_rhsa_2021") +FILENAME_REGEX = re.compile(r"gb_rhsa_2020") KB_ITEMS = re.compile(r"set_kb_item\(.+\);") @@ -55,9 +55,10 @@ def update_summary(file: DeprecatedFile, oid_mapping_path: Path = None) -> str: else: deprecate_text = "This VT has been deprecated." - summary = get_summary(file.content) - if summary: - file.content = deprecate_text + summary + old_summary = get_summary(file.content) + if old_summary: + new_summary = deprecate_text + old_summary + file.content = file.content.replace(old_summary, new_summary) else: print(f"No summary in: {file.name}") @@ -174,21 +175,21 @@ def deprecate( file.content, ) if dependencies: - tags_to_remove += dependencies.group() + tags_to_remove.append(dependencies.group()) udp = re.search( get_special_script_tag_pattern(SpecialScriptTag.REQUIRE_UDP_PORTS), file.content, ) if udp: - tags_to_remove += udp.group() + tags_to_remove.append(udp.group()) man_keys = re.search( get_special_script_tag_pattern(SpecialScriptTag.MANDATORY_KEYS), file.content, ) if man_keys: - tags_to_remove += man_keys.group() + tags_to_remove.append(man_keys.group()) for tag in tags_to_remove: file.content = file.content.replace(tag + "\n", "")