This repository was archived by the owner on Dec 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +36
-6
lines changed
Expand file tree Collapse file tree 3 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 1+ # coding: utf-8
2+ from more_itertools .more import first
3+
4+ from pycti import OpenCTIApiClient
5+
6+ # Variables
7+ api_url = "http://localhost:4000"
8+ api_token = "d434ce02-e58e-4cac-8b4c-42bf16748e84"
9+
10+ # OpenCTI initialization
11+ opencti_api_client = OpenCTIApiClient (api_url , api_token )
12+
13+ # List all TA
14+ actors = opencti_api_client .threat_actor .list ()
15+
16+ # Print
17+
18+ print (actors )
Original file line number Diff line number Diff line change @@ -216,7 +216,9 @@ def list(self, **kwargs) -> dict:
216216 final_data = final_data + data
217217 while result ["data" ]["threatActorsGroup" ]["pageInfo" ]["hasNextPage" ]:
218218 after = result ["data" ]["threatActorsGroup" ]["pageInfo" ]["endCursor" ]
219- self .opencti .app_logger .info ("Listing threatActorsGroup" , {"after" : after })
219+ self .opencti .app_logger .info (
220+ "Listing threatActorsGroup" , {"after" : after }
221+ )
220222 result = self .opencti .query (
221223 query ,
222224 {
@@ -228,7 +230,9 @@ def list(self, **kwargs) -> dict:
228230 "orderMode" : order_mode ,
229231 },
230232 )
231- data = self .opencti .process_multiple (result ["data" ]["threatActorsGroup" ])
233+ data = self .opencti .process_multiple (
234+ result ["data" ]["threatActorsGroup" ]
235+ )
232236 final_data = final_data + data
233237 return final_data
234238 else :
Original file line number Diff line number Diff line change @@ -213,11 +213,17 @@ def list(self, **kwargs) -> dict:
213213 )
214214 if get_all :
215215 final_data = []
216- data = self .opencti .process_multiple (result ["data" ]["threatActorsIndividuals" ])
216+ data = self .opencti .process_multiple (
217+ result ["data" ]["threatActorsIndividuals" ]
218+ )
217219 final_data = final_data + data
218220 while result ["data" ]["threatActorsIndividuals" ]["pageInfo" ]["hasNextPage" ]:
219- after = result ["data" ]["threatActorsIndividuals" ]["pageInfo" ]["endCursor" ]
220- self .opencti .app_logger .info ("Listing threatActorsIndividuals" , {"after" : after })
221+ after = result ["data" ]["threatActorsIndividuals" ]["pageInfo" ][
222+ "endCursor"
223+ ]
224+ self .opencti .app_logger .info (
225+ "Listing threatActorsIndividuals" , {"after" : after }
226+ )
221227 result = self .opencti .query (
222228 query ,
223229 {
@@ -229,7 +235,9 @@ def list(self, **kwargs) -> dict:
229235 "orderMode" : order_mode ,
230236 },
231237 )
232- data = self .opencti .process_multiple (result ["data" ]["threatActorsIndividuals" ])
238+ data = self .opencti .process_multiple (
239+ result ["data" ]["threatActorsIndividuals" ]
240+ )
233241 final_data = final_data + data
234242 return final_data
235243 else :
You can’t perform that action at this time.
0 commit comments