(self)
return layers
Return ATT&CK Navigator layers in dict format summarizing detected differences. Returns a dict mapping domain to its layer dict.
Return ATT&CK Navigator layers in dict format summarizing detected differences. Returns a dict mapping domain to its layer dict.
Return ATT&CK Navigator layers in dict format summarizing detected differences . Returns a dict mapping domain to its layer dict .
def get_layers_dict(self):
        """
        Return ATT&CK Navigator layers in dict format summarizing detected differences. Returns a dict mapping domain to its layer dict.
        """

        self.verboseprint("generating layers dict... ", end="", flush="true")

        layers = {}
        thedate = datetime.datetime.today().strftime('%B %Y')
        # for each layer file in the domains mapping
        for domain in self.domains:
            # build techniques list
            techniques = []
            used_statuses = set()
            for status in self.data["technique"][domain]:
                if status == "revocations" or status == "deprecations": continue
                for technique in self.data["technique"][domain][status]:
                    for phase in technique['kill_chain_phases']:
                        techniques.append({
                            "techniqueID": technique['external_references'][0]['external_id'],
                            "tactic": phase['phase_name'],
                            "enabled": True,
                            "color": statusToColor[status],
                            "comment": status[:-1] if status != "unchanged" else status  # trim s off end of word
                        })
                        used_statuses.add(status)

            # build legend based off used_statuses
            legendItems = list(map(lambda status: {"color": statusToColor[status], "label": status + ": " + statusDescriptions[status]}, used_statuses))

            # build layer structure
            layer_json = {
                "versions": {
                    "layer": "4.1",
                    "navigator": "4.1"
                },
                "name": f"{thedate} {domainToDomainLabel[domain]} Updates",
                "description": f"{domainToDomainLabel[domain]} updates for the {thedate} release of ATT&CK",
                "domain": domain,
                "techniques": techniques,
                "sorting": 0,
                "hideDisabled": False,
                "legendItems": legendItems,
                "showTacticRowBackground": True,
                "tacticRowBackground": "#205b8f",
                "selectTechniquesAcrossTactics": True
            }

            layers[domain] = layer_json

        self.verboseprint("done")

        return layers
def get_layers_dict ( self ) : self . verboseprint ( "generating layers dict... " , end = "" , flush = "true" ) layers = { } thedate = datetime . datetime . today ( ) . strftime ( '%B %Y' ) # for each layer file in the domains mapping for domain in self . domains : # build techniques list techniques = [ ] used_statuses = set ( ) for status in self . data [ "technique" ] [ domain ] : if status == "revocations" or status == "deprecations" : continue for technique in self . data [ "technique" ] [ domain ] [ status ] : for phase in technique [ 'kill_chain_phases' ] : techniques . append ( { "techniqueID" : technique [ 'external_references' ] [ 0 ] [ 'external_id' ] , "tactic" : phase [ 'phase_name' ] , "enabled" : True , "color" : statusToColor [ status ] , "comment" : status [ : - 1 ] if status != "unchanged" else status # trim s off end of word } ) used_statuses . add ( status ) # build legend based off used_statuses legendItems = list ( map ( lambda status : { "color" : statusToColor [ status ] , "label" : status + ": " + statusDescriptions [ status ] } , used_statuses ) ) # build layer structure layer_json = { "versions" : { "layer" : "4.1" , "navigator" : "4.1" } , "name" : f"{thedate} {domainToDomainLabel[domain]} Updates" , "description" : f"{domainToDomainLabel[domain]} updates for the {thedate} release of ATT&CK" , "domain" : domain , "techniques" : techniques , "sorting" : 0 , "hideDisabled" : False , "legendItems" : legendItems , "showTacticRowBackground" : True , "tacticRowBackground" : "#205b8f" , "selectTechniquesAcrossTactics" : True } layers [ domain ] = layer_json self . verboseprint ( "done" ) return layers