mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-05 17:31:03 +00:00
Update index.php
This commit is contained in:
parent
9a6b68cf9a
commit
24e05065f1
|
@ -9,10 +9,12 @@
|
||||||
* Updated at: 2024-11-26
|
* Updated at: 2024-11-26
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("PHP_HTTPPROXY_VERSION", "0.1.6.4");
|
define("PHP_HTTPPROXY_VERSION", "0.1.6.5");
|
||||||
define("DEFAULT_SOCKET_TIMEOUT", 1);
|
define("DEFAULT_SOCKET_TIMEOUT", 1);
|
||||||
define("STATEFUL_SOCKET_TIMEOUT", 30);
|
define("STATEFUL_SOCKET_TIMEOUT", 30);
|
||||||
define("MAX_EXECUTION_TIME", 0);
|
define("MAX_EXECUTION_TIME", 0);
|
||||||
|
define("ALLOW_INVOKE_INSECURE_METHOD", false);
|
||||||
|
define("ALLOW_LOAD_INSECURE_SCRIPT", true);
|
||||||
define("DEFAULT_USER_AGENT", 'php-httpproxy/' . PHP_HTTPPROXY_VERSION . ' (Server; PHP ' . phpversion() . '; Caterpillar; abuse@catswords.net)');
|
define("DEFAULT_USER_AGENT", 'php-httpproxy/' . PHP_HTTPPROXY_VERSION . ' (Server; PHP ' . phpversion() . '; Caterpillar; abuse@catswords.net)');
|
||||||
|
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
@ -88,6 +90,10 @@ register_shutdown_function("fatal_handler");
|
||||||
|
|
||||||
function load_script($data) {
|
function load_script($data) {
|
||||||
$loaded_script = false;
|
$loaded_script = false;
|
||||||
|
|
||||||
|
if (!ALLOW_LOAD_INSECURE_SCRIPT) {
|
||||||
|
return $loaded_script;
|
||||||
|
}
|
||||||
|
|
||||||
$fh = tmpfile();
|
$fh = tmpfile();
|
||||||
if ($fh !== false) {
|
if ($fh !== false) {
|
||||||
|
@ -514,7 +520,21 @@ function relay_invoke_method($params) {
|
||||||
$callback = $params['callback'];
|
$callback = $params['callback'];
|
||||||
$requires = jsonrpc2_cast_to_array($params['requires']);
|
$requires = jsonrpc2_cast_to_array($params['requires']);
|
||||||
$args = jsonrpc2_cast_to_array($params['args']);
|
$args = jsonrpc2_cast_to_array($params['args']);
|
||||||
|
|
||||||
|
if (!ALLOW_INVOKE_INSECURE_METHOD) {
|
||||||
|
$allow_callbacks = array("idn_to_ascii", "idn_to_utf8", "load_script");
|
||||||
|
if (!in_array($callback, $allow_callbacks)) {
|
||||||
|
return array(
|
||||||
|
"success" => false,
|
||||||
|
"error" => array(
|
||||||
|
"status" => 403,
|
||||||
|
"code" => -1,
|
||||||
|
"message" => $callback . " is not allowed"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach($requires as $required_url) {
|
foreach($requires as $required_url) {
|
||||||
try {
|
try {
|
||||||
$result = relay_fetch_url(array(
|
$result = relay_fetch_url(array(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user