Skip to content

Updated Type Annotations and Docstrings #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions attackcti/attack_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,16 +1437,21 @@ def get_techniques_by_content(self, content: str, stix_format: bool = True) -> L
return matched_techniques


def get_techniques_by_platform(self, name, case=True, stix_format=True ):
""" Extracts techniques STIX object by platform across all ATT&CK matrices
def get_techniques_by_platform(self, name: str, case: bool = True, stix_format: bool = True) -> List:
"""
Retrieves techniques STIX objects associated with a specific platform across all ATT&CK matrices.
The search can be case-sensitive or case-insensitive.

Args:
case (bool) : case sensitive or not
stix_format (bool): Returns results in original STIX format or friendly syntax (e.g. 'attack-pattern' or 'technique')

name (str): The name of the platform to search for within the technique's platform.
case (bool, optional): Determines if the search should be case sensitive. Default is True.
stix_format (bool, optional): If True, returns technique objects in their original STIX format. If False,
returns techniques as custom dictionaries parsed according to the Technique Pydantic model.
Default is True.

Returns:
List of STIX objects

List: A list containing the matched technique objects, either as raw STIX objects or as custom dictionaries
following the structure defined by the Technique Pydantic model, depending on the 'stix_format' flag.
"""
if not case:
all_techniques = self.get_techniques()
Expand Down