ssg.build_cpe module
Common functions for building CPEs
- class ssg.build_cpe.CPEALCheckFactRef(obj)[source]
Bases:
Symbol
- static get_base_name_of_parametrized_cpe_id(cpe_id)[source]
If given a parametrized platform name such as package[test], it returns the package part only.
- ns = 'http://cpe.mitre.org/language/2.0'
- prefix = 'cpe-lang'
- class ssg.build_cpe.CPEALLogicalTest(*args)[source]
Bases:
Function
- ns = 'http://cpe.mitre.org/language/2.0'
- prefix = 'cpe-lang'
- class ssg.build_cpe.CPEItem(id_)[source]
Bases:
XCCDFEntity
,Templatable
Represents the cpe-item element from the CPE standard.
- KEYS = {'ansible_conditional': <function CPEItem.<lambda>>, 'args': <function CPEItem.<lambda>>, 'bash_conditional': <function CPEItem.<lambda>>, 'check_id': <function CPEItem.<lambda>>, 'definition_location': <function XCCDFEntity.<lambda>>, 'id_': <function XCCDFEntity.<lambda>>, 'is_product_cpe': <function CPEItem.<lambda>>, 'name': <function CPEItem.<lambda>>, 'template': <function Templatable.<lambda>>, 'title': <function XCCDFEntity.<lambda>>, 'versioned': <function CPEItem.<lambda>>}
- MANDATORY_KEYS = ['name']
- property cpe_oval_def_id
- property cpe_oval_short_def_id
- ns = 'http://cpe.mitre.org/dictionary/2.0'
- prefix = 'cpe-dict'
- class ssg.build_cpe.CPEList[source]
Bases:
object
Represents the cpe-list element from the CPE standard.
- ns = 'http://cpe.mitre.org/dictionary/2.0'
- prefix = 'cpe-dict'
- class ssg.build_cpe.ProductCPEs[source]
Bases:
object
Reads from the disk all the yaml CPEs related to a product and provides them in a structured way.
- ssg.build_cpe.extract_env_obj(objects, local_var)[source]
From a collection of objects, return the object with id matching the object_ref of the local variable.
NOTE: This assumes that a local variable can only reference one object. Which is not true, variables can reference multiple objects. But this assumption should work for OVAL checks for CPEs, as they are not that complicated.
- ssg.build_cpe.extract_referred_nodes(tree_with_refs, tree_with_ids, attrname)[source]
Return the elements in tree_with_ids which are referenced from tree_with_refs via the element attribute ‘attrname’.
- ssg.build_cpe.extract_subelement(objects, sub_elem_type)[source]
From a collection of element objects, return the value of the first attribute of name sub_elem_type found.
This is useful when the object is a single element and we wish to query some external reference identifier in the subtree of that element.