import json, sys tool_input = json.loads(sys.stdin.read()) command = tool_input.get("tool_input", {}).get("command", "") BLOCKED = ["rm -rf /", "dd if=", "mkfs", ":(){:|:&};:"] for blocked in BLOCKED: if blocked in command: print(f"BLOCKED: Gefährlicher Befehl erkannt: {blocked}", file=sys.stderr) sys.exit(2) # Exit-Code 2 = Operation blockiert sys.exit(0)