pycti 6.7.20__py3-none-any.whl → 6.8.0__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 pycti might be problematic. Click here for more details.
- pycti/__init__.py +1 -1
- pycti/connector/opencti_connector_helper.py +190 -3
- pycti/connector/opencti_metric_handler.py +44 -15
- pycti/entities/opencti_attack_pattern.py +32 -6
- pycti/entities/opencti_campaign.py +30 -6
- pycti/entities/opencti_case_incident.py +7 -0
- pycti/entities/opencti_case_rfi.py +7 -0
- pycti/entities/opencti_case_rft.py +7 -0
- pycti/entities/opencti_channel.py +7 -0
- pycti/entities/opencti_course_of_action.py +7 -0
- pycti/entities/opencti_data_component.py +7 -0
- pycti/entities/opencti_data_source.py +7 -0
- pycti/entities/opencti_event.py +32 -6
- pycti/entities/opencti_external_reference.py +8 -0
- pycti/entities/opencti_feedback.py +7 -0
- pycti/entities/opencti_grouping.py +7 -0
- pycti/entities/opencti_identity.py +34 -6
- pycti/entities/opencti_incident.py +7 -0
- pycti/entities/opencti_indicator.py +19 -5
- pycti/entities/opencti_intrusion_set.py +58 -19
- pycti/entities/opencti_kill_chain_phase.py +7 -0
- pycti/entities/opencti_label.py +7 -0
- pycti/entities/opencti_language.py +7 -0
- pycti/entities/opencti_location.py +7 -0
- pycti/entities/opencti_malware.py +60 -18
- pycti/entities/opencti_malware_analysis.py +7 -0
- pycti/entities/opencti_marking_definition.py +7 -0
- pycti/entities/opencti_narrative.py +7 -0
- pycti/entities/opencti_note.py +7 -0
- pycti/entities/opencti_observed_data.py +7 -0
- pycti/entities/opencti_opinion.py +7 -0
- pycti/entities/opencti_report.py +7 -0
- pycti/entities/opencti_stix.py +7 -0
- pycti/entities/opencti_stix_core_object.py +8 -0
- pycti/entities/opencti_stix_core_relationship.py +7 -0
- pycti/entities/opencti_stix_cyber_observable.py +9 -0
- pycti/entities/opencti_stix_domain_object.py +8 -0
- pycti/entities/opencti_stix_nested_ref_relationship.py +7 -0
- pycti/entities/opencti_stix_object_or_stix_relationship.py +7 -0
- pycti/entities/opencti_stix_sighting_relationship.py +7 -0
- pycti/entities/opencti_task.py +7 -0
- pycti/entities/opencti_tool.py +52 -18
- pycti/entities/opencti_vocabulary.py +7 -0
- pycti/entities/opencti_vulnerability.py +7 -0
- pycti/utils/opencti_logger.py +57 -0
- pycti/utils/opencti_stix2.py +41 -0
- pycti/utils/opencti_stix2_splitter.py +5 -0
- pycti/utils/opencti_stix2_utils.py +41 -6
- {pycti-6.7.20.dist-info → pycti-6.8.0.dist-info}/METADATA +1 -1
- pycti-6.8.0.dist-info/RECORD +86 -0
- pycti-6.7.20.dist-info/RECORD +0 -86
- {pycti-6.7.20.dist-info → pycti-6.8.0.dist-info}/WHEEL +0 -0
- {pycti-6.7.20.dist-info → pycti-6.8.0.dist-info}/licenses/LICENSE +0 -0
- {pycti-6.7.20.dist-info → pycti-6.8.0.dist-info}/top_level.txt +0 -0
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class DataComponent:
|
|
10
|
+
"""Main DataComponent class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages MITRE ATT&CK data components in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class DataSource:
|
|
10
|
+
"""Main DataSource class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages MITRE ATT&CK data sources in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
pycti/entities/opencti_event.py
CHANGED
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Event:
|
|
10
|
+
"""Main Event class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages security events in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -226,6 +233,13 @@ class Event:
|
|
|
226
233
|
|
|
227
234
|
@staticmethod
|
|
228
235
|
def generate_id(name):
|
|
236
|
+
"""Generate a STIX ID for an Event.
|
|
237
|
+
|
|
238
|
+
:param name: The name of the event
|
|
239
|
+
:type name: str
|
|
240
|
+
:return: STIX ID for the event
|
|
241
|
+
:rtype: str
|
|
242
|
+
"""
|
|
229
243
|
name = name.lower().strip()
|
|
230
244
|
data = {"name": name}
|
|
231
245
|
data = canonicalize(data, utf8=False)
|
|
@@ -234,19 +248,31 @@ class Event:
|
|
|
234
248
|
|
|
235
249
|
@staticmethod
|
|
236
250
|
def generate_id_from_data(data):
|
|
251
|
+
"""Generate a STIX ID from event data.
|
|
252
|
+
|
|
253
|
+
:param data: Dictionary containing 'name' key
|
|
254
|
+
:type data: dict
|
|
255
|
+
:return: STIX ID for the event
|
|
256
|
+
:rtype: str
|
|
257
|
+
"""
|
|
237
258
|
return Event.generate_id(data["name"])
|
|
238
259
|
|
|
239
|
-
|
|
240
|
-
List Event objects
|
|
260
|
+
def list(self, **kwargs):
|
|
261
|
+
"""List Event objects.
|
|
241
262
|
|
|
242
263
|
:param filters: the filters to apply
|
|
243
264
|
:param search: the search keyword
|
|
244
265
|
:param first: return the first n rows from the after ID (or the beginning if not set)
|
|
245
266
|
:param after: ID of the first row for pagination
|
|
246
|
-
:
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
267
|
+
:param orderBy: field to order results by
|
|
268
|
+
:param orderMode: ordering mode (asc/desc)
|
|
269
|
+
:param customAttributes: custom attributes to return
|
|
270
|
+
:param getAll: whether to retrieve all results
|
|
271
|
+
:param withPagination: whether to include pagination info
|
|
272
|
+
:param withFiles: whether to include files
|
|
273
|
+
:return: List of Event objects
|
|
274
|
+
:rtype: list
|
|
275
|
+
"""
|
|
250
276
|
filters = kwargs.get("filters", None)
|
|
251
277
|
search = kwargs.get("search", None)
|
|
252
278
|
first = kwargs.get("first", 100)
|
|
@@ -9,6 +9,14 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class ExternalReference:
|
|
12
|
+
"""Main ExternalReference class for OpenCTI
|
|
13
|
+
|
|
14
|
+
Manages external references and citations in the OpenCTI platform.
|
|
15
|
+
|
|
16
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
17
|
+
:param file: file handling configuration
|
|
18
|
+
"""
|
|
19
|
+
|
|
12
20
|
def __init__(self, opencti, file):
|
|
13
21
|
self.opencti = opencti
|
|
14
22
|
self.file = file
|
|
@@ -6,6 +6,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class Feedback:
|
|
9
|
+
"""Main Feedback class for OpenCTI
|
|
10
|
+
|
|
11
|
+
Manages feedback and analyst assessments in the OpenCTI platform.
|
|
12
|
+
|
|
13
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
14
|
+
"""
|
|
15
|
+
|
|
9
16
|
def __init__(self, opencti):
|
|
10
17
|
self.opencti = opencti
|
|
11
18
|
self.properties = """
|
|
@@ -8,6 +8,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Grouping:
|
|
11
|
+
"""Main Grouping class for OpenCTI
|
|
12
|
+
|
|
13
|
+
Manages STIX grouping objects in the OpenCTI platform.
|
|
14
|
+
|
|
15
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
16
|
+
"""
|
|
17
|
+
|
|
11
18
|
def __init__(self, opencti):
|
|
12
19
|
self.opencti = opencti
|
|
13
20
|
self.properties = """
|
|
@@ -9,6 +9,13 @@ from pycti.utils.constants import IdentityTypes
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Identity:
|
|
12
|
+
"""Main Identity class for OpenCTI
|
|
13
|
+
|
|
14
|
+
Manages individual, organization, and system identities in OpenCTI.
|
|
15
|
+
|
|
16
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
17
|
+
"""
|
|
18
|
+
|
|
12
19
|
def __init__(self, opencti):
|
|
13
20
|
self.opencti = opencti
|
|
14
21
|
self.properties = """
|
|
@@ -258,6 +265,15 @@ class Identity:
|
|
|
258
265
|
|
|
259
266
|
@staticmethod
|
|
260
267
|
def generate_id(name, identity_class):
|
|
268
|
+
"""Generate a STIX ID for an Identity.
|
|
269
|
+
|
|
270
|
+
:param name: The name of the identity
|
|
271
|
+
:type name: str
|
|
272
|
+
:param identity_class: The class of the identity (individual, group, organization, etc.)
|
|
273
|
+
:type identity_class: str
|
|
274
|
+
:return: STIX ID for the identity
|
|
275
|
+
:rtype: str
|
|
276
|
+
"""
|
|
261
277
|
data = {"name": name.lower().strip(), "identity_class": identity_class.lower()}
|
|
262
278
|
data = canonicalize(data, utf8=False)
|
|
263
279
|
id = str(uuid.uuid5(uuid.UUID("00abedb4-aa42-466c-9c01-fed23315a9b7"), data))
|
|
@@ -265,20 +281,32 @@ class Identity:
|
|
|
265
281
|
|
|
266
282
|
@staticmethod
|
|
267
283
|
def generate_id_from_data(data):
|
|
284
|
+
"""Generate a STIX ID from identity data.
|
|
285
|
+
|
|
286
|
+
:param data: Dictionary containing 'name' and 'identity_class' keys
|
|
287
|
+
:type data: dict
|
|
288
|
+
:return: STIX ID for the identity
|
|
289
|
+
:rtype: str
|
|
290
|
+
"""
|
|
268
291
|
return Identity.generate_id(data["name"], data["identity_class"])
|
|
269
292
|
|
|
270
|
-
|
|
271
|
-
List Identity objects
|
|
293
|
+
def list(self, **kwargs):
|
|
294
|
+
"""List Identity objects.
|
|
272
295
|
|
|
273
296
|
:param types: the list of types
|
|
274
297
|
:param filters: the filters to apply
|
|
275
298
|
:param search: the search keyword
|
|
276
299
|
:param first: return the first n rows from the after ID (or the beginning if not set)
|
|
277
300
|
:param after: ID of the first row for pagination
|
|
278
|
-
:
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
301
|
+
:param orderBy: field to order results by
|
|
302
|
+
:param orderMode: ordering mode (asc/desc)
|
|
303
|
+
:param customAttributes: custom attributes to return
|
|
304
|
+
:param getAll: whether to retrieve all results
|
|
305
|
+
:param withPagination: whether to include pagination info
|
|
306
|
+
:param withFiles: whether to include files
|
|
307
|
+
:return: List of Identity objects
|
|
308
|
+
:rtype: list
|
|
309
|
+
"""
|
|
282
310
|
types = kwargs.get("types", None)
|
|
283
311
|
filters = kwargs.get("filters", None)
|
|
284
312
|
search = kwargs.get("search", None)
|
|
@@ -8,6 +8,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Incident:
|
|
11
|
+
"""Main Incident class for OpenCTI
|
|
12
|
+
|
|
13
|
+
Manages security incidents in the OpenCTI platform.
|
|
14
|
+
|
|
15
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
16
|
+
"""
|
|
17
|
+
|
|
11
18
|
def __init__(self, opencti):
|
|
12
19
|
self.opencti = opencti
|
|
13
20
|
self.properties = """
|
|
@@ -24,6 +24,13 @@ class Indicator:
|
|
|
24
24
|
|
|
25
25
|
@staticmethod
|
|
26
26
|
def generate_id(pattern):
|
|
27
|
+
"""Generate a STIX ID for an Indicator.
|
|
28
|
+
|
|
29
|
+
:param pattern: The STIX pattern
|
|
30
|
+
:type pattern: str
|
|
31
|
+
:return: STIX ID for the indicator
|
|
32
|
+
:rtype: str
|
|
33
|
+
"""
|
|
27
34
|
data = {"pattern": pattern.strip()}
|
|
28
35
|
data = canonicalize(data, utf8=False)
|
|
29
36
|
id = str(uuid.uuid5(uuid.UUID("00abedb4-aa42-466c-9c01-fed23315a9b7"), data))
|
|
@@ -31,6 +38,13 @@ class Indicator:
|
|
|
31
38
|
|
|
32
39
|
@staticmethod
|
|
33
40
|
def generate_id_from_data(data):
|
|
41
|
+
"""Generate a STIX ID from indicator data.
|
|
42
|
+
|
|
43
|
+
:param data: Dictionary containing 'pattern' key
|
|
44
|
+
:type data: dict
|
|
45
|
+
:return: STIX ID for the indicator
|
|
46
|
+
:rtype: str
|
|
47
|
+
"""
|
|
34
48
|
return Indicator.generate_id(data["pattern"])
|
|
35
49
|
|
|
36
50
|
def list(self, **kwargs):
|
|
@@ -301,14 +315,14 @@ class Indicator:
|
|
|
301
315
|
"name or pattern or pattern_type or x_opencti_main_observable_type"
|
|
302
316
|
)
|
|
303
317
|
|
|
304
|
-
|
|
305
|
-
Update an Indicator object field
|
|
318
|
+
def update_field(self, **kwargs):
|
|
319
|
+
"""Update an Indicator object field.
|
|
306
320
|
|
|
307
321
|
:param id: the Indicator id
|
|
308
322
|
:param input: the input of the field
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
323
|
+
:return: Updated indicator object
|
|
324
|
+
:rtype: dict or None
|
|
325
|
+
"""
|
|
312
326
|
id = kwargs.get("id", None)
|
|
313
327
|
input = kwargs.get("input", None)
|
|
314
328
|
if id is not None and input is not None:
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class IntrusionSet:
|
|
10
|
+
"""Main IntrusionSet class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages intrusion sets (APT groups) in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -232,6 +239,13 @@ class IntrusionSet:
|
|
|
232
239
|
|
|
233
240
|
@staticmethod
|
|
234
241
|
def generate_id(name):
|
|
242
|
+
"""Generate a STIX ID for an Intrusion Set.
|
|
243
|
+
|
|
244
|
+
:param name: The name of the intrusion set
|
|
245
|
+
:type name: str
|
|
246
|
+
:return: STIX ID for the intrusion set
|
|
247
|
+
:rtype: str
|
|
248
|
+
"""
|
|
235
249
|
name = name.lower().strip()
|
|
236
250
|
data = {"name": name}
|
|
237
251
|
data = canonicalize(data, utf8=False)
|
|
@@ -240,19 +254,31 @@ class IntrusionSet:
|
|
|
240
254
|
|
|
241
255
|
@staticmethod
|
|
242
256
|
def generate_id_from_data(data):
|
|
257
|
+
"""Generate a STIX ID from intrusion set data.
|
|
258
|
+
|
|
259
|
+
:param data: Dictionary containing 'name' key
|
|
260
|
+
:type data: dict
|
|
261
|
+
:return: STIX ID for the intrusion set
|
|
262
|
+
:rtype: str
|
|
263
|
+
"""
|
|
243
264
|
return IntrusionSet.generate_id(data["name"])
|
|
244
265
|
|
|
245
|
-
|
|
246
|
-
List Intrusion
|
|
266
|
+
def list(self, **kwargs):
|
|
267
|
+
"""List Intrusion Set objects.
|
|
247
268
|
|
|
248
269
|
:param filters: the filters to apply
|
|
249
270
|
:param search: the search keyword
|
|
250
271
|
:param first: return the first n rows from the after ID (or the beginning if not set)
|
|
251
272
|
:param after: ID of the first row for pagination
|
|
252
|
-
:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
273
|
+
:param orderBy: field to order results by
|
|
274
|
+
:param orderMode: ordering mode (asc/desc)
|
|
275
|
+
:param customAttributes: custom attributes to return
|
|
276
|
+
:param getAll: whether to retrieve all results
|
|
277
|
+
:param withPagination: whether to include pagination info
|
|
278
|
+
:param withFiles: whether to include files
|
|
279
|
+
:return: List of Intrusion Set objects
|
|
280
|
+
:rtype: list
|
|
281
|
+
"""
|
|
256
282
|
filters = kwargs.get("filters", None)
|
|
257
283
|
search = kwargs.get("search", None)
|
|
258
284
|
first = kwargs.get("first", 500)
|
|
@@ -328,15 +354,16 @@ class IntrusionSet:
|
|
|
328
354
|
result["data"]["intrusionSets"], with_pagination
|
|
329
355
|
)
|
|
330
356
|
|
|
331
|
-
|
|
332
|
-
Read
|
|
357
|
+
def read(self, **kwargs):
|
|
358
|
+
"""Read an Intrusion Set object.
|
|
333
359
|
|
|
334
|
-
:param id: the id of the Intrusion
|
|
360
|
+
:param id: the id of the Intrusion Set
|
|
335
361
|
:param filters: the filters to apply if no id provided
|
|
336
|
-
:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
362
|
+
:param customAttributes: custom attributes to return
|
|
363
|
+
:param withFiles: whether to include files
|
|
364
|
+
:return: Intrusion Set object
|
|
365
|
+
:rtype: dict or None
|
|
366
|
+
"""
|
|
340
367
|
id = kwargs.get("id", None)
|
|
341
368
|
filters = kwargs.get("filters", None)
|
|
342
369
|
custom_attributes = kwargs.get("customAttributes", None)
|
|
@@ -372,14 +399,26 @@ class IntrusionSet:
|
|
|
372
399
|
)
|
|
373
400
|
return None
|
|
374
401
|
|
|
375
|
-
|
|
376
|
-
Create
|
|
402
|
+
def create(self, **kwargs):
|
|
403
|
+
"""Create an Intrusion Set object.
|
|
377
404
|
|
|
378
405
|
:param name: the name of the Intrusion Set
|
|
379
|
-
:
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
406
|
+
:param description: description of the intrusion set
|
|
407
|
+
:param aliases: list of aliases
|
|
408
|
+
:param first_seen: first seen date
|
|
409
|
+
:param last_seen: last seen date
|
|
410
|
+
:param goals: goals of the intrusion set
|
|
411
|
+
:param resource_level: resource level
|
|
412
|
+
:param primary_motivation: primary motivation
|
|
413
|
+
:param secondary_motivations: secondary motivations
|
|
414
|
+
:param createdBy: creator identity
|
|
415
|
+
:param objectMarking: marking definitions
|
|
416
|
+
:param objectLabel: labels
|
|
417
|
+
:param externalReferences: external references
|
|
418
|
+
:param update: whether to update existing intrusion set
|
|
419
|
+
:return: Intrusion Set object
|
|
420
|
+
:rtype: dict or None
|
|
421
|
+
"""
|
|
383
422
|
stix_id = kwargs.get("stix_id", None)
|
|
384
423
|
created_by = kwargs.get("createdBy", None)
|
|
385
424
|
object_marking = kwargs.get("objectMarking", None)
|
|
@@ -6,6 +6,13 @@ from pycti.utils.opencti_stix2_identifier import kill_chain_phase_generate_id
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class KillChainPhase:
|
|
9
|
+
"""Main KillChainPhase class for OpenCTI
|
|
10
|
+
|
|
11
|
+
Manages kill chain phases (ATT&CK tactics) in the OpenCTI platform.
|
|
12
|
+
|
|
13
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
14
|
+
"""
|
|
15
|
+
|
|
9
16
|
def __init__(self, opencti):
|
|
10
17
|
self.opencti = opencti
|
|
11
18
|
self.properties = """
|
pycti/entities/opencti_label.py
CHANGED
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Label:
|
|
10
|
+
"""Main Label class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages labels and tags in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Language:
|
|
10
|
+
"""Main Language class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages language entities in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Location:
|
|
10
|
+
"""Main Location class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages geographic locations (countries, cities, regions) in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Malware:
|
|
10
|
+
"""Main Malware class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages malware families and variants in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -260,6 +267,13 @@ class Malware:
|
|
|
260
267
|
|
|
261
268
|
@staticmethod
|
|
262
269
|
def generate_id(name):
|
|
270
|
+
"""Generate a STIX ID for a Malware.
|
|
271
|
+
|
|
272
|
+
:param name: The name of the malware
|
|
273
|
+
:type name: str
|
|
274
|
+
:return: STIX ID for the malware
|
|
275
|
+
:rtype: str
|
|
276
|
+
"""
|
|
263
277
|
name = name.lower().strip()
|
|
264
278
|
data = {"name": name}
|
|
265
279
|
data = canonicalize(data, utf8=False)
|
|
@@ -268,19 +282,31 @@ class Malware:
|
|
|
268
282
|
|
|
269
283
|
@staticmethod
|
|
270
284
|
def generate_id_from_data(data):
|
|
285
|
+
"""Generate a STIX ID from malware data.
|
|
286
|
+
|
|
287
|
+
:param data: Dictionary containing 'name' key
|
|
288
|
+
:type data: dict
|
|
289
|
+
:return: STIX ID for the malware
|
|
290
|
+
:rtype: str
|
|
291
|
+
"""
|
|
271
292
|
return Malware.generate_id(data["name"])
|
|
272
293
|
|
|
273
|
-
|
|
274
|
-
List Malware objects
|
|
294
|
+
def list(self, **kwargs):
|
|
295
|
+
"""List Malware objects.
|
|
275
296
|
|
|
276
297
|
:param filters: the filters to apply
|
|
277
298
|
:param search: the search keyword
|
|
278
299
|
:param first: return the first n rows from the after ID (or the beginning if not set)
|
|
279
300
|
:param after: ID of the first row for pagination
|
|
280
|
-
:
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
301
|
+
:param orderBy: field to order results by
|
|
302
|
+
:param orderMode: ordering mode (asc/desc)
|
|
303
|
+
:param customAttributes: custom attributes to return
|
|
304
|
+
:param getAll: whether to retrieve all results
|
|
305
|
+
:param withPagination: whether to include pagination info
|
|
306
|
+
:param withFiles: whether to include files
|
|
307
|
+
:return: List of Malware objects
|
|
308
|
+
:rtype: list
|
|
309
|
+
"""
|
|
284
310
|
filters = kwargs.get("filters", None)
|
|
285
311
|
search = kwargs.get("search", None)
|
|
286
312
|
first = kwargs.get("first", 500)
|
|
@@ -359,15 +385,16 @@ class Malware:
|
|
|
359
385
|
result["data"]["malwares"], with_pagination
|
|
360
386
|
)
|
|
361
387
|
|
|
362
|
-
|
|
363
|
-
Read a Malware object
|
|
388
|
+
def read(self, **kwargs):
|
|
389
|
+
"""Read a Malware object.
|
|
364
390
|
|
|
365
391
|
:param id: the id of the Malware
|
|
366
392
|
:param filters: the filters to apply if no id provided
|
|
367
|
-
:
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
393
|
+
:param customAttributes: custom attributes to return
|
|
394
|
+
:param withFiles: whether to include files
|
|
395
|
+
:return: Malware object
|
|
396
|
+
:rtype: dict or None
|
|
397
|
+
"""
|
|
371
398
|
id = kwargs.get("id", None)
|
|
372
399
|
filters = kwargs.get("filters", None)
|
|
373
400
|
custom_attributes = kwargs.get("customAttributes", None)
|
|
@@ -403,14 +430,29 @@ class Malware:
|
|
|
403
430
|
)
|
|
404
431
|
return None
|
|
405
432
|
|
|
406
|
-
|
|
407
|
-
Create a Malware object
|
|
433
|
+
def create(self, **kwargs):
|
|
434
|
+
"""Create a Malware object.
|
|
408
435
|
|
|
409
436
|
:param name: the name of the Malware
|
|
410
|
-
:
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
437
|
+
:param description: description of the malware
|
|
438
|
+
:param aliases: list of aliases
|
|
439
|
+
:param malware_types: types of malware
|
|
440
|
+
:param is_family: whether this is a malware family
|
|
441
|
+
:param first_seen: first seen date
|
|
442
|
+
:param last_seen: last seen date
|
|
443
|
+
:param architecture_execution_envs: execution environments
|
|
444
|
+
:param implementation_languages: implementation languages
|
|
445
|
+
:param capabilities: malware capabilities
|
|
446
|
+
:param killChainPhases: kill chain phases
|
|
447
|
+
:param samples: malware samples
|
|
448
|
+
:param createdBy: creator identity
|
|
449
|
+
:param objectMarking: marking definitions
|
|
450
|
+
:param objectLabel: labels
|
|
451
|
+
:param externalReferences: external references
|
|
452
|
+
:param update: whether to update existing malware
|
|
453
|
+
:return: Malware object
|
|
454
|
+
:rtype: dict or None
|
|
455
|
+
"""
|
|
414
456
|
stix_id = kwargs.get("stix_id", None)
|
|
415
457
|
created_by = kwargs.get("createdBy", None)
|
|
416
458
|
object_marking = kwargs.get("objectMarking", None)
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class MalwareAnalysis:
|
|
10
|
+
"""Main MalwareAnalysis class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages malware analysis reports and results in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class MarkingDefinition:
|
|
10
|
+
"""Main MarkingDefinition class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages marking definitions (TLP, statements) in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Narrative:
|
|
10
|
+
"""Main Narrative class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages narratives and disinformation campaigns in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
pycti/entities/opencti_note.py
CHANGED
|
@@ -8,6 +8,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Note:
|
|
11
|
+
"""Main Note class for OpenCTI
|
|
12
|
+
|
|
13
|
+
Manages notes and annotations in the OpenCTI platform.
|
|
14
|
+
|
|
15
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
16
|
+
"""
|
|
17
|
+
|
|
11
18
|
def __init__(self, opencti):
|
|
12
19
|
self.opencti = opencti
|
|
13
20
|
self.properties = """
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class ObservedData:
|
|
10
|
+
"""Main ObservedData class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages observed data and raw intelligence in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|
|
@@ -7,6 +7,13 @@ from stix2.canonicalization.Canonicalize import canonicalize
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Opinion:
|
|
10
|
+
"""Main Opinion class for OpenCTI
|
|
11
|
+
|
|
12
|
+
Manages analyst opinions and assessments in the OpenCTI platform.
|
|
13
|
+
|
|
14
|
+
:param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient`
|
|
15
|
+
"""
|
|
16
|
+
|
|
10
17
|
def __init__(self, opencti):
|
|
11
18
|
self.opencti = opencti
|
|
12
19
|
self.properties = """
|