mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-02-03 05:53:24 +00:00
beautified oval and lowercased file name
This commit is contained in:
@@ -40,7 +40,7 @@ XCCDF:
|
||||
SCAP-version=1.3 \
|
||||
id-namespace=content.mscp.nist.gov \
|
||||
benchmark-id-suffix=macOS_${OS} \
|
||||
OVAL-URI=${DIR}/All_rules.xml \
|
||||
OVAL-URI=${DIR}/all_rules.xml \
|
||||
include-CPE=1
|
||||
# the input OVAL document will be copied to a companion of the XCCDF document named 'oval.xml'
|
||||
# a gratuitous OCIL document is provided
|
||||
|
||||
@@ -9,6 +9,7 @@ import re
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
import shutil
|
||||
|
||||
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
|
||||
@@ -38,7 +39,7 @@ def main():
|
||||
except OSError:
|
||||
print(f"Creation of the directory {build_path} failed")
|
||||
print('Profile YAML:', results.baseline.name)
|
||||
print('Output path:', output)
|
||||
print('Output path:', output.lower())
|
||||
|
||||
|
||||
|
||||
@@ -1600,10 +1601,21 @@ def main():
|
||||
final_oval = re.sub('(?=\n\[NOTE\])(?s)(.*)\=\n$.*', '<', total_oval)
|
||||
# final_oval = re.sub('(?=\n\[NOTE\])(?s)(.*)\=\n<', '<', total_oval)
|
||||
|
||||
oval_file = output
|
||||
oval_file = output.lower()
|
||||
|
||||
with open(oval_file,'w') as rite:
|
||||
with open(oval_file + "temp",'w') as rite:
|
||||
rite.write(final_oval)
|
||||
cmd = shutil.which('xmllint')
|
||||
if cmd == None:
|
||||
try:
|
||||
os.rename(oval_file + "temp", oval_file)
|
||||
except:
|
||||
print("Error writing Oval file.")
|
||||
else:
|
||||
cmd = cmd + " " + oval_file + "temp --format --output " + oval_file
|
||||
os.popen(cmd).read()
|
||||
if os.path.exists(oval_file):
|
||||
os.remove(oval_file + "temp")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user