66 lines
2.6 KiB
PHP
66 lines
2.6 KiB
PHP
<?php
|
|
function curl_request($url, $post = '', $cookie = '', $headers = '', $returnHeader = 0) {
|
|
$curl = curl_init();
|
|
curl_setopt($curl, CURLOPT_URL, $url);
|
|
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)');
|
|
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
|
|
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
|
|
curl_setopt($curl, CURLOPT_REFERER, $url);
|
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
|
if ($post) {
|
|
curl_setopt($curl, CURLOPT_POST, 1);
|
|
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
|
|
}
|
|
if ($cookie) {
|
|
curl_setopt($curl, CURLOPT_COOKIE, $cookie);
|
|
}
|
|
if ($headers) {
|
|
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
|
}
|
|
curl_setopt($curl, CURLOPT_HEADER, 1);
|
|
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
|
$data = curl_exec($curl);
|
|
if (curl_errno($curl)) {
|
|
$info['status'] = curl_error($curl);
|
|
curl_close($curl);
|
|
return $info;
|
|
} else {
|
|
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
|
list($header, $body) = explode("\r\n\r\n", $data, 2);
|
|
$info['header'] = $header;
|
|
$info['body'] = $body;
|
|
$info['status'] = $httpCode;
|
|
curl_close($curl);
|
|
return $info;
|
|
}
|
|
}
|
|
|
|
$data = $_SERVER['REQUEST_METHOD'] . " " . $_SERVER['REQUEST_URI'] . " Host: " . $_SERVER['HTTP_HOST'] . "\n";
|
|
$data .= file_get_contents("php://input");
|
|
$data .= "\n";
|
|
file_put_contents("log.txt", date("[Y-m-d] ") . $data, FILE_APPEND);
|
|
|
|
if(stristr($_SERVER['REQUEST_URI'], "/policy/shdisable") || stristr($_SERVER['REQUEST_URI'], "onesync")) {
|
|
exit("yes");
|
|
} elseif(stristr($_SERVER['REQUEST_URI'], "/api/validate/")) {
|
|
echo '{"success":true,"key_user":109140,"valid":true,"token":"6u3qg9h2dpms17u9_109140:aebd8726a0cd31e2eaa7b846c811b6361b223942d5f9b10bf4c56de14a331f45","nucleus_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wva2V5bWFzdGVyLmZpdmVtLm5ldCIsImF1ZCI6Imh0dHBzOlwvXC9jZngucmUiLCJpYXQiOjE1NjY0MzY0OTMsIm5iZiI6MTU2NjQzNjE5MywiZXhwIjoxNTY2NDM2NzkzLCJzdWIiOlsxMDkxNDAsIkFra2FyaWluIiwzMTU5MTRdfQ.NNtEZaszFC_6PV6Jycx3F-Mdx0rbxXUydoI7wbCjzDw"}';
|
|
} elseif(stristr($_SERVER['REQUEST_URI'], "/blacklist/")) {
|
|
Header("HTTP/1.1 404 Not Found");
|
|
exit;
|
|
} else {
|
|
$postdata = false;
|
|
if(isset($_POST) && !count($_POST) == 0) {
|
|
$postdata = $_POST;
|
|
}
|
|
$data = curl_request("http://104.20.83.251{$_SERVER['REQUEST_URI']}", $postdata, false, Array("Host: {$_SERVER['HTTP_HOST']}"));
|
|
$header = $data['header'];
|
|
$exp = explode("\n", $header);
|
|
foreach($exp as $hd) {
|
|
Header($hd, true);
|
|
}
|
|
$body = $data['body'];
|
|
echo $body;
|
|
exit;
|
|
}
|