diff --git a/SCAP/Makefile b/SCAP/Makefile index 4c405c4c..5e0a8dfd 100644 --- a/SCAP/Makefile +++ b/SCAP/Makefile @@ -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 diff --git a/scripts/generate_oval.py b/scripts/generate_oval.py index e309526c..40307e68 100755 --- a/scripts/generate_oval.py +++ b/scripts/generate_oval.py @@ -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() \ No newline at end of file