stix2arango 1.1.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stix2arango/__init__.py +0 -0
- stix2arango/__main__.py +81 -0
- stix2arango/config.py +41 -0
- stix2arango/services/__init__.py +1 -0
- stix2arango/services/arangodb_service.py +313 -0
- stix2arango/services/version_annotator.py +95 -0
- stix2arango/stix2arango/__init__.py +1 -0
- stix2arango/stix2arango/bundle_loader.py +143 -0
- stix2arango/stix2arango/stix2arango.py +601 -0
- stix2arango/templates/marking-definition.json +111 -0
- stix2arango/utils.py +150 -0
- stix2arango-1.1.10.dist-info/METADATA +171 -0
- stix2arango-1.1.10.dist-info/RECORD +16 -0
- stix2arango-1.1.10.dist-info/WHEEL +4 -0
- stix2arango-1.1.10.dist-info/entry_points.txt +2 -0
- stix2arango-1.1.10.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "marking-definition",
|
|
4
|
+
"spec_version": "2.1",
|
|
5
|
+
"id": "marking-definition--613f2e26-407d-48c7-9eca-b8e91df99dc9",
|
|
6
|
+
"created": "2017-01-20T00:00:00.000Z",
|
|
7
|
+
"definition_type": "tlp",
|
|
8
|
+
"name": "TLP:WHITE",
|
|
9
|
+
"definition": {
|
|
10
|
+
"tlp": "white"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"type": "marking-definition",
|
|
15
|
+
"spec_version": "2.1",
|
|
16
|
+
"id": "marking-definition--34098fce-860f-48ae-8e50-ebd3cc5e41da",
|
|
17
|
+
"created": "2017-01-20T00:00:00.000Z",
|
|
18
|
+
"definition_type": "tlp",
|
|
19
|
+
"name": "TLP:GREEN",
|
|
20
|
+
"definition": {
|
|
21
|
+
"tlp": "green"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "marking-definition",
|
|
26
|
+
"spec_version": "2.1",
|
|
27
|
+
"id": "marking-definition--f88d31f6-486f-44da-b317-01333bde0b82",
|
|
28
|
+
"created": "2017-01-20T00:00:00.000Z",
|
|
29
|
+
"definition_type": "tlp",
|
|
30
|
+
"name": "TLP:AMBER",
|
|
31
|
+
"definition": {
|
|
32
|
+
"tlp": "amber"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "marking-definition",
|
|
37
|
+
"spec_version": "2.1",
|
|
38
|
+
"id": "marking-definition--5e57c739-391a-4eb3-b6be-7d15ca92d5ed",
|
|
39
|
+
"created": "2017-01-20T00:00:00.000Z",
|
|
40
|
+
"definition_type": "tlp",
|
|
41
|
+
"name": "TLP:RED",
|
|
42
|
+
"definition": {
|
|
43
|
+
"tlp": "red"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "marking-definition",
|
|
48
|
+
"spec_version": "2.1",
|
|
49
|
+
"id": "marking-definition--94868c89-83c2-464b-929b-a1a8aa3c8487",
|
|
50
|
+
"created": "2022-10-01T00:00:00.000Z",
|
|
51
|
+
"name": "TLP:CLEAR",
|
|
52
|
+
"extensions": {
|
|
53
|
+
"extension-definition--60a3c5c5-0d10-413e-aab3-9e08dde9e88d": {
|
|
54
|
+
"extension_type": "property-extension",
|
|
55
|
+
"tlp_2_0" : "clear"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "marking-definition",
|
|
61
|
+
"spec_version": "2.1",
|
|
62
|
+
"id": "marking-definition--bab4a63c-aed9-4cf5-a766-dfca5abac2bb",
|
|
63
|
+
"created": "2022-10-01T00:00:00.000Z",
|
|
64
|
+
"name": "TLP:GREEN",
|
|
65
|
+
"extensions": {
|
|
66
|
+
"extension-definition--60a3c5c5-0d10-413e-aab3-9e08dde9e88d": {
|
|
67
|
+
"extension_type": "property-extension",
|
|
68
|
+
"tlp_2_0" : "green"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "marking-definition",
|
|
74
|
+
"spec_version": "2.1",
|
|
75
|
+
"id": "marking-definition--55d920b0-5e8b-4f79-9ee9-91f868d9b421",
|
|
76
|
+
"created": "2022-10-01T00:00:00.000Z",
|
|
77
|
+
"name": "TLP:AMBER",
|
|
78
|
+
"extensions": {
|
|
79
|
+
"extension-definition--60a3c5c5-0d10-413e-aab3-9e08dde9e88d": {
|
|
80
|
+
"extension_type": "property-extension",
|
|
81
|
+
"tlp_2_0" : "amber"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"type": "marking-definition",
|
|
87
|
+
"spec_version": "2.1",
|
|
88
|
+
"id": "marking-definition--939a9414-2ddd-4d32-a0cd-375ea402b003",
|
|
89
|
+
"created": "2022-10-01T00:00:00.000Z",
|
|
90
|
+
"name": "TLP:AMBER+STRICT",
|
|
91
|
+
"extensions": {
|
|
92
|
+
"extension-definition--60a3c5c5-0d10-413e-aab3-9e08dde9e88d": {
|
|
93
|
+
"extension_type": "property-extension",
|
|
94
|
+
"tlp_2_0" : "amber+strict"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"type": "marking-definition",
|
|
100
|
+
"spec_version": "2.1",
|
|
101
|
+
"id": "marking-definition--e828b379-4e03-4974-9ac4-e53a884c97c1",
|
|
102
|
+
"created": "2022-10-01T00:00:00.000Z",
|
|
103
|
+
"name": "TLP:RED",
|
|
104
|
+
"extensions": {
|
|
105
|
+
"extension-definition--60a3c5c5-0d10-413e-aab3-9e08dde9e88d": {
|
|
106
|
+
"extension_type": "property-extension",
|
|
107
|
+
"tlp_2_0" : "red"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]
|
stix2arango/utils.py
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
from contextlib import contextmanager
|
|
2
|
+
from functools import lru_cache
|
|
3
|
+
import re
|
|
4
|
+
import requests
|
|
5
|
+
import logging
|
|
6
|
+
import uuid
|
|
7
|
+
import json
|
|
8
|
+
import hashlib
|
|
9
|
+
import os
|
|
10
|
+
from . import config
|
|
11
|
+
from datetime import UTC, datetime
|
|
12
|
+
|
|
13
|
+
module_logger = logging.getLogger("data_ingestion_service")
|
|
14
|
+
from arango.database import StandardDatabase
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
EMBEDDED_RELATIONSHIP_RE = re.compile(r"([a-z\-_]+)[_\-]refs{0,1}")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@lru_cache
|
|
21
|
+
def load_file_from_url(url):
|
|
22
|
+
try:
|
|
23
|
+
response = requests.get(url)
|
|
24
|
+
response.raise_for_status() # Raise an HTTPError for bad responses
|
|
25
|
+
return json.loads(response.text)
|
|
26
|
+
except requests.exceptions.RequestException as e:
|
|
27
|
+
raise Exception(f"Error loading JSON from {url}: {e}") from e
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def create_relationship_obj(
|
|
31
|
+
obj: dict,
|
|
32
|
+
source: str,
|
|
33
|
+
targets: list,
|
|
34
|
+
relationship: str,
|
|
35
|
+
insert_statement,
|
|
36
|
+
bundle_id: str,
|
|
37
|
+
arango_obj=None,
|
|
38
|
+
extra_data=None,
|
|
39
|
+
):
|
|
40
|
+
if not isinstance(targets, list):
|
|
41
|
+
return []
|
|
42
|
+
for target in targets:
|
|
43
|
+
relationship_object = {
|
|
44
|
+
"relationship_type": relationship,
|
|
45
|
+
}
|
|
46
|
+
for key in ["created", "modified", "object_marking_refs"]:
|
|
47
|
+
if key in obj:
|
|
48
|
+
relationship_object[key] = obj[key]
|
|
49
|
+
|
|
50
|
+
relationship_object.update(
|
|
51
|
+
id="relationship--"
|
|
52
|
+
+ str(
|
|
53
|
+
uuid.uuid5(
|
|
54
|
+
config.namespace,
|
|
55
|
+
"{}+{}+{}".format(relationship, source, target),
|
|
56
|
+
)
|
|
57
|
+
),
|
|
58
|
+
created_by_ref=arango_obj.identity_ref["id"],
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
if not isinstance(target, str):
|
|
62
|
+
continue
|
|
63
|
+
relationship_object["source_ref"] = source
|
|
64
|
+
relationship_object["target_ref"] = target
|
|
65
|
+
relationship_object["_from"] = f"{arango_obj.core_collection_vertex}/{source}"
|
|
66
|
+
relationship_object["_to"] = f"{arango_obj.core_collection_vertex}/{target}"
|
|
67
|
+
relationship_object["_bundle_id"] = bundle_id
|
|
68
|
+
relationship_object["_file_name"] = os.path.basename(arango_obj.file or "")
|
|
69
|
+
relationship_object["_stix2arango_note"] = arango_obj.note
|
|
70
|
+
relationship_object["_is_ref"] = True
|
|
71
|
+
relationship_object["type"] = "relationship"
|
|
72
|
+
relationship_object["spec_version"] = "2.1"
|
|
73
|
+
relationship_object["external_references"] = [
|
|
74
|
+
{
|
|
75
|
+
"source_name": "stix2arango",
|
|
76
|
+
"description": "embedded-relationship",
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
if extra_data:
|
|
80
|
+
relationship_object.update(extra_data)
|
|
81
|
+
|
|
82
|
+
insert_statement.append(relationship_object)
|
|
83
|
+
return
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def generate_md5(obj: dict):
|
|
87
|
+
obj_copy = {k: v for k, v in obj.items() if not k.startswith("_")}
|
|
88
|
+
for k in ["_from", "_to", "_stix2arango_note"]:
|
|
89
|
+
if v := obj.get(k):
|
|
90
|
+
obj_copy[k] = v
|
|
91
|
+
json_str = json.dumps(obj_copy, sort_keys=True, default=str).encode("utf-8")
|
|
92
|
+
return hashlib.md5(json_str).hexdigest()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def get_vertex_and_edge_collection_names(name):
|
|
96
|
+
ENDINGS = ["vertex_collection", "edge_collection"]
|
|
97
|
+
splits = name.split("_")
|
|
98
|
+
if "_".join(splits[-2:]) in ENDINGS:
|
|
99
|
+
splits = splits[:-2]
|
|
100
|
+
return "_".join(splits + [ENDINGS[0]]), "_".join(splits + [ENDINGS[1]])
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def chunked(iterable, n):
|
|
104
|
+
if not iterable:
|
|
105
|
+
return []
|
|
106
|
+
for i in range(0, len(iterable), n):
|
|
107
|
+
yield iterable[i : i + n]
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def remove_duplicates(objects):
|
|
111
|
+
objects_hashmap = {}
|
|
112
|
+
for object in objects:
|
|
113
|
+
md5hash = object.get("_record_md5_hash")
|
|
114
|
+
if not md5hash:
|
|
115
|
+
md5hash = generate_md5(object)
|
|
116
|
+
key = "{id}/{hash}".format(id=object["id"], hash=md5hash)
|
|
117
|
+
objects_hashmap[key] = object
|
|
118
|
+
return list(objects_hashmap.values())
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def get_embedded_refs(object: list | dict, xpath: list = [], attributes=None):
|
|
122
|
+
embedded_refs = []
|
|
123
|
+
if isinstance(object, dict):
|
|
124
|
+
for key, value in object.items():
|
|
125
|
+
if key in ["source_ref", "target_ref"]:
|
|
126
|
+
continue
|
|
127
|
+
if match := EMBEDDED_RELATIONSHIP_RE.fullmatch(key):
|
|
128
|
+
relationship_type = "-".join(xpath + match.group(1).split("_"))
|
|
129
|
+
targets = value if isinstance(value, list) else [value]
|
|
130
|
+
targets = [
|
|
131
|
+
_target
|
|
132
|
+
for _target in targets
|
|
133
|
+
if _target and isinstance(_target, str)
|
|
134
|
+
]
|
|
135
|
+
if not targets:
|
|
136
|
+
continue
|
|
137
|
+
if attributes and key not in attributes:
|
|
138
|
+
continue
|
|
139
|
+
embedded_refs.append((relationship_type, targets))
|
|
140
|
+
elif isinstance(value, list):
|
|
141
|
+
embedded_refs.extend(
|
|
142
|
+
get_embedded_refs(value, xpath + [key], attributes=attributes)
|
|
143
|
+
)
|
|
144
|
+
elif isinstance(object, list):
|
|
145
|
+
for obj in object:
|
|
146
|
+
if isinstance(obj, dict):
|
|
147
|
+
embedded_refs.extend(
|
|
148
|
+
get_embedded_refs(obj, xpath, attributes=attributes)
|
|
149
|
+
)
|
|
150
|
+
return embedded_refs
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stix2arango
|
|
3
|
+
Version: 1.1.10
|
|
4
|
+
Summary: stix2arango is a command line tool that takes a group of STIX 2.1 objects in a bundle and inserts them into ArangoDB. It can also handle updates to existing objects in ArangoDB imported in a bundle.
|
|
5
|
+
Project-URL: Homepage, https://github.com/muchdogesec/stix2arango
|
|
6
|
+
Project-URL: Issues, https://github.com/muchdogesec/stix2arango/issues
|
|
7
|
+
Project-URL: dogesec HQ, https://dogesec.com
|
|
8
|
+
Author: dogesec
|
|
9
|
+
Maintainer: dogesec
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Requires-Dist: ijson>=3.4.0
|
|
16
|
+
Requires-Dist: jsonschema>=4.22.0; python_version >= '3.8'
|
|
17
|
+
Requires-Dist: python-arango>=8.1.3; python_version >= '3.8'
|
|
18
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
19
|
+
Requires-Dist: requests>=2.31.0; python_version >= '3.7'
|
|
20
|
+
Requires-Dist: stix2
|
|
21
|
+
Requires-Dist: tqdm>=4.66.4; python_version >= '3.7'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# stix2arango
|
|
25
|
+
|
|
26
|
+
[](https://codecov.io/gh/muchdogesec/stix2arango)
|
|
27
|
+
|
|
28
|
+
## Overview
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
stix2arango is a command line tool that takes a group of STIX 2.1 objects in a bundle and inserts them into ArangoDB. It can also handle updates to existing objects in ArangoDB imported in a bundle.
|
|
33
|
+
|
|
34
|
+
1. STIX 2.1 bundle entered
|
|
35
|
+
2. User chooses database/collection names (stix2arango creates as needed)
|
|
36
|
+
3. stix2arango inserts objects (or updates them) and then generates any relationships between them
|
|
37
|
+
|
|
38
|
+
## tl;dr
|
|
39
|
+
|
|
40
|
+
[](https://www.youtube.com/watch?v=zn6KCj2O5CY)
|
|
41
|
+
|
|
42
|
+
[Watch the demo](https://www.youtube.com/watch?v=zn6KCj2O5CY).
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Install the script
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
# clone the latest code
|
|
50
|
+
git clone https://github.com/muchdogesec/stix2arango
|
|
51
|
+
# create a venv
|
|
52
|
+
cd stix2arango
|
|
53
|
+
python3 -m venv stix2arango-venv
|
|
54
|
+
source stix2arango-venv/bin/activate
|
|
55
|
+
# install requirements
|
|
56
|
+
pip3 install .
|
|
57
|
+
````
|
|
58
|
+
|
|
59
|
+
Note, the installation assumes ArangoDB is already installed locally.
|
|
60
|
+
|
|
61
|
+
[You can install ArangoDB here](https://arangodb.com/download/). stix2arango is compatible with both the Enterprise and Community versions.
|
|
62
|
+
|
|
63
|
+
### Configuration options
|
|
64
|
+
|
|
65
|
+
stix2arango has various settings that are defined in an `.env` file.
|
|
66
|
+
|
|
67
|
+
To create a template for the file:
|
|
68
|
+
|
|
69
|
+
```shell
|
|
70
|
+
cp .env.example .env
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
To see more information about how to set the variables, and what they do, read the `.env.markdown` file.
|
|
74
|
+
|
|
75
|
+
### Run
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
python3 stix2arango.py \
|
|
79
|
+
--file PATH/TO/STIX.json \
|
|
80
|
+
--database NAME \
|
|
81
|
+
--collection NAME \
|
|
82
|
+
--stix2arango_note SOMETHING \
|
|
83
|
+
--ignore_embedded_relationships BOOLEAN
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Where;
|
|
87
|
+
|
|
88
|
+
* `--file` (required): is the path to the valid STIX 2.1 bundle .json file
|
|
89
|
+
* `--database` (required): is the name of the Arango database the objects should be stored in.
|
|
90
|
+
* `--create_db` (default `true`): If database does not exist, stix2arango will create it. You can set to `false` to stop this behaviour (and avoid the risk of incorrect DBs being created). Generally setting to `false` is a good idea if you know the databases exist. This setting will only work if the Arango user being used to authenticate has permissions to create new databases.
|
|
91
|
+
* `--collection` (required): is the name of the Arango collection in the database specified the objects should be stored in. If the collection does not exist, stix2arango will create it
|
|
92
|
+
* `--stix2arango_note` (optional): Will be stored under the `_stix2arango_note` custom attribute in ArangoDB. Useful as can be used in AQL. `a-z` characters only. Max 24 chars.
|
|
93
|
+
* `--ignore_embedded_relationships` (optional, boolean): if `true` passed, this will stop ANY embedded relationships from being generated. This applies for all object types (SDO, SCO, SRO, SMO). If you want to target certain object types see `ignore_embedded_relationships_sro` and `ignore_embedded_relationships_sro` flags. ` Default is `false`
|
|
94
|
+
* `--ignore_embedded_relationships_sro` (optional, boolean): if `true` passed, will stop any embedded relationships from being generated from SRO objects (`type` = `relationship`). Default is `false`
|
|
95
|
+
* `--ignore_embedded_relationships_smo` (optional, boolean): if `true` passed, will stop any embedded relationships from being generated from SMO objects (`type` = `marking-defirnition`, `extension-definition`, `language-content`). Default is `false`
|
|
96
|
+
* `--include_embedded_relationships_attributes` (optional, stix `_ref` or `_refs` attribute): if you only want to create embedded relationships from certain keys (attributes) in a STIX object you can pass a list of attributes here. e.g. `object_refs created_by_ref` . In this example, embedded relationships to all objects listed in `object_refs` and objects in `created_by_ref` will be created between source (the objects that house these attibutes) and destinations (the objects listed as values for these attributes)
|
|
97
|
+
* `--is_large_file` (pass flag): Use this mode when the bundle is very large (>100mb), this will chunk the input into multiple files before loading into memory.
|
|
98
|
+
|
|
99
|
+
For example, [using the MITRE ATT&CK Enterprise bundle](https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json);
|
|
100
|
+
|
|
101
|
+
```shell
|
|
102
|
+
python3 stix2arango.py \
|
|
103
|
+
--file cti_knowledge_base_store/mitre-attack-enterprise/enterprise-attack-15_1.json \
|
|
104
|
+
--database stix2arango_demo \
|
|
105
|
+
--collection demo_1 \
|
|
106
|
+
--stix2arango_note v15.1 \
|
|
107
|
+
--ignore_embedded_relationships true \
|
|
108
|
+
--is_large_file
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If you want to include embedded relationships as edges in the ArangoDB collection, you would run;
|
|
112
|
+
|
|
113
|
+
```shell
|
|
114
|
+
python3 stix2arango.py \
|
|
115
|
+
--file cti_knowledge_base_store/mitre-attack-enterprise/enterprise-attack-15_1.json \
|
|
116
|
+
--database stix2arango_demo \
|
|
117
|
+
--collection demo_2 \
|
|
118
|
+
--stix2arango_note v15.1 \
|
|
119
|
+
--ignore_embedded_relationships false \
|
|
120
|
+
--is_large_file
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
If you want to include embedded relationships for `created_by_ref` and `object_marking_refs` attibutes collection, you would run;
|
|
124
|
+
|
|
125
|
+
```shell
|
|
126
|
+
python3 stix2arango.py \
|
|
127
|
+
--file cti_knowledge_base_store/mitre-attack-enterprise/enterprise-attack-15_1.json \
|
|
128
|
+
--database stix2arango_demo \
|
|
129
|
+
--collection demo_2 \
|
|
130
|
+
--stix2arango_note v15.1 \
|
|
131
|
+
--include_embedded_relationships_attributes object_refs created_by_ref \
|
|
132
|
+
--is_large_file
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### A note on embedded relationships
|
|
136
|
+
|
|
137
|
+
stix2arango can handle all embedded references to other STIX objects under `_ref` and `_refs` properties in a STIX object when `--ignore_embedded_relationships` is set to false.
|
|
138
|
+
|
|
139
|
+
e.g.
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"type": "x-mitre-tactic",
|
|
144
|
+
"spec_version": "2.1",
|
|
145
|
+
"id": "x-mitre-tactic--b977ad29-eb0c-5f09-bb2f-6d3f23e2a175",
|
|
146
|
+
"created_by_ref": "identity--8700e156-6ce9-5090-8589-f9d0aef7bdb7",
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
For the above object a STIX SRO would be generated by stix2arango with `source_ref=x-mitre-tactic--b977ad29-eb0c-5f09-bb2f-6d3f23e2a175`, `target_ref=identity--8700e156-6ce9-5090-8589-f9d0aef7bdb7` and `relationship_type=created-by`.
|
|
150
|
+
|
|
151
|
+
## Quickstart
|
|
152
|
+
|
|
153
|
+
We store a lot of STIX data from popular knowledgebases on Cloudflare R2.
|
|
154
|
+
|
|
155
|
+
This is a useful resource to quickly populate STIX data using stix2arango if you want to see what it can do.
|
|
156
|
+
|
|
157
|
+
To populate this data for yourself, check out `utilities/README.md` for import scripts.
|
|
158
|
+
|
|
159
|
+
## Useful supporting tools
|
|
160
|
+
|
|
161
|
+
* To generate STIX 2.1 Objects: [stix2 Python Lib](https://stix2.readthedocs.io/en/latest/)
|
|
162
|
+
* The STIX 2.1 specification: [STIX 2.1 docs](https://docs.oasis-open.org/cti/stix/v2.1/stix-v2.1.html)
|
|
163
|
+
* [ArangoDB docs](https://docs.arangodb.com/3.11/about-arangodb/)
|
|
164
|
+
|
|
165
|
+
## Support
|
|
166
|
+
|
|
167
|
+
[Minimal support provided via the DOGESEC community](https://community.dogesec.com/).
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
[Apache 2.0](/LICENSE).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
stix2arango/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
stix2arango/__main__.py,sha256=zsCi_bfDULLDkqlRwXyGhFuLvSRcvESEc4MMN7h1lbQ,2835
|
|
3
|
+
stix2arango/config.py,sha256=NZFrcnEfz-0QBrut2Rh7xMF78v0bk6U6y2TY_7mHxSs,1407
|
|
4
|
+
stix2arango/utils.py,sha256=CDbLevt-95V6f97rbWRjG-uT2-vPrHFsz4JW7mJ9HyQ,4986
|
|
5
|
+
stix2arango/services/__init__.py,sha256=E87fB-dxI4mPxMVs00jdLhjp9jFhkVfjhMKIqGLRJlY,45
|
|
6
|
+
stix2arango/services/arangodb_service.py,sha256=4iF3tfQqHb-j5zcYQ4UYEEnTMaaCRgdFNmbt3Oe4LpA,12092
|
|
7
|
+
stix2arango/services/version_annotator.py,sha256=na-yyEFNCfLZnV4Sq64BDzTy90LrWgx811qcY7dlMx0,3288
|
|
8
|
+
stix2arango/stix2arango/__init__.py,sha256=OqxWEEsHqR1QQpznM5DbFJ5bO5numKYtoYhjXYJMEyg,36
|
|
9
|
+
stix2arango/stix2arango/bundle_loader.py,sha256=YphKnJIiHjg_nuQUf59OUthDOVIQYoOIoOqqQUlU1II,4982
|
|
10
|
+
stix2arango/stix2arango/stix2arango.py,sha256=HJXDqA9NWxXVQSHPmbpkEKurpWEbZmy5bng5SQ1OsjE,22412
|
|
11
|
+
stix2arango/templates/marking-definition.json,sha256=0q9y35mUmiF6xIWSLpkATL4JTHGSCNyLbejqZiQ0AuE,3113
|
|
12
|
+
stix2arango-1.1.10.dist-info/METADATA,sha256=ke2N0AC0cwmVeBKHh_3bufzTOR3TYXt6c0ixrG2Bcu4,7798
|
|
13
|
+
stix2arango-1.1.10.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
14
|
+
stix2arango-1.1.10.dist-info/entry_points.txt,sha256=k2WnxMsHFLoyC6rqfvjhIMS1zwtWin51-MbNCGmSMYE,58
|
|
15
|
+
stix2arango-1.1.10.dist-info/licenses/LICENSE,sha256=BK8Ppqlc4pdgnNzIxnxde0taoQ1BgicdyqmBvMiNYgY,11364
|
|
16
|
+
stix2arango-1.1.10.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2020 DOGESEC (https://www.dogesec.com/)
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|