mitre-attack/mitreattack-python

[Request] tacticBackground support for SVGConfig

xg5-simon opened this issue · 2 comments

Is your feature request related to a problem?

Add tacticBackground and showTacticBackground as parameter options when using SVGConfig

Describe the solution you'd like

Add tacticBackground and showTacticBackground as a supported parameter options when using SVGConfig to export a layer as an SVG.

These values are defined in the layer json. Though they seem to be ignored / not implemented in the SVG conversion. Defining these in the layer json and using the ATT&CK Nav to export to SVG works as expected.

"showTacticRowBackground": true,
"tacticRowBackground": "#205b8f"

Example export using the script:
export_from_script

Example export using ATT&CK Nav:
export_from_navigator

Adding code and JSON layer file to recreate the issue.

lay = Layer()
lay.from_file("example_layer.json")
svgconf = SVGConfig(width=12, height=12, headerHeight=1, unit="in", showSubtechniques="expanded",
                    font="sans-serif", tableBorderColor="#6B7279", showHeader=False, legendDocked=True,
                    legendX=0, legendY=0, legendWidth=2, legendHeight=1, showLegend=False, showFilters=False,
                    showAbout=False, showDomain=False, border=0.104)
t = ToSvg(domain=lay.layer.domain, source='taxii', config=svgconf)
t.to_svg(layerInit=lay, filepath="../reports/mitreheatmap.svg")

JSON Layer: example_layer.zip

Looks like the reason is that there are no cells created under the Tactic text.

text = Text(ctype="TacticName", font_size=font_size, text=displayStr, position="middle")

Could implement another method similar to _block to create the necessary objects for the tactic row... maybe?

def _block(technique, height, width, tBC):