You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 11, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: layers/README.md
+38-5Lines changed: 38 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ This folder contains modules and scripts for working with ATT&CK Navigator layer
22
22
| script | description |
23
23
|:-------|:------------|
24
24
|[to_excel](exporters/to_excel.py)| Provides a means by which to export an ATT&CK Layer to an excel file. A further breakdown can be found in the corresponding [section](#to_excel.py) below. |
25
-
|[to_svg](exporters/to_svg.py)| Provides a means by which to export an ATT&CK layer to an svg image file. A further breakdown can be found in the corresponding [section](#to_svg.py) below. |
25
+
|[to_svg](exporters/to_svg.py)| Provides a means by which to export an ATT&CK layer to an svg image file. A further breakdown can be found in the corresponding [section](#to_svg.py) below. This file also contains the `SVGConfig` object that can be used to configure the SVG export.|
26
26
##### Utility Modules
27
27
| script | description |
28
28
|:-------|:------------|
@@ -177,9 +177,38 @@ tells the exporter what data source to use when building the output matrix. Vali
177
177
178
178
##### ToSVG()
179
179
```python
180
-
x = ToSvg(domain='enterprise', source='taxii', local=None)
180
+
x = ToSvg(domain='enterprise', source='taxii', local=None, config=None)
181
181
```
182
-
The ToSVG constructor, just like the ToExcel constructor, takes domain, server, and local arguments during instantiation. The domain can be either `enterprise` or `mobile`, and can be pulled directly from a layer file as `layer.domain`. The source argument tells the matrix generation tool which data source to use when building the matrix. `taxii` indicates that the tool should utilize the `cti-taxii` server when building the matrix, while the `local` option indicates that it should use a local bundle respectively. The local argument is only required if the source is set to `local`, in which case it should be a path to a local stix bundle.
182
+
The ToSVG constructor, just like the ToExcel constructor, takes domain, server, and local arguments during instantiation. The domain can be either `enterprise` or `mobile`, and can be pulled directly from a layer file as `layer.domain`. The source argument tells the matrix generation tool which data source to use when building the matrix. `taxii` indicates that the tool should utilize the `cti-taxii` server when building the matrix, while the `local` option indicates that it should use a local bundle respectively. The local argument is only required if the source is set to `local`, in which case it should be a path to a local stix bundle. The `config` parameter is an optional SVGConfig object that can be used to configure the export as desired. If not provided, the configuration for the export will be set to default values.
183
+
184
+
##### SVGConfig()
185
+
```python
186
+
y = SVGConfig(width=8.5, height=11, headerHeight=1, unit="in", showSubtechniques="expanded",
The SVGConfig object is used to configure how an SVG export behaves. The defaults for each of the available values can be found in the declaration above, and a brief explanation for each field is included in the table below. The config object should be provided to the ToSvg object during instantiation, but if values need to be updated on the fly, the currently loaded configuration can be interacted with at `ToSvg().config`. The configuration can also be populated from a json file using the `.load_from_file(filename="path/to/file.json")` method, or stored to one using the `.save_to_file(filename="path/to/file.json)` method.
192
+
193
+
| attribute| description |
194
+
|:-------|:------------|
195
+
| width | Desired SVG width |
196
+
| height | Desired SVG height |
197
+
| headerHeight | Desired Header Block height |
198
+
| unit | SVG measurement units (qualifies width, height, etc.) |
199
+
| showSubtechniques | Display form for subtechniques - "all", "expanded" (decided by layer), or "none" |
200
+
| font | What font style to use - "sans", "sans-serif", or "monospace" |
201
+
| tableBorderColor | Hex color to use for the technique borders |
202
+
| showHeader | Whether or not to show Header Blocks |
203
+
| legendDocked | Whether or not the legend should be docked |
204
+
| legendX | Where to place the legend on the x axis if not docked |
205
+
| legendY | Where to place the legend on the y axis if not docked |
206
+
| legendWidth | Width of the legend if not docked |
207
+
| legendHeight | Height of the legend if not docked |
208
+
| showLegend | Whether or not to show the legend |
209
+
| showFilters | Whether or not to show the Filter Header Block |
210
+
| showAbout | Whether or not to show the About Header Block |
211
+
| border | What default border width to use |
183
212
184
213
##### .to_svg() Method
185
214
```python
@@ -191,14 +220,18 @@ The to_svg method exports the layer file referenced as `layer`, as an excel file
191
220
#### Example Usage
192
221
```python
193
222
from layers import Layer
194
-
from layers import ToSvg
223
+
from layers import ToSvg, SVGConfig
195
224
196
225
lay = Layer()
197
226
lay.from_file("path/to/layer/file.json")
198
227
# Using taxii server for template
199
228
t = ToSvg(domain=lay.layer.domain, source='taxii')
0 commit comments