diff --git a/Dockerfile b/Dockerfile index 42b1c0d..01022be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ LABEL org.opencontainers.image.title="hackingtool" \ # - --no-install-recommends keeps the layer lean RUN apt-get update && \ apt-get install -y --no-install-recommends \ - git python3-pip curl wget php && \ + git python3-pip python3-venv curl wget php && \ rm -rf /var/lib/apt/lists/* WORKDIR /root/hackingtool diff --git a/core.py b/core.py index def583f..fe93b9a 100644 --- a/core.py +++ b/core.py @@ -113,10 +113,12 @@ class HackingTool: if self.PROJECT_URL: table.add_row("98", "Open Project Page") - table.add_row("99", f"Back to {parent.TITLE if parent else 'Exit'}") + table.add_row("99", f"Back to {parent.TITLE if parent else 'Main Menu'}") console.print(table) - raw = Prompt.ask("\n[bold cyan][?] Select an option[/bold cyan]", default="99") + raw = Prompt.ask("\n[bold cyan][?] Select an option[/bold cyan]", default="") + if not raw.strip(): + continue try: choice = int(raw) except ValueError: @@ -125,9 +127,7 @@ class HackingTool: continue if choice == 99: - if parent is None: - sys.exit() - return 99 + return elif choice == 98 and self.PROJECT_URL: self.show_project_page() elif 1 <= choice <= len(self.OPTIONS): @@ -272,10 +272,12 @@ class HackingToolsCollection: if incompatible: console.print(f"[dim]({len(incompatible)} tools hidden — not supported on current OS)[/dim]") - table.add_row("99", f"Back to {parent.TITLE if parent else 'Exit'}") + table.add_row("99", f"Back to {parent.TITLE if parent else 'Main Menu'}") console.print(table) - raw = Prompt.ask("\n[bold cyan][?] Choose a tool[/bold cyan]", default="99") + raw = Prompt.ask("\n[bold cyan][?] Choose a tool[/bold cyan]", default="") + if not raw.strip(): + continue try: choice = int(raw) except ValueError: @@ -283,9 +285,7 @@ class HackingToolsCollection: continue if choice == 99: - if parent is None: - sys.exit() - return 99 + return elif choice == 98 and archived: self._show_archived_tools() elif 0 <= choice < len(active): diff --git a/install.py b/install.py index 775063b..01eb4a0 100755 --- a/install.py +++ b/install.py @@ -107,11 +107,14 @@ def install_system_packages(): console.print("[warning]Skipping system packages — no package manager found.[/warning]") return + # Use sudo only when not already root (uid != 0). + # Inside Docker we run as root and sudo is not installed. + priv = "" if os.geteuid() == 0 else "sudo " + # Update index first (skip for brew — not needed) if mgr != "brew": update_cmd = PACKAGE_UPDATE_CMDS.get(mgr, "") if update_cmd: - priv = "" if CURRENT_OS.system == "macos" else "sudo " console.print(f"[dim]Updating package index ({mgr})...[/dim]") subprocess.run(f"{priv}{update_cmd}", shell=True, check=False) @@ -121,7 +124,6 @@ def install_system_packages(): install_tpl = PACKAGE_INSTALL_CMDS[mgr] cmd = install_tpl.format(packages=" ".join(packages)) - priv = "" if CURRENT_OS.system == "macos" else "sudo " console.print(f"[dim]Installing system dependencies ({mgr})...[/dim]") result = subprocess.run(f"{priv}{cmd}", shell=True, check=False) if result.returncode != 0: