Closed jaimeatwork closed 1 year ago
The ToSVG class should be able to be used to generate an SVG of the MITRE ATT&CK Matrix with a correctly formatted layer.
An error occurs and the SVG is not generated.
AttributeError: 'FreeTypeFont' object has no attribute 'getsize'
See https://github.com/tensorflow/models/issues/11040#issuecomment-1631442757 for more context. https://pypi.org/project/Pillow/10.0.0/#history
Install the latest version of this library
Run the following code, you'll need to provide a valid layer file.
from mitreattack.navlayers import Layer, SVGConfig, ToSvg layer = Layer() layer.from_dict(data) y = SVGConfig(width=8.5, height=11, headerHeight=1, unit="in", showSubtechniques="expanded", font="serif", tableBorderColor="#6B7279", showHeader=True, legendDocked=True, legendX=0, legendY=0, legendWidth=2, legendHeight=1, showLegend=True, showFilters=True, showAbout=True, showDomain=True, border=0.104) t = ToSvg(domain=data['domain'], source='local', resource='enterprise-attack.json', config=y) t.to_svg(layerInit=layer, filepath='attackcoverage.svg') # render the layer to an SVG file
Observe the error
Pin the version of Pillow to 9.5.0.
Expected Behavior
The ToSVG class should be able to be used to generate an SVG of the MITRE ATT&CK Matrix with a correctly formatted layer.
Actual Behavior
An error occurs and the SVG is not generated.
AttributeError: 'FreeTypeFont' object has no attribute 'getsize'
See https://github.com/tensorflow/models/issues/11040#issuecomment-1631442757 for more context. https://pypi.org/project/Pillow/10.0.0/#history
Steps to Reproduce the Problem
Install the latest version of this library
Run the following code, you'll need to provide a valid layer file.
from mitreattack.navlayers import Layer, SVGConfig, ToSvg layer = Layer() layer.from_dict(data) y = SVGConfig(width=8.5, height=11, headerHeight=1, unit="in", showSubtechniques="expanded", font="serif", tableBorderColor="#6B7279", showHeader=True, legendDocked=True, legendX=0, legendY=0, legendWidth=2, legendHeight=1, showLegend=True, showFilters=True, showAbout=True, showDomain=True, border=0.104) t = ToSvg(domain=data['domain'], source='local', resource='enterprise-attack.json', config=y) t.to_svg(layerInit=layer, filepath='attackcoverage.svg') # render the layer to an SVG file
Observe the error
Possible Solution
Pin the version of Pillow to 9.5.0.