Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sections to readthedocs #133

Open
wants to merge 159 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
ed6188e
Provide placeholder pages
jondricek Jun 30, 2023
bed8f9b
Update getting-started.rst
vsun757 Jun 30, 2023
743723d
Update stix-recipes.rst
vsun757 Jun 30, 2023
c1e0188
Update stix-recipes.rst
vsun757 Jun 30, 2023
759ee16
Update stix-recipes.rst
vsun757 Jun 30, 2023
bd3436e
splitting up python recipe sections
vsun757 Jun 30, 2023
8ca5d8c
adding more page splits
vsun757 Jun 30, 2023
f6e8891
added final sections
vsun757 Jun 30, 2023
11a37af
Update index.rst
vsun757 Jul 3, 2023
8cdfb00
Update index.rst
vsun757 Jul 3, 2023
43c46de
Update index.rst
vsun757 Jul 3, 2023
a7fb3cd
Update index.rst
vsun757 Jul 3, 2023
ca3383a
Update attack_id.rst
vsun757 Jul 5, 2023
7bd6640
Update by_alias.rst
vsun757 Jul 5, 2023
367b0de
Update by_name.rst
vsun757 Jul 5, 2023
b103691
Update getting-started.rst
vsun757 Jul 5, 2023
7266602
Update getting_revoked_object.rst
vsun757 Jul 5, 2023
635083f
Update getting_software.rst
vsun757 Jul 5, 2023
7a22c09
Update objects_by_content.rst
vsun757 Jul 5, 2023
16fcc28
Update objects_by_type.rst
vsun757 Jul 5, 2023
9a67950
Update objects_since_date.rst
vsun757 Jul 5, 2023
c930c2c
restyling code blocks
vsun757 Jul 5, 2023
a5ff0f2
Update getting_software.rst
vsun757 Jul 5, 2023
9c015f1
trying to make python code visible
vsun757 Jul 5, 2023
32ea070
trying to make python code visible part 2
vsun757 Jul 5, 2023
9617aec
added bolding to headers
vsun757 Jul 5, 2023
018a9e1
Update and rename getting-started.rst to access-attack.rst
vsun757 Jul 6, 2023
387065d
Update index.rst
vsun757 Jul 6, 2023
24d5ef2
Update README.md
vsun757 Jul 6, 2023
25f7283
changed folder name and removed secondary titles
vsun757 Jul 6, 2023
107111d
removing extra folder
vsun757 Jul 7, 2023
0a47812
Update index.rst
vsun757 Jul 7, 2023
bff1a55
Update access-attack.rst
vsun757 Jul 7, 2023
1f4d6f3
Update access-attack.rst
vsun757 Jul 7, 2023
5fd4b49
Update index.rst
vsun757 Jul 7, 2023
645b0eb
added getting started doc
vsun757 Jul 7, 2023
e035018
added section docs
vsun757 Jul 7, 2023
a69b2c0
Update index.rst
vsun757 Jul 7, 2023
2549137
adding more
vsun757 Jul 7, 2023
79edf9e
Update index.rst
vsun757 Jul 7, 2023
49e005d
Update index.rst
vsun757 Jul 7, 2023
e38b3f2
Update getting_started.rst
vsun757 Jul 7, 2023
47e07c0
Update and rename getting_started.rst to start.rst
vsun757 Jul 7, 2023
9f241c5
Update index.rst
vsun757 Jul 7, 2023
94ec9c6
Update index.rst
vsun757 Jul 7, 2023
389faa3
Update index.rst
vsun757 Jul 7, 2023
cdeec0d
Rename diffstix.rst to differentstix.rst
vsun757 Jul 7, 2023
e3db2e1
Update index.rst
vsun757 Jul 7, 2023
40c7c02
Update access-attack.rst
vsun757 Jul 7, 2023
41fd411
Update access-attack.rst
vsun757 Jul 7, 2023
8d93c2f
reformatting new docs
vsun757 Jul 7, 2023
dad6a84
reformatting attacktoexcel
vsun757 Jul 7, 2023
46a4f95
reformatting start.rst
vsun757 Jul 7, 2023
d0613a4
Update index.rst
vsun757 Jul 10, 2023
68b5f6f
Rename differentstix.rst to differenceinstix.rst
vsun757 Jul 10, 2023
b52e1ff
Update index.rst
vsun757 Jul 10, 2023
6bded72
Update index.rst
vsun757 Jul 10, 2023
4bfec53
removed index.rst to test out
vsun757 Jul 10, 2023
c8625e6
swapping additional modules section
vsun757 Jul 10, 2023
9a92c05
changing stix section title
vsun757 Jul 10, 2023
5b9b83c
changing addl modules section location
vsun757 Jul 10, 2023
1a4af82
undoing changes
vsun757 Jul 10, 2023
b63275f
added titles to new docs
vsun757 Jul 10, 2023
e60cbf8
adding back original addl modules for comparison
vsun757 Jul 10, 2023
7b03e15
Update collections.rst
vsun757 Jul 10, 2023
0ba585b
Update collections.rst
vsun757 Jul 10, 2023
49f5adf
Update collections.rst
vsun757 Jul 10, 2023
2a6981e
Update collections.rst
vsun757 Jul 10, 2023
e89d093
Update collections.rst
vsun757 Jul 10, 2023
c092ea0
Update collections.rst
vsun757 Jul 10, 2023
bdb45fa
Update collections.rst
vsun757 Jul 10, 2023
7224683
Update collections.rst
vsun757 Jul 10, 2023
b8c4235
Update collections.rst
vsun757 Jul 10, 2023
96fdba3
Update collections.rst
vsun757 Jul 10, 2023
ff5e395
Update collections.rst
vsun757 Jul 10, 2023
be65763
Update collections.rst
vsun757 Jul 10, 2023
c1219cd
Update diffinstix.rst
vsun757 Jul 10, 2023
ea9bc07
Update getting_started.rst
vsun757 Jul 10, 2023
d2f84df
Update getting_started.rst
vsun757 Jul 10, 2023
8402953
Update getting_started.rst
vsun757 Jul 10, 2023
5c4913c
Update getting_started.rst
vsun757 Jul 10, 2023
cbd232f
Update getting_started.rst
vsun757 Jul 10, 2023
c0b35f4
Update navlayers.rst
vsun757 Jul 10, 2023
9e47f18
Update navlayers.rst
vsun757 Jul 10, 2023
abf6852
Update navlayers.rst
vsun757 Jul 10, 2023
19c1c77
Update navlayers.rst
vsun757 Jul 10, 2023
2db1289
Update navlayers.rst
vsun757 Jul 10, 2023
21992eb
Update README.md
vsun757 Jul 11, 2023
63b929c
Update README.md
vsun757 Jul 11, 2023
86ee4f5
Update navlayers.rst
vsun757 Jul 11, 2023
a7ca617
Update navlayers.rst
vsun757 Jul 11, 2023
d729446
Update navlayers.rst
vsun757 Jul 11, 2023
310175a
Update navlayers.rst
vsun757 Jul 11, 2023
741b52b
adding tables to navlayers
vsun757 Jul 11, 2023
24758ce
adding more tables to navlayers
vsun757 Jul 11, 2023
0ae8abb
adding more tables part 2
vsun757 Jul 11, 2023
b42811f
adding more tables part 3
vsun757 Jul 11, 2023
0fbc19f
adding more tables part 4
vsun757 Jul 11, 2023
f014de5
adding more tables final to navlayers
vsun757 Jul 11, 2023
64b543d
adding more tables final to collections
vsun757 Jul 11, 2023
588e86b
added another setof tables to diffstix
vsun757 Jul 12, 2023
9a1bbde
added another setof tables to attacktoexcel
vsun757 Jul 12, 2023
4c758b3
added table syntax
vsun757 Jul 13, 2023
4f9fb8e
added table syntax part 2
vsun757 Jul 13, 2023
34de82a
added table syntax to nayvlayers
vsun757 Jul 13, 2023
23ee865
added table syntax to navlayers
vsun757 Jul 13, 2023
cd76f3d
added table syntax to navlayers part 2
vsun757 Jul 13, 2023
7a49d1d
fixed column spacing
vsun757 Jul 14, 2023
633d356
fixed column spacing part 2
vsun757 Jul 14, 2023
8b91805
fixed table syntax
vsun757 Jul 14, 2023
9e087a1
fixed table syntax part 2
vsun757 Jul 14, 2023
37018ab
fixed table syntax part 3
vsun757 Jul 14, 2023
3ed1051
fixed navlayer syntax part 3
vsun757 Jul 14, 2023
53b6180
fixed navlayer syntax part 4
vsun757 Jul 14, 2023
5028544
fixed navlayer commandline table syntax
vsun757 Jul 14, 2023
e82b1ca
visual improvements
vsun757 Jul 18, 2023
9ea41a6
fixing syntax
vsun757 Jul 18, 2023
219d491
fixing syntax part 2
vsun757 Jul 18, 2023
d827727
fixing navlayer code syntax
vsun757 Jul 18, 2023
c512418
fixing navlayer code syntax part 2
vsun757 Jul 18, 2023
6daf7ae
added table of contents for stix primer
vsun757 Jul 18, 2023
2e5a303
added nav layer core page
vsun757 Jul 18, 2023
ba7746b
adding in code for words
vsun757 Jul 18, 2023
e7592bb
adding in code for words part 2
vsun757 Jul 18, 2023
4ea4b89
finished word formatting for navlayers
vsun757 Jul 18, 2023
7ab40f4
testing out subheaders
vsun757 Jul 19, 2023
7a8aa26
cleaning up attacktoexcel
vsun757 Jul 19, 2023
47c5aeb
cleaning up getting_started page
vsun757 Jul 19, 2023
6024474
replaced bolded text with section subheaders
vsun757 Jul 19, 2023
eba7bed
added codeblock formatting to diffstix
vsun757 Jul 19, 2023
8c59c25
additional improvements
vsun757 Jul 19, 2023
15b452d
additional improvements to getting started page
vsun757 Jul 19, 2023
9500fbe
additional improvements to getting started page part 2
vsun757 Jul 19, 2023
5fa441c
fixing descriptions for additional modules
vsun757 Jul 20, 2023
12a1e06
fixing syntax part 2
vsun757 Jul 20, 2023
ae7eb0e
fixing link in access attack
vsun757 Jul 20, 2023
6eb45f1
changing bolded to section header
vsun757 Jul 20, 2023
82bf26a
adding regs
vsun757 Jul 20, 2023
e3f2466
adding refs
vsun757 Jul 20, 2023
5729e32
adding more section links
vsun757 Jul 20, 2023
dc5ee5f
fixing links
vsun757 Jul 20, 2023
24f3b37
fixing links and making more subheaders
vsun757 Jul 20, 2023
656c399
fixing links and making more subheaders part 2
vsun757 Jul 20, 2023
f199cc1
fixed formatting in diffinstix
vsun757 Jul 21, 2023
9c4aa45
fixed formatting in navlayercore
vsun757 Jul 21, 2023
2faa919
fixing navlayercore issue
vsun757 Jul 24, 2023
da8eb1f
fixed code styling in collections
vsun757 Jul 24, 2023
69f8196
fixed code styling in overview
vsun757 Jul 24, 2023
d92852f
fixed code styling in deprecated revoked page
vsun757 Jul 24, 2023
26e8a61
removed special character from multiple objects page
vsun757 Jul 24, 2023
77db64a
more syntax fixes
vsun757 Jul 24, 2023
ea3737b
more syntax fixes
vsun757 Jul 24, 2023
7e1173f
removed duplicate entry in overview index file
vsun757 Jul 24, 2023
8a4a7fe
fixed github issue link
vsun757 Jul 24, 2023
bd3b13d
fixed italics in removed revoked page
vsun757 Jul 24, 2023
10ab491
fixed link in getting started
vsun757 Jul 25, 2023
46e6599
switched readme links to readthedocs links
vsun757 Jul 25, 2023
22504e8
removed duplicate information from READMEs
vsun757 Jul 26, 2023
8436e84
fixing link
vsun757 Sep 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 1 addition & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,7 @@ More detailed information and examples about the specific usage of the additiona

