[PATCH 3/4] rewrite of combinefixes.py to handle parameters for OpenSCAP remedation generation

Brian Millett bmillett at gmail.com
Mon Jun 3 13:59:31 UTC 2013


On Sun,  2 Jun 2013 15:05:21 -0400
Jeffrey Blank <blank at eclipse.ncsc.mil> wrote:

> 
> Signed-off-by: Jeffrey Blank <blank at eclipse.ncsc.mil>
> ---
>  RHEL6/transforms/combinefixes.py |   97
> +++++++++++++++++--------------------- 1 files changed, 44 insertions(+), 53
> deletions(-)
> 
> diff --git a/RHEL6/transforms/combinefixes.py
> b/RHEL6/transforms/combinefixes.py index f9d8b7f..71fbe6f 100755
> --- a/RHEL6/transforms/combinefixes.py
> +++ b/RHEL6/transforms/combinefixes.py
> @@ -1,58 +1,49 @@
>  #!/usr/bin/python
>  
> -import sys, os 
> -
> -header = '''<fix-content system="urn:xccdf:fix:script:sh"
> xmlns="http://checklists.nist.gov/xccdf/1.1">\n''' -footer =
> '</fix-content>\n' -fixGroupHeader = '''<fix-group id="bash"
> system="urn:xccdf:fix:script:sh"
> xmlns="http://checklists.nist.gov/xccdf/1.1">\n''' -fixGroupFooter =
> '</fix-group>\n' -fixCommonGroupHeader = '''<fix-common-group
> id="bash-common" xmlns="http://checklists.nist.gov/xccdf/1.1">\n'''
> -fixCommonGroupFooter = '</fix-common-group>\n' - -def encode(text):
> -    text = text.replace('&','&amp;')
> -    text = text.replace('>','&gt;')
> -    text = text.replace('<','&lt;')
> -    return text
> +import sys, os, re, lxml.etree as etree

Jeff, this is great!  The lxml.etree is pretty cool.  How do you know or how
to find out about these gems?  I'm really familiar with "cpan" for perl, is
there something similar for python?



-- 
Brian Millett
"Do you not have files on the Vorlons?"
'Absolutely. Very large files. But nothing is in them, of course.'
   -- [ Delenn and Sinclair, "The Gathering"]


More information about the scap-security-guide mailing list