From 974896bf1094141ac9d934a61355f0931d897475 Mon Sep 17 00:00:00 2001 From: Hardik Zinzuvadiya <25708027+Z4nzu@users.noreply.github.com> Date: Sun, 15 Mar 2026 13:55:05 +0530 Subject: [PATCH] Phase 13 (cont): Final os.system cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - anonsurf.py: os.system("sudo anonsurf stop") → subprocess.run list form - tool_manager.py: os.system(f"{priv}{cmd}") → subprocess.run(shell=True) (shell=True justified: cmd is from hardcoded PACKAGE_UPDATE_CMDS dict, not user input) --- tools/anonsurf.py | 3 ++- tools/tool_manager.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/anonsurf.py b/tools/anonsurf.py index 4ac0a7a..96ea134 100644 --- a/tools/anonsurf.py +++ b/tools/anonsurf.py @@ -24,8 +24,9 @@ class AnonymouslySurf(HackingTool): super().__init__([("Stop", self.stop)]) def stop(self): + import subprocess console.print("[bold magenta]Stopping Anonsurf...[/bold magenta]") - os.system("sudo anonsurf stop") + subprocess.run(["sudo", "anonsurf", "stop"]) class Multitor(HackingTool): diff --git a/tools/tool_manager.py b/tools/tool_manager.py index 6f5f8c5..3a8ce50 100644 --- a/tools/tool_manager.py +++ b/tools/tool_manager.py @@ -25,7 +25,8 @@ class UpdateTool(HackingTool): cmd = PACKAGE_UPDATE_CMDS.get(mgr) if cmd: priv = "" if CURRENT_OS.system == "macos" else "sudo " - os.system(f"{priv}{cmd}") + # shell=True needed — cmd contains && chains; strings are hardcoded, not user input + subprocess.run(f"{priv}{cmd}", shell=True, check=False) else: console.print("[warning]Unknown package manager — update manually.[/warning]")