Signed-off-by: Jeffrey Blank <[email protected]>
---
 RHEL6/transforms/cpe_generate.py          |    5 +++--
 RHEL6/transforms/relabelids.py            |    9 +++++----
 RHEL6/transforms/xccdf-ocilcheck2ref.xslt |    2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/RHEL6/transforms/cpe_generate.py b/RHEL6/transforms/cpe_generate.py
index dcc1448..e33cf8b 100755
--- a/RHEL6/transforms/cpe_generate.py
+++ b/RHEL6/transforms/cpe_generate.py
@@ -91,12 +91,13 @@ def main():
        translator = idtranslate.idtranslator("./output/"+idname+".ini", idname)
        ovaltree = translator.translate(ovaltree)
 
-       newovalfile = ovalfile.replace("oval", "cpe-oval-"+idname)
+       newovalfile = ovalfile.replace("oval", "cpe-oval")
+       newovalfile = newovalfile.replace("unlinked", idname)
        ET.ElementTree(ovaltree).write(newovalfile)
 
        # replace and sync IDs, href filenames in input cpe dictionary file
        cpedicttree = parse_xml_file(cpedictfile)
-       newcpedictfile = 
os.path.basename(cpedictfile).replace(".xml","-"+idname+".xml")
+       newcpedictfile = idname + "-" + os.path.basename(cpedictfile)
        for check in cpedicttree.findall(".//{%s}check" % cpe_ns):
                check.set("href",os.path.basename(newovalfile))
                check.text = translator.assign_id("{" + oval_ns + 
"}definition", check.text)    
diff --git a/RHEL6/transforms/relabelids.py b/RHEL6/transforms/relabelids.py
index 7068437..ad56fb5 100755
--- a/RHEL6/transforms/relabelids.py
+++ b/RHEL6/transforms/relabelids.py
@@ -4,11 +4,12 @@ import sys, os
 import idtranslate
 import lxml.etree as ET
 
-# This script requires two arguments: an XCCDF file and an ID name scheme.
+# This script requires two arguments: an "unlinked" XCCDF file and an ID name 
scheme.
 # This script is designed to convert and synchronize check IDs referenced from
 # the XCCDF document for the supported checksystems, which are currently OVAL
 # and OCIL.  The IDs are to be converted from strings to meaningless numbers.
 
+
 oval_ns = "http://oval.mitre.org/XMLSchema/oval-definitions-5";
 oval_cs = "http://oval.mitre.org/XMLSchema/oval-definitions-5";
 
@@ -64,14 +65,14 @@ def main():
        if ovalfile:
                ovaltree = parse_xml_file(ovalfile) 
                ovaltree = translator.translate(ovaltree, store_defname=True)
-               newovalfile = ovalfile.replace(".xml", "-" + idname + ".xml")
+               newovalfile = ovalfile.replace("unlinked", idname)
                ET.ElementTree(ovaltree).write(newovalfile)
 
        # rename all IDs in the ocil file
        if ocilfile:
                ociltree = parse_xml_file(ocilfile) 
                ociltree = translator.translate(ociltree)
-               newocilfile = ocilfile.replace(".xml", "-" + idname + ".xml")
+               newocilfile = ocilfile.replace("unlinked", idname)
                ET.ElementTree(ociltree).write(newocilfile)
 
        # rename all IDs and file refs in the xccdf file
@@ -98,7 +99,7 @@ def main():
                                newexportname = translator.assign_id("{"+ 
oval_ns + "}variable", checkexport.get("export-name"))
                                checkexport.set("export-name", newexportname) 
 
-       newxccdffile = xccdffile.replace(".xml", "-" + idname + ".xml")
+       newxccdffile = xccdffile.replace("unlinked", idname)
        #ET.dump(xccdftree)
        ET.ElementTree(xccdftree).write(newxccdffile)
        sys.exit(0)
diff --git a/RHEL6/transforms/xccdf-ocilcheck2ref.xslt 
b/RHEL6/transforms/xccdf-ocilcheck2ref.xslt
index 396cab1..37c7ab4 100644
--- a/RHEL6/transforms/xccdf-ocilcheck2ref.xslt
+++ b/RHEL6/transforms/xccdf-ocilcheck2ref.xslt
@@ -19,7 +19,7 @@
        to create a reference name -->
   <xsl:template match="xccdf:check-content">
        <xsl:element name="check-content-ref" 
namespace="http://checklists.nist.gov/xccdf/1.1";>
-               <xsl:attribute name="href">rhel6-ocil.xml</xsl:attribute>
+               <xsl:attribute 
name="href">unlinked-rhel6-ocil.xml</xsl:attribute>
                <xsl:attribute name="name"><xsl:value-of 
select="../../@id"/>_ocil</xsl:attribute>
        </xsl:element>
   </xsl:template>
-- 
1.7.1

_______________________________________________
scap-security-guide mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide

Reply via email to