mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-11 11:42:50 +01:00
Fix #6325 - Prevent XML header from outputting to ossec.conf
This commit is contained in:
@@ -23,7 +23,6 @@ import sys
|
|||||||
import argparse
|
import argparse
|
||||||
import re
|
import re
|
||||||
from lxml import etree as ET
|
from lxml import etree as ET
|
||||||
from xml.dom import minidom
|
|
||||||
from datetime import datetime as dt
|
from datetime import datetime as dt
|
||||||
from datetime import timezone as tz
|
from datetime import timezone as tz
|
||||||
|
|
||||||
@@ -87,12 +86,7 @@ def wazuh_enabled() -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def root_to_str(root: ET.ElementTree) -> str:
|
def root_to_str(root: ET.ElementTree) -> str:
|
||||||
xml_str = ET.tostring(root, encoding='unicode', method='xml').replace('\n', '')
|
return ET.tostring(root, encoding='unicode', method='xml', xml_declaration=False, pretty_print=True)
|
||||||
xml_str = re.sub(r'(?:(?<=>) *)', '', xml_str)
|
|
||||||
xml_str = re.sub(r' -', '', xml_str)
|
|
||||||
xml_str = re.sub(r' -->', ' -->', xml_str)
|
|
||||||
dom = minidom.parseString(xml_str)
|
|
||||||
return dom.toprettyxml(indent=" ")
|
|
||||||
|
|
||||||
|
|
||||||
def add_wl(ip):
|
def add_wl(ip):
|
||||||
|
|||||||
Reference in New Issue
Block a user