Skip to content

Commit 3af970c

Browse files
author
Samuel Hassine
committed
[client] Add new relation between Attack Pattern and Vulnerability
1 parent 2d04513 commit 3af970c

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

examples/create_incident_with_ttps_and_indicators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pycti import OpenCTIApiClient
77

88
# Variables
9-
api_url = "https://demo.opencti.io"
9+
api_url = "https://reference.opencti.io"
1010
api_token = "2b4f29e3-5ea8-4890-8cf5-a76f61f1e2b2"
1111

1212
# OpenCTI initialization

pycti/api/opencti_api_client.py

+3
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,9 @@ def resolve_role(self, relation_type, from_type, to_type):
17351735
"organization": {"from_role": "source", "to_role": "target"},
17361736
"vulnerability": {"from_role": "source", "to_role": "target"},
17371737
},
1738+
"attack-pattern": {
1739+
"vulnerability": {"from_role": "source", "to_role": "target"},
1740+
},
17381741
},
17391742
"attributed-to": {
17401743
"threat-actor": {

pycti/entities/opencti_stix_observable.py

+25-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,31 @@ def list(self, **kwargs):
165165
"orderMode": order_mode,
166166
},
167167
)
168-
return self.opencti.process_multiple(result["data"]["stixObservables"])
168+
169+
if get_all:
170+
final_data = []
171+
data = self.opencti.process_multiple(result["data"]["stixObservables"])
172+
final_data = final_data + data
173+
while result["data"]["stixObservables"]["pageInfo"]["hasNextPage"]:
174+
after = result["data"]["stixObservables"]["pageInfo"]["endCursor"]
175+
self.opencti.log("info", "Listing StixObservables after " + after)
176+
result = self.opencti.query(
177+
query,
178+
{
179+
"types": types,
180+
"filters": filters,
181+
"search": search,
182+
"first": first,
183+
"after": after,
184+
"orderBy": order_by,
185+
"orderMode": order_mode,
186+
},
187+
)
188+
data = self.opencti.process_multiple(result["data"]["stixObservables"])
189+
final_data = final_data + data
190+
return final_data
191+
else:
192+
return self.opencti.process_multiple(result["data"]["stixObservables"])
169193

170194
"""
171195
Read a StixObservable object

0 commit comments

Comments
 (0)