Fix is_installed crash on sub-collections (OtherTools)

OtherTools.TOOLS contains HackingToolsCollection instances (like
SocialMediaBruteforceTools) which don't have the is_installed property.
- Guard is_installed access with hasattr() in both the status column
  and the not_installed count for Install All
- Sub-collections show blank status; individual tools show ✔/✘
This commit is contained in:
Hardik Zinzuvadiya 2026-03-15 18:41:32 +05:30
parent 511a651e0a
commit 91135bdf5f

View file

@ -373,11 +373,12 @@ class HackingToolsCollection:
for index, tool in enumerate(active, start=1):
desc = getattr(tool, "DESCRIPTION", "") or ""
desc = desc.splitlines()[0] if desc != "" else ""
status = "[green]✔[/green]" if tool.is_installed else "[dim]✘[/dim]"
has_status = hasattr(tool, "is_installed")
status = ("[green]✔[/green]" if tool.is_installed else "[dim]✘[/dim]") if has_status else ""
table.add_row(str(index), status, tool.TITLE, desc)
# Count not-installed tools for "Install All" label
not_installed = [t for t in active if not t.is_installed]
# Count not-installed tools for "Install All" label (skip sub-collections)
not_installed = [t for t in active if hasattr(t, "is_installed") and not t.is_installed]
if not_installed:
table.add_row(
"[bold green]97[/bold green]", "",