Skip to content

Comments

fix: MatrixGen init method for local sources#221

Open
willbrownecs wants to merge 1 commit intomitre-attack:mainfrom
willbrownecs:fix-matrixgen-local-source
Open

fix: MatrixGen init method for local sources#221
willbrownecs wants to merge 1 commit intomitre-attack:mainfrom
willbrownecs:fix-matrixgen-local-source

Conversation

@willbrownecs
Copy link

Resolves an issue where mitreattack.navlayers.ToSVG raises a value error when initialized with source="local". The issue seems to be due to comparing the expected domain values to resource values instead.

Changes tested with:

import requests
import json
import mitreattack

base_layer_dict = {
        "name": "test",
        "versions": {
            "layer": "4.5",
            "navigator": "5.3.0"
        },
        "sorting": 3, 
        "description": "test",
        "domain": "enterprise-attack",
        "techniques": [],
    }
base_layer = mitreattack.navlayers.Layer(base_layer_dict)
stix = requests.get("https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json", verify=False).json()
with open(file="./stix.json", mode="w") as f:
    json.dump(stix, f)
blah = mitreattack.navlayers.ToSvg(domain="enterprise", source="local", resource="stix.json")
blah.to_svg(layerInit=base_layer, filepath="rule_coverage.svg")

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant