@@ -1836,7 +1836,7 @@ def get_techniques_used_by_all_groups(self, stix_format: bool = True) -> List:
18361836 groups_use_techniques = self .parse_stix_objects (groups_use_techniques , GroupTechnique )
18371837 return groups_use_techniques
18381838
1839- def get_software_used_by_group (self , stix_object : Any = None , stix_format : bool = True ) -> List :
1839+ def get_software_used_by_group (self , stix_object : Any = None , stix_format : bool = True , batch_size = 10 ) -> List :
18401840 """
18411841 Retrieves techniques used by a specified group STIX object across all ATT&CK matrices.
18421842
@@ -1845,6 +1845,8 @@ def get_software_used_by_group(self, stix_object: Any = None, stix_format: bool
18451845 stix_format (bool, optional): If True, returns technique objects in their original STIX format. If False,
18461846 returns techniques as custom dictionaries parsed according to the Technique Pydantic model.
18471847 Default is True.
1848+ batch_size (int): The batch size to use when querying the TAXII datastore. Use a lower batch size if the
1849+ URI becomes too long and you get HTTP 414 errors.
18481850
18491851 Returns:
18501852 List: A list of software objects used by a specific group, either as raw STIX objects or as custom dictionaries following the
@@ -1857,11 +1859,17 @@ def get_software_used_by_group(self, stix_object: Any = None, stix_format: bool
18571859 software_relationships .append (relation )
18581860 if len (software_relationships ) == 0 :
18591861 return software_relationships
1860- filter_objects = [
1861- Filter ('type' , 'in' , ['malware' , 'tool' ]),
1862- Filter ('id' , '=' , [r .target_ref for r in software_relationships ])
1863- ]
1864- all_software = self .COMPOSITE_DS .query (filter_objects )
1862+
1863+ all_software = []
1864+
1865+ for software_relation_batch in [software_relationships [i :i + batch_size ] for i in range (0 , len (software_relationships ), batch_size )]:
1866+ filter_objects = [
1867+ Filter ('type' , 'in' , ['malware' , 'tool' ]),
1868+ Filter ('id' , '=' , [r .target_ref for r in software_relation_batch ])
1869+ ]
1870+
1871+ search_results = self .COMPOSITE_DS .query (filter_objects )
1872+ all_software .extend (search_results )
18651873
18661874 if not stix_format :
18671875 all_software = self .parse_stix_objects (all_software , Software )
0 commit comments