Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 079fafc

Browse files
author
Samuel Hassine
committed
[client] Introduce the notion of only_contextual connectors
1 parent 6ccef4e commit 079fafc

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

pycti/connector/opencti_connector.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,19 @@ def __init__(
4040
connector_type: str,
4141
scope: str,
4242
auto: bool,
43+
only_contextual: bool,
4344
):
4445
self.id = connector_id
4546
self.name = connector_name
4647
self.type = ConnectorType(connector_type)
4748
if self.type is None:
4849
raise ValueError("Invalid connector type: " + connector_type)
49-
self.scope = scope.split(",")
50+
if scope and len(scope) > 0:
51+
self.scope = scope.split(",")
52+
else:
53+
self.scope = []
5054
self.auto = auto
55+
self.only_contextual = only_contextual
5156

5257
def to_input(self) -> dict:
5358
"""connector input to use in API query
@@ -62,5 +67,6 @@ def to_input(self) -> dict:
6267
"type": self.type.name,
6368
"scope": self.scope,
6469
"auto": self.auto,
70+
"only_contextual": self.only_contextual,
6571
}
6672
}

pycti/connector/opencti_connector_helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,13 @@ def __init__(self, config: dict):
340340
self.connect_auto = get_config_variable(
341341
"CONNECTOR_AUTO", ["connector", "auto"], config, False, False
342342
)
343+
self.connect_only_contextual = get_config_variable(
344+
"CONNECTOR_ONLY_CONTEXTUAL",
345+
["connector", "only_contextual"],
346+
config,
347+
False,
348+
False,
349+
)
343350
self.log_level = get_config_variable(
344351
"CONNECTOR_LOG_LEVEL", ["connector", "log_level"], config
345352
)
@@ -361,6 +368,7 @@ def __init__(self, config: dict):
361368
self.connect_type,
362369
self.connect_scope,
363370
self.connect_auto,
371+
self.connect_only_contextual,
364372
)
365373
connector_configuration = self.api.connector.register(self.connector)
366374
logging.info("Connector registered with ID:" + self.connect_id)

0 commit comments

Comments
 (0)