Skip to main content
Mole executing RPC

RPC Endpoints

Remote procedure call execution.

POST /agents/{agent-id}/rpc

Execute shell command on remote agent.

Request:

{
"password": "your-rpc-password",
"command": "whoami",
"args": ["-a"],
"stdin": "base64-encoded-input",
"timeout": 30
}

Response:

{
"exit_code": 0,
"stdout": "base64-encoded-output",
"stderr": "base64-encoded-errors",
"error": ""
}

Request Fields

FieldTypeRequiredDescription
passwordstringYes (if configured)RPC password
commandstringYesCommand to execute
args[]stringNoCommand arguments
stdinstringNoBase64-encoded stdin
timeoutintNoTimeout in seconds (default 60)

Response Fields

FieldTypeDescription
exit_codeintCommand exit code
stdoutstringBase64-encoded stdout
stderrstringBase64-encoded stderr
errorstringError message if failed

Examples

# Execute whoami
curl -X POST http://localhost:8080/agents/abc123/rpc -H "Content-Type: application/json" -d '{
"password": "secret",
"command": "whoami"
}'

# Execute ls with args
curl -X POST http://localhost:8080/agents/abc123/rpc -H "Content-Type: application/json" -d '{
"password": "secret",
"command": "ls",
"args": ["-la", "/tmp"]
}'

Security

  • Requires rpc.enabled: true in config
  • Command must be in rpc.whitelist
  • Password must match rpc.password_hash

See RPC Feature for configuration.