stix2arango 1.1.1__py3-none-any.whl → 1.1.3__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.
Potentially problematic release.
This version of stix2arango might be problematic. Click here for more details.
- stix2arango/services/arangodb_service.py +2 -2
- stix2arango/stix2arango/stix2arango.py +2 -3
- stix2arango/utils.py +6 -15
- {stix2arango-1.1.1.dist-info → stix2arango-1.1.3.dist-info}/METADATA +1 -1
- {stix2arango-1.1.1.dist-info → stix2arango-1.1.3.dist-info}/RECORD +8 -8
- {stix2arango-1.1.1.dist-info → stix2arango-1.1.3.dist-info}/WHEEL +0 -0
- {stix2arango-1.1.1.dist-info → stix2arango-1.1.3.dist-info}/entry_points.txt +0 -0
- {stix2arango-1.1.1.dist-info → stix2arango-1.1.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -63,7 +63,7 @@ class ArangoDBService:
|
|
|
63
63
|
|
|
64
64
|
if self.db.has_graph(self.ARANGO_GRAPH):
|
|
65
65
|
self.cti2stix_graph = self.db.graph(self.ARANGO_GRAPH)
|
|
66
|
-
elif
|
|
66
|
+
elif create_db:
|
|
67
67
|
self.cti2stix_graph = self.db.create_graph(self.ARANGO_GRAPH)
|
|
68
68
|
|
|
69
69
|
self.collections: dict[str, StandardCollection] = {}
|
|
@@ -199,7 +199,7 @@ class ArangoDBService:
|
|
|
199
199
|
|
|
200
200
|
@staticmethod
|
|
201
201
|
def fix_edge_ref(_id):
|
|
202
|
-
c, _, _key = _id.
|
|
202
|
+
c, _, _key = _id.rpartition('/')
|
|
203
203
|
if not c:
|
|
204
204
|
c = "missing_collection"
|
|
205
205
|
return f"{c}/{_key}"
|
|
@@ -80,9 +80,9 @@ class Stix2Arango:
|
|
|
80
80
|
self.file = file
|
|
81
81
|
self._is_large_file = is_large_file
|
|
82
82
|
self.note = stix2arango_note or ""
|
|
83
|
-
self.identity_ref = utils.load_file_from_url(config.STIX2ARANGO_IDENTITY)
|
|
83
|
+
self.identity_ref = utils.load_file_from_url(config.STIX2ARANGO_IDENTITY).copy()
|
|
84
84
|
self.default_ref_objects = [
|
|
85
|
-
utils.load_file_from_url(link)
|
|
85
|
+
utils.load_file_from_url(link).copy()
|
|
86
86
|
for link in config.MARKING_DEFINITION_REFS + config.IDENTITY_REFS
|
|
87
87
|
]
|
|
88
88
|
self.bundle_id = bundle_id
|
|
@@ -469,7 +469,6 @@ class Stix2Arango:
|
|
|
469
469
|
|
|
470
470
|
def map_embedded_relationships(self, bundle_objects, inserted_object_ids):
|
|
471
471
|
objects = []
|
|
472
|
-
inserted_data = []
|
|
473
472
|
for obj in tqdm(bundle_objects, desc="upload_embedded_edges"):
|
|
474
473
|
if obj["id"] not in inserted_object_ids:
|
|
475
474
|
continue
|
stix2arango/utils.py
CHANGED
|
@@ -8,7 +8,7 @@ import json
|
|
|
8
8
|
import hashlib
|
|
9
9
|
import os
|
|
10
10
|
from . import config
|
|
11
|
-
from datetime import datetime
|
|
11
|
+
from datetime import UTC, datetime
|
|
12
12
|
|
|
13
13
|
module_logger = logging.getLogger("data_ingestion_service")
|
|
14
14
|
from arango.database import StandardDatabase
|
|
@@ -37,7 +37,6 @@ def create_relationship_obj(
|
|
|
37
37
|
arango_obj=None,
|
|
38
38
|
extra_data=None,
|
|
39
39
|
):
|
|
40
|
-
insert_data = []
|
|
41
40
|
if not isinstance(targets, list):
|
|
42
41
|
return []
|
|
43
42
|
for target in targets:
|
|
@@ -68,26 +67,18 @@ def create_relationship_obj(
|
|
|
68
67
|
relationship_object["_bundle_id"] = bundle_id
|
|
69
68
|
relationship_object["_file_name"] = os.path.basename(arango_obj.file or "")
|
|
70
69
|
relationship_object["_stix2arango_note"] = arango_obj.note
|
|
71
|
-
relationship_object["_record_created"] = datetime.now().strftime(
|
|
72
|
-
"%Y-%m-%dT%H:%M:%S.%f"
|
|
73
|
-
)
|
|
74
|
-
relationship_object["_record_modified"] = relationship_object["_record_created"]
|
|
75
70
|
relationship_object["_is_ref"] = True
|
|
76
71
|
relationship_object["type"] = "relationship"
|
|
77
72
|
relationship_object["spec_version"] = "2.1"
|
|
78
|
-
|
|
73
|
+
relationship_object["external_references"] = {
|
|
74
|
+
"source_name": "stix2arango",
|
|
75
|
+
"description": "embedded-relationship",
|
|
76
|
+
}
|
|
79
77
|
if extra_data:
|
|
80
78
|
relationship_object.update(extra_data)
|
|
81
79
|
|
|
82
80
|
insert_statement.append(relationship_object)
|
|
83
|
-
|
|
84
|
-
[
|
|
85
|
-
"relationship",
|
|
86
|
-
relationship_object["id"],
|
|
87
|
-
True if "modified" in obj else False,
|
|
88
|
-
]
|
|
89
|
-
)
|
|
90
|
-
return insert_data
|
|
81
|
+
return
|
|
91
82
|
|
|
92
83
|
|
|
93
84
|
def generate_md5(obj: dict):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stix2arango
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
4
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
5
|
Project-URL: Homepage, https://github.com/muchdogesec/stix2arango
|
|
6
6
|
Project-URL: Issues, https://github.com/muchdogesec/stix2arango/issues
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
stix2arango/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
stix2arango/__main__.py,sha256=wbR_iO70Vld2NYiml6Kz4rH396uOiNwTtjNBl4AHZEg,1987
|
|
3
3
|
stix2arango/config.py,sha256=NZFrcnEfz-0QBrut2Rh7xMF78v0bk6U6y2TY_7mHxSs,1407
|
|
4
|
-
stix2arango/utils.py,sha256=
|
|
4
|
+
stix2arango/utils.py,sha256=eVAMvXZVylM2RXzi2ph0RVW__eoSjAHWSWSG3900yjk,4487
|
|
5
5
|
stix2arango/services/__init__.py,sha256=E87fB-dxI4mPxMVs00jdLhjp9jFhkVfjhMKIqGLRJlY,45
|
|
6
|
-
stix2arango/services/arangodb_service.py,sha256=
|
|
6
|
+
stix2arango/services/arangodb_service.py,sha256=jr6zXFueluCU60WOJy7XuA9Ty0zW5FzGNBJGtJzq0PY,11964
|
|
7
7
|
stix2arango/services/version_annotator.py,sha256=Sd1MIaXzK0fpNopNxRoB_3etodzAjX5D_p3uGQSWzOI,2946
|
|
8
8
|
stix2arango/stix2arango/__init__.py,sha256=OqxWEEsHqR1QQpznM5DbFJ5bO5numKYtoYhjXYJMEyg,36
|
|
9
9
|
stix2arango/stix2arango/bundle_loader.py,sha256=qi-0E_bMIMPZXzISvjhrWX8K-f7iFv9vOekldOGVczU,4603
|
|
10
|
-
stix2arango/stix2arango/stix2arango.py,sha256=
|
|
10
|
+
stix2arango/stix2arango/stix2arango.py,sha256=sC-br0nptUtZMzNza6v3s6rjdgJk-EG0_KErN9JN9qQ,22060
|
|
11
11
|
stix2arango/templates/marking-definition.json,sha256=0q9y35mUmiF6xIWSLpkATL4JTHGSCNyLbejqZiQ0AuE,3113
|
|
12
|
-
stix2arango-1.1.
|
|
13
|
-
stix2arango-1.1.
|
|
14
|
-
stix2arango-1.1.
|
|
15
|
-
stix2arango-1.1.
|
|
16
|
-
stix2arango-1.1.
|
|
12
|
+
stix2arango-1.1.3.dist-info/METADATA,sha256=z9lCPIr6WmDFUpxzg4CQhEt_hSlBpGFjqdignPw0mSw,6873
|
|
13
|
+
stix2arango-1.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
+
stix2arango-1.1.3.dist-info/entry_points.txt,sha256=k2WnxMsHFLoyC6rqfvjhIMS1zwtWin51-MbNCGmSMYE,58
|
|
15
|
+
stix2arango-1.1.3.dist-info/licenses/LICENSE,sha256=BK8Ppqlc4pdgnNzIxnxde0taoQ1BgicdyqmBvMiNYgY,11364
|
|
16
|
+
stix2arango-1.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|