-
-
Notifications
You must be signed in to change notification settings - Fork 9
Invoke Method
Namhyeon, Go edited this page Oct 18, 2024
·
7 revisions
The Invoke Method feature has been supported since Caterpillar Proxy version 0.1.5.17. This feature allows you to remotely call functions defined on the server.
First, create a request in JSON format as shown below. Save it as a file named phpversion.json
.
{
"jsonrpc": "2.0",
"method": "relay_invoke_method",
"params": {
"callback": "phpversion",
"args": []
},
"id": ""
}
Next, use curl to perform a test to call the server's function remotely.
curl -X POST --data "@phpversion.json" -H "Content-Type: application/json" -H "User-Agent: php-httpproxy/curl" http://YOUR_HOSTNAME/
You should see the phpversion output as shown below.
{"jsonrpc":"2.0","result":{"status":200,"data":"8.2.18"},"id":""}
> curl -X POST --data "{\"jsonrpc\":\"2.0\",\"method\":\"relay_invoke_method\",\"params\":{\"callback\":\"shell_exec\",\"args\":[\"whoami\"]},\"id\":\"\"}" -H "Content-Type: application/json" -H "User-Agent: php-httpproxy/curl" http://YOUR_HOSTNAME/
{"jsonrpc":"2.0","result":{"status":200,"data":"www-data\n"},"id":""}
This document may contain outdated content. For the latest information, please contact us directly or refer to the webpage below.