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

Commit 1167aa0

Browse files
author
Samuel Hassine
committed
[client] Fix export of incidents
1 parent de98c93 commit 1167aa0

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

pycti/entities/opencti_x_opencti_incident.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def list(self, **kwargs):
127127
)
128128
query = (
129129
"""
130-
query XOpenCTIIncidents($filters: [IncidentsFiltering], $search: String, $first: Int, $after: ID, $orderBy: IncidentsOrdering, $orderMode: OrderingMode) {
130+
query XOpenCTIIncidents($filters: [IncidentsFiltering], $search: String, $first: Int, $after: ID, $orderBy: XOpenCTIIncidentsOrdering, $orderMode: OrderingMode) {
131131
xOpenCTIIncidents(filters: $filters, search: $search, first: $first, after: $after, orderBy: $orderBy, orderMode: $orderMode) {
132132
edges {
133133
node {

pycti/utils/opencti_stix2.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,12 @@ def generate_export(self, entity):
914914
if LocationTypes.has_value(entity["entity_type"]):
915915
entity["entity_type"] = "Location"
916916

917+
# Indicators
918+
if "pattern" in entity and "x-opencti-hostname" in entity["pattern"]:
919+
entity["pattern"] = entity["pattern"].replace(
920+
"x-opencti-hostname", "domain-name"
921+
)
922+
917923
# Flatten
918924
if "objectLabel" in entity and len(entity["objectLabel"]) > 0:
919925
entity["labels"] = []
@@ -958,6 +964,11 @@ def generate_export(self, entity):
958964
if "externalReferences" in entity:
959965
del entity["externalReferences"]
960966
del entity["externalReferencesIds"]
967+
if "hashes" in entity:
968+
hashes = entity["hashes"]
969+
entity["hashes"] = {}
970+
for hash in hashes:
971+
entity["hashes"][hash["algorithm"]] = hash["hash"]
961972

962973
# Final
963974
entity["x_opencti_id"] = entity["id"]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from setuptools import setup
66
from setuptools.command.install import install
77

8-
VERSION = "4.2.3"
8+
VERSION = "4.2.4"
99

1010
with open("README.md", "r") as fh:
1111
long_description = fh.read()

0 commit comments

Comments
 (0)