ssg.rules module

ssg.rules.applies_to_product(file_name, product)[source]

A OVAL or fix is filtered by product iff product is Falsy, file_name is “shared”, or file_name is product. Note that this does not filter by contents of the fix or check, only by the name of the file.

ssg.rules.find_rule_dirs(base_dir)[source]

Generator which yields all rule directories within a given base_dir, recursively

ssg.rules.find_rule_dirs_in_paths(base_dirs)[source]

Generator which yields all rule directories within a given directories list, recursively

ssg.rules.get_rule_dir_id(path)[source]

Returns the ID of a rule directory; correctly handles being passed either the directory path or the yaml metadata path.

ssg.rules.get_rule_dir_ovals(dir_path, product=None)[source]

Gets a list of OVALs contained in a rule directory. If product is None, returns all OVALs. If product is not None, returns applicable OVALs in order of priority:

{{{ product }}}.xml -> shared.xml

Only returns OVALs which exist.

ssg.rules.get_rule_dir_sces(dir_path, product=None)[source]

Get a list of SCEs contained in a rule directory. If product is None, returns all SCEs. If product is not None, returns applicable SCEs in order of priority:

{{{ product }}}.{{{ ext }}} -> shared.{{{ ext }}}

Only returns SCEs which exist.

ssg.rules.get_rule_dir_yaml(dir_path)[source]

Returns the path to the yaml metadata for a rule directory, regardless of if it exists.

ssg.rules.is_rule_dir(dir_path)[source]

Returns True iff dir_path is a valid rule directory which exists

To be valid, dir_path must exist and be a directory and the file returned by get_rule_dir_yaml(dir_path) must exist.