Phase 13 (cont): Final os.system cleanup

- 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)
This commit is contained in:
Hardik Zinzuvadiya 2026-03-15 13:55:05 +05:30
parent d1bcca5675
commit 974896bf10
2 changed files with 4 additions and 2 deletions

View file

@ -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):

View file

@ -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]")