SSH Fun - Command Executor
Available Endpoints
GET /
This page - shows usage information and available commands.
POST /execute
Execute a command using raw body text. Returns raw output by default, or JSON with Accept header.
Request Body (raw text):
ls -la
Response (raw text):
total 8
drwxr-xr-x 2 user staff 68 Dec 20 10:30 .
drwxr-xr-x 3 user staff 102 Dec 20 10:30 ..
-rw-r--r-- 1 user staff 1234 Dec 20 10:30 main.go
Response (JSON with Accept: application/json):
{
"success": true,
"output": "total 8\ndrwxr-xr-x 2 user staff 68 Dec 20 10:30 .\n...",
"exit_code": 0,
"duration": "15.2ms",
"timestamp": "2023-12-20T10:30:00Z",
"command": "ls -la"
}
GET /health
Health check endpoint.
GET /terminal
Interactive web SSH terminal with full shell access.
Authentication
Test Command Execution
Quick Access
Allowed Commands
Security Notes
- Only predefined commands are allowed for security
- Commands are executed with a 30-second timeout
- All command output is sanitized
- Use with caution in production environments
Example Usage
# Simple command (returns raw output)
curl -X POST http://localhost:8080/execute -d "ls -la"
# With authentication token (if enabled)
curl -X POST http://localhost:8080/execute \
-H "X-Auth-Token: your-token-here" \
-d "ls -la"
# Command with arguments (returns raw output)
curl -X POST http://localhost:8080/execute -d "find . -name '*.go'"
# Get JSON response with metadata
curl -X POST http://localhost:8080/execute \
-H "Accept: application/json" \
-H "X-Auth-Token: your-token-here" \
-d "uname -a"
# Using query parameter for token
curl -X POST "http://localhost:8080/execute?token=your-token-here" \
-d "uptime"