| """ | |
| id: proc | |
| title: Process Control (unsafe) | |
| author: admin | |
| description: List and manage processes. | |
| version: 0.1.0 | |
| license: Proprietary | |
| """ | |
| import subprocess | |
| import os | |
| class Tools: | |
| def ps(self, args: str = "aux") -> dict: | |
| """Run ps with args (default 'aux').""" | |
| p = subprocess.run( | |
| ["bash", "-lc", f"ps {args}"], capture_output=True, text=True | |
| ) | |
| return {"stdout": p.stdout, "stderr": p.stderr, "exit_code": p.returncode} | |
| def kill(self, pid: int, sig: int = 15) -> dict: | |
| """Send signal to PID (default 15).""" | |
| os.kill(pid, sig) | |
| return {"killed": pid, "signal": sig} | |