Skip to content

Commit 5b08b53

Browse files
author
Samuel Hassine
committed
Merge branch 'master' of github.com:OpenCTI-Platform/client-python
2 parents 4f2cf0d + d64bf7f commit 5b08b53

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pycti/opencti_connector_helper.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,15 @@ def _create_channel(self):
6969
def _create_queue(self):
7070
if self.channel is not None:
7171
config_encoded = base64.b64encode(json.dumps(self.config).encode('utf-8')).decode('utf-8')
72-
self.channel.queue_delete(self.queue_name)
73-
self.channel.queue_declare(self.queue_name, durable=True, arguments={'config': config_encoded})
72+
check = self.channel.queue_declare(self.queue_name, durable=True, passive=True, arguments={'config': config_encoded})
73+
if not check:
74+
self.channel.queue_delete(self.queue_name)
75+
self.channel.queue_declare(self.queue_name, durable=True, arguments={'config': config_encoded})
7476
self.channel.queue_bind(queue=self.queue_name, exchange=EXCHANGE_NAME, routing_key=self.routing_key)
7577

7678
def _reconnect(self):
7779
self.connection = self._connect()
7880
self.channel = self._create_channel()
79-
self._create_queue()
8081

8182
def send_stix2_bundle(self, bundle, entities_types=[]):
8283
bundles = self.split_stix2_bundle(bundle)
@@ -89,7 +90,7 @@ def _send_bundle(self, type, bundle, entities_types=[]):
8990
:param bundle: A valid STIX2 bundle
9091
:param entities_types: Entities types to ingest
9192
"""
92-
if not self.channel.is_open:
93+
if self.channel is None or not self.channel.is_open:
9394
self._reconnect()
9495

9596
# Validate the STIX 2 bundle

pycti/opencti_stix2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def import_object(self, stix_object, update=False):
356356
title,
357357
external_reference['description'] if 'description' in external_reference else None,
358358
published,
359-
'external',
359+
'Threat Report',
360360
2
361361
)['id']
362362

0 commit comments

Comments
 (0)