## Related MITRE Work

### CTI

[Cyber Threat Intelligence repository](https://github.com/mitre/cti) of the ATT&CK catalog expressed in STIX 2.0 JSON.
This repository also contains [our USAGE document](https://github.com/mitre/cti/blob/master/USAGE.md) which includes
additional examples of accessing and parsing our dataset in Python.

### ATT&CK

ATT&CK® is a curated knowledge base and model for cyber adversary behavior, reflecting the various phases of
an adversary’s lifecycle, and the platforms they are known to target.
ATT&CK is useful for understanding security risk against known adversary behavior,
for planning security improvements, and verifying defenses work as expected.

<https://attack.mitre.org>

### STIX

Structured Threat Information Expression (STIX<sup>™</sup>) is a language and serialization format used to exchange cyber threat intelligence (CTI).

STIX enables organizations to share CTI with one another in a consistent and machine-readable manner,
allowing security communities to better understand what computer-based attacks they are most likely to
see and to anticipate and/or respond to those attacks faster and more effectively.

STIX is designed to improve many capabilities, such as collaborative threat analysis, automated threat exchange, automated detection and response, and more.

<https://oasis-open.github.io/cti-documentation/>

### ATT&CK scripts

One-off scripts and code examples you can use as inspiration for how to work with ATT&CK programmatically. Many of the functionalities found in the mitreattack-python package were originally posted on attack-scripts.

<https://github.com/mitre-attack/attack-scripts>
Go to [this link](https://mitreattack-python.readthedocs.io/en/latest/related_work.html) for related MITRE work.


## Contributing
Expand Down
155 changes: 155 additions & 0 deletions docs/attacktoexcel.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
ATT&CK to Excel
==============================================

ATT&CK to Excel contains a module for converting `ATT&CK STIX data <https://github.com/mitre/cti>`_ to Excel spreadsheets.
It also provides a means to access ATT&CK data as `Pandas <https://pandas.pydata.org/>`_ DataFrames for data analysis.

Usage:
-----

Command Line
-----

Print full usage instructions:

.. code:: bash

python3 attackToExcel.py -h


Example execution:

.. code:: bash

python3 attackToExcel.py


Build a excel files corresponding to a specific domain and version of ATT&CK:

.. code:: bash

python3 attackToExcel -domain mobile-attack -version v5.0


Module
-----

Example execution targeting a specific domain and version:

.. code-block:: python

import mitreattack.attackToExcel.attackToExcel as attackToExcel

attackToExcel.export("mobile-attack", "v5.0", "/path/to/export/folder")


Interfaces:
-----

attackToExcel
-----

attackToExcel provides the means by which to convert/extract the ATT&CK STIX data to Excel spreadsheets. A brief
overview of the available methods follows.


.. list-table:: Title
:widths: 33 33 34
:header-rows: 1

* - method name
- arguments
- usage
* - get_stix_data
- `domain`: the domain of ATT&CK to fetch data from <br> `version`: optional parameter indicating which version to fetch data from (such as "v8.1"). If omitted retrieves the most recent version of ATT&CK. <br>`remote`: optional parameter that provides a URL of a remote ATT&CK Workbench instance to grab data from.
- Retrieves the ATT&CK STIX data for the specified version and returns it as a MemoryStore object
* - build_dataframes
- `src`: MemoryStore or other stix2 DataSource object holding domain data<br> `domain`: domain of ATT&CK that `src` corresponds to
- Builds a Pandas DataFrame collection as a dictionary, with keys for each type, based on the ATT&CK data provided
* - write_excel
- `dataframes`: pandas DataFrame dictionary (generated by build_dataframes) <br> `domain`: domain of ATT&CK that `dataframes` corresponds to <br> `version`: optional parameter indicating which version of ATT&CK is in use <br> `output_dir`: optional parameter specifying output directory
- Writes out DataFrame based ATT&CK data to excel files
* - export
- `domain`: the domain of ATT&CK to download <br> `version`: optional parameter specifying which version of ATT&CK to download <br> `output_dir`: optional parameter specifying output directory
- Downloads ATT&CK data from MITRE/CTI and exports it to Excel spreadsheets

stixToDf
-----

stixToDf provides various methods to process and manipulate the STIX data in order to create `Pandas <https://pandas.pydata.org/>`_ DataFrames for
processing. A brief overview of these methods follows.

.. list-table::
:widths: 33 33 34
:header-rows: 1

* - method name
- arguments
- usage
* - techniquesToDf
- `src`: MemoryStore or other stix2 DataSource object holding domain data<br> `domain`: domain of ATT&CK that `src` corresponds to
- Parses STIX techniques from the provided data and returns corresponding Pandas DataFrames.
* - tacticsToDf
- `src`: MemoryStore or other stix2 DataSource object holding domain data<br> `domain`: domain of ATT&CK that `src` corresponds to
- Parses STIX tactics from the provided data and returns corresponding Pandas DataFrames.
* - softwareToDf
- `src`: MemoryStore or other stix2 DataSource object holding domain data<br> `domain`: domain of ATT&CK that `src` corresponds to
- Parses STIX software from the provided data and returns corresponding Pandas DataFrames.
* - groupsToDf
- `src`: MemoryStore or other stix2 DataSource object holding domain data<br> `domain`: domain of ATT&CK that `src` corresponds to
- Parses STIX groups from the provided data and returns corresponding Pandas DataFrames.
* - mitigationsToDf
- `src`: MemoryStore or other stix2 DataSource object holding domain data<br> `domain`: domain of ATT&CK that `src` corresponds to
- Parses STIX mitigations from the provided data and returns corresponding Pandas DataFrames.
* - relationshipsToDf
- `src`: MemoryStore or other stix2 DataSource object holding domain data<br> `domain`: domain of ATT&CK that `src` corresponds to
- Parses STIX relationships from the provided data and returns corresponding Pandas DataFrames.
* - matricesToDf
- `src`: MemoryStore or other stix2 DataSource object holding domain data<br> `domain`: domain of ATT&CK that `src` corresponds to
- Parses STIX matrices from the provided data and returns a parsed matrix structure of the form `[{matrix, name, description, merge, border}, ...]`


Spreadsheet format
-----

The Excel representation of the ATT&CK dataset includes both master spreadsheets,
containing all object types, and individual spreadsheets for each object type.
The individual type spreadsheets break out relationships (e.g procedure examples connecting groups to techniques)
into separate sheets by relationship type, while the master spreadsheet includes all relationship types in a single sheet.
Otherwise, the representation is identical.

A citations sheet can be used to look up the in-text citations which appear in some fields.
For domains that include multiple matrices, such as Mobile ATT&CK, each matrix gets its own named sheet.
Unlike the STIX dataset, objects that have been revoked or deprecated are not included in the spreadsheets.

Accessing the Pandas DataFrames
-----

Internally, attackToExcel stores the parsed STIX data as `Pandas <https://pandas.pydata.org/>`_ DataFrames.
These can be retrieved for use in data analysis.

Example of accessing `Pandas <https://pandas.pydata.org/>`_ DataFrames:

.. code-block:: python

import mitreattack.attackToExcel.attackToExcel as attackToExcel
import mitreattack.attackToExcel.stixToDf as stixToDf

# download and parse ATT&CK STIX data
attackdata = attackToExcel.get_stix_data("enterprise-attack")
techniques_data = stixToDf.techniquesToDf(attackdata, "enterprise-attack")

# show T1102 and sub-techniques of T1102
techniques_df = techniques_data["techniques"]
print(techniques_df[techniques_df["ID"].str.contains("T1102")]["name"])
# 512 Web Service
# 38 Web Service: Bidirectional Communication
# 121 Web Service: Dead Drop Resolver
# 323 Web Service: One-Way Communication
# Name: name, dtype: object

# show citation data for LOLBAS Wmic reference
citations_df = techniques_data["citations"]
print(citations_df[citations_df["reference"].str.contains("LOLBAS Wmic")])
# reference citation url
# 1010 LOLBAS Wmic LOLBAS. (n.d.). Wmic.exe. Retrieved July 31, 2... https://lolbas-project.github.io/lolbas/Binari...
113 changes: 113 additions & 0 deletions docs/collections.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@

Collections
==============================================

Collections contains modules and scripts for working with ATT&CK collections.
Collections are sets of ATT&CK STIX objects, grouped for user convienence.
For more information about ATT&CK collections, see the corresponding
`ATT&CK documentation <https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/collections.md#collections>`_.

Collections Scripts
------------------------


.. list-table::
:widths: 50 50
:header-rows: 1

* - script
- description
* - `index_to_markdown <https://github.com/mitre-attack/mitreattack-python/blob/master/mitreattack/collections/index_to_markdown.py>`_
- Provides a means by which to convert a `collection index <https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/collections.md#collection-indexes>`_ into a human-readable markdown file. More information can be found in the corresponding :ref:`index_to_markdown.py` below.
* - `collection_to_index <https://github.com/mitre-attack/mitreattack-python/blob/master/mitreattack/collections/collection_to_index.py>`_
- Provides a means by which to convert a `collection <https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/collections.md#collections>`_ into a easy-to-share `index file <https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/collections.md#collection-indexes>`_. More information can be found in the corresponding :ref:`section<collection_to_index.py>` below.
* - `stix_to_collection <https://github.com/mitre-attack/mitreattack-python/blob/master/mitreattack/collections/stix_to_collection.py>`_
- Provides a means by which to convert raw stix (in the form of `bundles <https://docs.oasis-open.org/cti/stix/v2.1/cs01/stix-v2.1-cs01.html#_gms872kuzdmg>`_) into a `collection <https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/collections.md#collections>`_. More information can be found in the corresponding :ref:`section<stix_to_collection.py>` below.

index_to_markdown.py
------------------------

``index_to_markdown.py`` provides the ``IndexToMarkdown`` class, which provides a way to transform an existing
`collection index file <https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/collections.md#collection-indexes>`_
into a markdown file for easy of use and reference.
The ``IndexToMarkdown`` class is very simple, and provides a single method, ``index_to_markdown``,
which in turn only requires a single parameter - a dictionary representation of the desired index file to convert to markdown.
An example of how to use the class, and method, can be found below.

Example Usage
------------------------

.. code-block:: python

import json
from mitreattack.collections import IndexToMarkdown

with open('collection_index.json', 'r') as input_file:
with open('collection_index.md', 'w') as output_file:
input_index = json.load(input_file)
generated_md = IndexToMarkdown.index_to_markdown(input_index) # Convert index to markdown
output_file.write(generated_md)
print(generated_md)


collection_to_index.py
------------------------

`collection_to_index.py` provides the `CollectionToIndex` class, which proves a means by which to summarize existing
`collections <https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/collections.md#collections>`_
into a single `collection index <https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/collections.md#collection-indexes>`_ file.
The `CollectionToIndex` class contains the `generate_index` function, which when provided with a name, description, root url (pointing to where the raw collections are stored),
and a list of either files, folders, or already loaded bundles in the form of dictionaries, will create a summarizing index.

Example Usage
---------------

.. code-block:: python

import json
from mitreattack.collections import CollectionToIndex

output_indexA = CollectionToIndex.generate_index(name='example', description='example index',
root_url='www.example.com',
files=['/path/to/collection1.json', '/path/to/collection2.json'],
folders=None, sets=None)
output_indexB = CollectionToIndex.generate_index(name='example2', description='demonstration index',
root_url='www.example.com',
files=None, folders=['/path/to/folder/with/collections'], sets=None)
with open('path/to/bundle/bundleC.json', 'r') as f:
data = json.load(f)
output_indexC = CollectionToIndex.generate_index(name='example3', description='exhibit index',
root_url='www.example.com',
files=None, folders=None, sets=[data])
print(output_indexA)
print(output_indexB)
print(output_indexC)


stix_to_collection.py
------------------------

`stix_to_collection.py` provides the `STIXToCollection` class, which proves a means by which to convert
existing stix bundles into ones containing a
`collection <https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/collections.md#collections>`_ object.
The `STIXToCollection` class contains the `stix_to_collection` function, which when provided with a starter bundle,
a name, a version, and an optional description, will output a modified bundle that contains a summary collection object.

Example Usage
--------------

.. code-block:: python

import json
from mitreattack.collections import STIXToCollection

with open('path/to/bundle/bundle2_0.json', 'r') as f:
data = json.load(f)
output_bundleA = STIXToCollection.stix_to_collection(bundle=data, name='collectionA', version='9.1', description="demo bundle (2.0)")

with open('path/to/bundle/bundle2_1.json', 'r') as f:
data = json.load(f)
output_bundleB = STIXToCollection.stix_to_collection(bundle=data, name='collectionB', version='9.0', description="demo bundle (2.1)")

print(output_bundleA)
print(output_bundleB)
Loading