in cortado/cli.py [0:0]
def print_rtas(as_json: bool = False):
"""
Print information about all available RTAs
"""
registry = get_registry()
sorted_names = sorted(registry.keys())
if as_json:
rtas_data: list[dict[str, Any]] = [registry[name].as_dict() for name in sorted_names]
print(json.dumps(rtas_data, sort_keys=True))
return
table = Table(show_header=True, header_style="bold magenta", box=box.MINIMAL, border_style="grey50")
table.add_column("ID", no_wrap=True)
table.add_column("Name")
table.add_column("Platforms")
table.add_column("Endpoint Rules")
table.add_column("SIEM Rules")
table.add_column("Techniques")
for name in sorted_names:
rta = registry[name]
if not rta.endpoint_rules and not rta.siem_rules:
endpoint_rules_count = Text.assemble(("0", "red"))
siem_rules_count = Text.assemble(("0", "red"))
else:
endpoint_rules_count = str(len(rta.endpoint_rules))
siem_rules_count = str(len(rta.siem_rules))
table.add_row(
Text.assemble((rta.id, "dim")),
rta.name,
", ".join(rta.platforms),
endpoint_rules_count,
siem_rules_count,
", ".join(rta.techniques),
)
console = Console()
console.print(table)