From 3779e086c8a19caa56140678aecf9560738ecaf4 Mon Sep 17 00:00:00 2001 From: Bob Gendler Date: Thu, 27 Jan 2022 11:43:20 -0500 Subject: [PATCH] added folder check --- scripts/generate_oval.py | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/scripts/generate_oval.py b/scripts/generate_oval.py index 8c22b9c2..41b80c58 100755 --- a/scripts/generate_oval.py +++ b/scripts/generate_oval.py @@ -96,6 +96,9 @@ def main(): if rule_yaml['check'][0] != "/" and "[source,bash]" not in rule_yaml['fix']: print(rule_yaml['id'] + " - Manual Check") continue + if "hint" in rule_yaml['check'] and "dscl" in rule_yaml['check']: + print(rule_yaml['id'] + " - no relevant oval") + continue if "manual" in rule_yaml['tags']: print(rule_yaml['id'] + " - Manual Check") continue @@ -1371,12 +1374,42 @@ def main(): '''.format(rule_yaml['id'],x,key) x += 1 continue + if "/bin/rm" in rule_yaml['fix'] and "/bin/ls" in rule_yaml['check']: + oval_definition = oval_definition + ''' + + + {} + + + {} + + + + + + '''.format(x,rule_yaml['title'],rule_yaml['references']['cce'][0],rule_yaml['id'],rule_yaml['discussion'],rule_yaml['id'],x) + oval_test = oval_test + ''' + + + '''.format(x,rule_yaml['id'],x) + + path = rule_yaml['fix'].split("----")[1].split(" ")[-1] + + oval_object = oval_object + ''' + + {} + + '''.format(x,rule_yaml['id'],path.rstrip()) + + continue + + if "ls" in command[2] or "stat" in command[3].split()[0]: if '/Library/Security/PolicyBanner.rtf' in rule_yaml['check']: oval_definition = oval_definition + ''' - + {} @@ -1413,6 +1446,7 @@ def main(): config_file = str() oval_variable_need = bool() if "grep" in s.split()[3]: + print(s.split()[3]) oval_variable_need = True grep_search = re.search('\((.*?)\)', s).group(1)