msticpy/data/drivers/mordor_driver.py
def _get_driver_queries(self):
        """Generate iterable of Mordor queries."""
        for mdr_item in self.mordor_data.values():
            for file_path in mdr_item.get_file_paths():
                mitre_data = mdr_item.get_attacks()
                techniques = ", ".join(
                    f"{att.technique}: {att.technique_name}" for att in mitre_data
                )

                tactics = ", ".join(
                    f"{tac[0]}: {tac[1]}"
                    for att in mitre_data
                    for tac in att.tactics_full
                )

                doc_string: List[str] = [
                    f"{mdr_item.title}",
                    "",
                    "Notes",
                    "-----",
                    f"Mordor ID: {mdr_item.id}",
                    mdr_item.description or "",
                    "",
                    f"Mitre Techniques: {techniques}",
                    f"Mitre Tactics: {tactics}",
                ]
                q_container, _, full_name = file_path["qry_path"].partition(".")
                short_name = file_path["qry_path"].split(".")[-1]
                yield {
                    "name": full_name,
                    "description": "\n".join(doc_string),
                    "query_name": short_name,
                    "query": file_path["file_path"],
                    "query_container": q_container,
                    "metadata": {},
                }
Generate iterable of Mordor queries.
Generate iterable of Mordor queries.
Generate iterable of Mordor queries .
def _get_driver_queries(self):
        for mdr_item in self.mordor_data.values():
            for file_path in mdr_item.get_file_paths():
                mitre_data = mdr_item.get_attacks()
                techniques = ", ".join(
                    f"{att.technique}: {att.technique_name}" for att in mitre_data
                )
                tactics = ", ".join(
                    f"{tac[0]}: {tac[1]}"
                    for att in mitre_data
                    for tac in att.tactics_full
                )
                doc_string: List[str] = [
                    f"{mdr_item.title}",
                    "",
                    "Notes",
                    "-----",
                    f"Mordor ID: {mdr_item.id}",
                    mdr_item.description or "",
                    "",
                    f"Mitre Techniques: {techniques}",
                    f"Mitre Tactics: {tactics}",
                ]
                q_container, _, full_name = file_path["qry_path"].partition(".")
                short_name = file_path["qry_path"].split(".")[-1]
                yield {
                    "name": full_name,
                    "description": "\n".join(doc_string),
                    "query_name": short_name,
                    "query": file_path["file_path"],
                    "query_container": q_container,
                    "metadata": {},
                }
def _get_driver_queries ( self ) : for mdr_item in self . mordor_data . values ( ) : for file_path in mdr_item . get_file_paths ( ) : mitre_data = mdr_item . get_attacks ( ) techniques = ", " . join ( f"{att.technique}: {att.technique_name}" for att in mitre_data ) tactics = ", " . join ( f"{tac[0]}: {tac[1]}" for att in mitre_data for tac in att . tactics_full ) doc_string : List [ str ] = [ f"{mdr_item.title}" , "" , "Notes" , "-----" , f"Mordor ID: {mdr_item.id}" , mdr_item . description or "" , "" , f"Mitre Techniques: {techniques}" , f"Mitre Tactics: {tactics}" , ] q_container , _ , full_name = file_path [ "qry_path" ] . partition ( "." ) short_name = file_path [ "qry_path" ] . split ( "." ) [ - 1 ] yield { "name" : full_name , "description" : "\n" . join ( doc_string ) , "query_name" : short_name , "query" : file_path [ "file_path" ] , "query_container" : q_container , "metadata" : { } , }
Generate iterable of Mordor queries.
Generate iterable of Mordor queries .
"""Generate iterable of Mordor queries."""
self