@@ -48,6 +48,7 @@ def list(self, **kwargs):
4848 :param list customAttributes: (optional) list of attributes keys to return
4949 :param bool getAll: (optional) switch to return all entries (be careful to use this without any other filters)
5050 :param bool withPagination: (optional) switch to use pagination
51+ :param bool toStix: (optional) get in STIX
5152
5253 :return: List of Indicators
5354 :rtype: list
@@ -63,21 +64,26 @@ def list(self, **kwargs):
6364 get_all = kwargs .get ("getAll" , False )
6465 with_pagination = kwargs .get ("withPagination" , False )
6566 with_files = kwargs .get ("withFiles" , False )
67+ to_stix = kwargs .get ("toStix" , False )
6668
6769 self .opencti .app_logger .info (
6870 "Listing Indicators with filters" , {"filters" : json .dumps (filters )}
6971 )
7072 query = (
7173 """
72- query Indicators($filters: FilterGroup, $search: String, $first: Int, $after: ID, $orderBy: IndicatorsOrdering, $orderMode: OrderingMode) {
73- indicators(filters: $filters, search: $search, first: $first, after: $after, orderBy: $orderBy, orderMode: $orderMode) {
74+ query Indicators($filters: FilterGroup, $search: String, $first: Int, $after: ID, $orderBy: IndicatorsOrdering, $orderMode: OrderingMode, $toStix: Boolean ) {
75+ indicators(filters: $filters, search: $search, first: $first, after: $after, orderBy: $orderBy, orderMode: $orderMode, toStix: $toStix ) {
7476 edges {
7577 node {
7678 """
7779 + (
78- custom_attributes
79- if custom_attributes is not None
80- else (self .properties_with_files if with_files else self .properties )
80+ "toStix"
81+ if to_stix
82+ else (
83+ custom_attributes
84+ if custom_attributes is not None
85+ else (self .properties_with_files if with_files else self .properties )
86+ )
8187 )
8288 + """
8389 }
@@ -102,6 +108,7 @@ def list(self, **kwargs):
102108 "after" : after ,
103109 "orderBy" : order_by ,
104110 "orderMode" : order_mode ,
111+ "toStix" : to_stix ,
105112 },
106113 )
107114 if get_all :
0 commit comments