INNER CODE UNIT · Python

has_subtechniques

mitre-attack/attack-scripts · scripts/diff_stix.py:351

    def has_subtechniques(self, sdo, new=False):
        """return true or false depending on whether the SDO has sub-techniques. new determines whether to parse from the new or old data"""
        if new: return len(list(filter(lambda rel: rel["target_ref"] == sdo["id"], self.new_subtechnique_of_rels))) > 0
        else:   return len(list(filter(lambda rel: rel["target_ref"] == sdo["id"], self.old_subtechnique_of_rels))) > 0

    def get_markdown_string(self):
        """
        Return a markdown string summarizing detected differences.
        """
        
        def getSectionList(items, obj_type, section):
            """
            parse a list of items in a section and return a string for the items
            """
            
            # get parents which have children
            childless = list(filter(lambda item: not self.has_subtechniques(item, True) and not ("x_mitre_is_subtechnique" in item and item["x_mitre_is_subtechnique"]), items))
            parents = list(filter(lambda item: self.has_subtechniques(item, True) and not ("x_mitre_is_subtechnique" in item and item["x_mitre_is_subtechnique"]), items))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…