Skill: c0ffeeoverdose/prts-sandbox (version 1.0.0)

--- name: prts-sandbox description: Isolated Kali Linux sandbox for running pentest tools and risky commands safely. metadata: {"openclaw":{"emoji":"🛡️","requires":{"bins":["bash","curl","jq"]}}} --- # PRTS Sandbox An isolated **Kali Linux 2025.4** container. All pentest tools and risky commands run here — never on the host. ## Script path ``` ~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh ``` --- ## When to use sandbox vs host | Task | Where | |------|-------| | Running pentest tools (nmap, hydra, sqlmap, etc.) | ✅ Sandbox | | Executing downloaded/unknown scripts | ✅ Sandbox | | Anything that could break the host | ✅ Sandbox | | Editing memory/SOUL.md/agent files | ❌ Host | | Reading internal agent files | ❌ Host | --- ## How to run a command (3 steps) **Step 1 — Check if sandbox is running:** ```bash ~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh status # Returns: true (running) or false (stopped) ``` **Step 2 — Start it if stopped (or Reset if error occurs):** ```bash ~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh start # CRITICAL RULE: If the start command fails with an error stating "the container name 'protocol-space-active' is already in use", you MUST run `reset`: ~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh reset ``` **Step 3 — Execute your command:** ```bash ~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh exec nmap -sV 192.168.1.1 ~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh exec sqlmap -u "http://target/page?id=1" ~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh exec sh -c "hydra -l admin -P /wordlist.txt ssh://192.168.1.10" ``` --- ## Available tools | Category | Tools | |----------|-------| | Recon | `nmap`, `masscan`, `dnsrecon`, `dirb` | | Web | `nikto`, `gobuster`, `ffuf`, `sqlmap`, `curl`, `wget` | | Auth attacks | `hydra`, `crackmapexec` | | SMB/AD | `smbclient`, `enum4linux`, `crackmapexec` | | Password cracking | `john`, `hashcat` | | Scripting | `python3`, `nc` | --- ## Troubleshooting**Step 2 — Start it if stopped (or Reset if error occurs):** ```bash ~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh start # CRITICAL RULE: If the start command fails with an error stating "the container name 'protocol-space-active' is already in use", you MUST run `reset`: ~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh reset | Problem | Fix | |---------|-----| | Commands fail / sandbox behaves oddly | Run `sandbox-cmd.sh reset` | | API unreachable | Tell user: "Protocol Spaces API is offline" | | Need a new tool installed | Ask user to install it — do NOT run `apt-get install` yourself | | `start` returns error: "container name is already in use" | Run `sandbox-cmd.sh reset`, then verify `status` is true. | | Commands fail / sandbox behaves oddly | Run `sandbox-cmd.sh reset` | | API unreachable | Tell user: "Protocol Spaces API is offline" | | Need a new tool installed | Ask user to install it — do NOT run `apt-get install` yourself | --- ## Quick reference ```bash SANDBOX="~/.openclaw/skills/prts-sandbox/scripts/sandbox-cmd.sh" $SANDBOX status # Check if running $SANDBOX start # Start sandbox $SANDBOX stop # Stop sandbox $SANDBOX reset # Reset / fix broken sandbox $SANDBOX exec <cmd> # Run a command inside sandbox ```

path: scripts/sandbox-cmd.sh
content: #!/bin/bash
# scripts/sandbox-cmd.sh
# Wrapper for PRTS Sandbox API

API_URL="http://protocol-spaces-api:3000"
ACTION=$1
shift

call_api() {
  local method=$1
  local endpoint=$2
  local extra_args=("${@:3}")

  local response
  response=$(curl -s -X "$method" "$API_URL$endpoint" "${extra_args[@]}" 2>&1)
  local curl_exit=$?

  if [ $curl_exit -ne 0 ]; then
    echo "{\"success\":false,\"error\":\"Cannot reach API ($curl_exit): $response\"}"
    return 1
  fi

  echo "$response"
}

case "$ACTION" in
  status)
    result=$(call_api GET /is_sandbox_start) || { echo "false"; exit 1; }
    echo "$result" | jq -r '.is_running'
    ;;

  start)
    call_api POST /start | jq .
    ;;

  stop)
    call_api POST /stop | jq .
    ;;

  reset)
    call_api POST /reset | jq .
    ;;

  exec)
    if [ $# -eq 0 ]; then
      echo '{"success":false,"error":"No command provided"}'
      exit 1
    fi

    JSON_CMD=$(jq -nc --args '$ARGS.positional' -- "$@")

    response=$(call_api POST /execute \
      -H "Content-Type: application/json" \
      -d "{\"cmd\":$JSON_CMD}")
    curl_ok=$?

    # ✅ แก้บัค: เช็ค success flag ก่อน แล้วค่อย print output หรือ error
    success=$(echo "$response" | jq -r '.success')

    if [ "$success" = "true" ]; then
      echo "$response" | jq -r '.output'
    else
      echo "$response" | jq -r '.error' >&2
      exit 1
    fi
    ;;

  *)
    echo "Usage: $0 {status|start|stop|reset|exec <command>}"
    exit 1
    ;;
esac


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (MEDIUM)