pkeech / stig_parser

A Python module to parse DISA STIG (XCCDF) Files
MIT License
22 stars 10 forks source link

Code is Broken with oscap-podman generated xccdf #30

Open jasonbrianhall opened 2 years ago

jasonbrianhall commented 2 years ago

$ cat stig.py import stig_parser

LOAD XML FILE (OPTIONAL)

import os

with open("xccdf.xml", "r") as fh: raw_file = fh.read()

PARSE XCCDF(XML) to JSON

json_results = stig_parser.convert_xccdf(raw_file)

$ python stig.py Traceback (most recent call last): File "/home/jbhall/software_build/xccdf/stig.py", line 10, in json_results = stig_parser.convert_xccdf(raw_file) File "/home/jbhall/aws3/lib/python3.9/site-packages/stig_parser/stig_parser.py", line 76, in convert_xccdf if isinstance(CONTENT_DICT['Benchmark']['plain-text'], list): KeyError: 'plain-text'

RyanMillerC commented 10 months ago

I'm also experiencing this with an XCCDF XML file created from oscap (no podman). The XML file I have is in XCCDF version 1.2 format.