Created
May 4, 2022 06:24
-
-
Save rdapaz/e1f9e34f8db555b2634a9166f94c1430 to your computer and use it in GitHub Desktop.
DISA STIG Viewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### DISA STIGS standards are distributed in XML and XSLT file pairs. Under IE, it was possible to open the XSLT and then open the XML, where the latter | |
### would be properly formatted. With IE no longer in use, this script can generate the html from a pair. | |
### TODO: Automate so that it generates for all entries in the archived zip (zip of zips) | |
### ----------------------------------------------------------------------------------------------------- | |
from lxml import etree | |
path_xml = 'U_MS_Windows_10_STIG_V2R3_Manual-xccdf.xml' | |
path_xslt = 'STIG_unclass.xsl' | |
dom = etree.parse(path_xml) | |
xslt =etree.parse(path_xslt) | |
transform = etree.XSLT(xslt) | |
newdom = transform(dom) | |
s = etree.tostring(newdom, pretty_print=True) | |
with open('output.html', 'w') as fout: | |
fout.write("".join(chr(c) for c in s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment