Skip to content

Commit

Permalink
[client] Handle importing tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Hassine committed Dec 20, 2019
1 parent 59e7aba commit c07f5cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 2.1.6 (20/12/2019)
*No changelog for this release.*

---

## Version 2.1.5 (19/12/2019)

#### Enhancements:
Expand Down
8 changes: 8 additions & 0 deletions pycti/utils/opencti_stix2.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def import_object(self, stix_object, update=False, types=None):
embedded_relationships = self.extract_embedded_relationships(stix_object, types)
created_by_ref_id = embedded_relationships['created_by_ref']
marking_definitions_ids = embedded_relationships['marking_definitions']
tags_ids = embedded_relationships['tags']
kill_chain_phases_ids = embedded_relationships['kill_chain_phases']
object_refs_ids = embedded_relationships['object_refs']
external_references_ids = embedded_relationships['external_references']
Expand Down Expand Up @@ -357,6 +358,13 @@ def import_object(self, stix_object, update=False, types=None):
entity=stix_object_result,
marking_definition_id=marking_definition_id
)
# Add tags
for tag_id in tags_ids:
self.opencti.stix_entity.add_tag(
id=stix_object_result['id'],
entity=stix_object_result,
marking_definition_id=tag_id
)
# Add external references
for external_reference_id in external_references_ids:
self.opencti.stix_entity.add_external_reference(
Expand Down

0 comments on commit c07f5cf

Please sign in to comment.